INSPECT

Intra Node Stencil Performance Evaluation Collection

Stencil Properties

dimension 3D
radius 2
weighting point-symmetric
kind star
coefficients variable
datatype double
machine BroadwellEP_E5-2697_CoD
FLOP per LUP 19
flavor Cluster on Die

Benchmark raw data shown on this page can be found in the according folder of the git repository.

If you have feedback, issues or found errors on this page, please submit an issue on the github page.

Kernel Source Code

double a[M][N][P];
double b[M][N][P];
double W[7][M][N][P];

for (long k = 2; k < M - 2; ++k) {
  for (long j = 2; j < N - 2; ++j) {
    for (long i = 2; i < P - 2; ++i) {
      b[k][j][i] = W[0][k][j][i] * a[k][j][i] +
                   W[1][k][j][i] * (a[k][j][i - 1] + a[k][j][i + 1]) +
                   W[2][k][j][i] * (a[k - 1][j][i] + a[k + 1][j][i]) +
                   W[3][k][j][i] * (a[k][j - 1][i] + a[k][j + 1][i]) +
                   W[4][k][j][i] * (a[k][j][i - 2] + a[k][j][i + 2]) +
                   W[5][k][j][i] * (a[k - 2][j][i] + a[k + 2][j][i]) +
                   W[6][k][j][i] * (a[k][j - 2][i] + a[k][j + 2][i]);
    }
  }
}

Layer Conditions

1D Layer Condition:

  • L1: unconditionally fulfilled
  • L2: unconditionally fulfilled
  • L3: unconditionally fulfilled

2D Layer Condition:

  • L1: P <= 4096/17, that is P <= 240
  • L2: P <= 32768/17, that is P <= 1920
  • L3: P <= 2883584/17, that is P <= 169620

3D Layer Condition:

  • L1: 88*N*P + 16*P*(N - 2) + 32*P <= 32768, that is N*P <= 10²
  • L2: 88*N*P + 16*P*(N - 2) + 32*P <= 262144, that is N*P <= 40²
  • L3: 88*N*P + 16*P*(N - 2) + 32*P <= 23068672, that is N*P <= 430²

Have a look at the kernel source code for dimension naming.

How to test this stencil

Generate this stencil with:

stempel gen -D 3 -r 2 -t "double" -C variable -k star -p --store stencil.c

and generate the compilable benchmark code with:

stempel bench stencil.c -m BroadwellEP_E5-2697_CoD.yml --store

Compiler flags

icc -O3 -xCORE-AVX2 -fno-alias -qopenmp -qopenmp -DLIKWID_PERFMON -Ilikwid-4.3.3/include -Llikwid-4.3.3/lib -Iheaders/dummy.c stencil_compilable.c -o stencil -llikwid

Single Core Grid Scaling

ECM Prediction vs. Performance

Comparison of the measured stencil performance (in cycles per cache line), roofline prediction and the (stacked) contributions of the ECM Performance Model predicted by kerncraft using Layer Conditions to model the cache behavior. The calculated layer conditions shown above correspond to the jumps in the ECM prediction in this plot.

might be okay...

Julian Hammer says:

Cache thrashing is happening, but hardly shown in the measurement. Measurement is > 10% off from prediction. With increasing memory traffic per iteration, the discrapency grows.


Data Transfers between Caches

Data transfers between the different cache levels and main memory. The shown data for each level contains evicted and loaded data. The measured data is represented by points and the predicted transfer rates by kerncraft by lines.

might be okay...

Julian Hammer says:

Cache simulator predicths thrashing effects, which only seldom show in measurements.


Multi Core Thread Scaling

Review status: Data has been reviewed

Single Core Spatial Blocking

might be okay...

Julian Hammer says:

A little low performance, but still disdinguishable from unblocked code.


How to replicate this data

Single Core Measurements

Using the generated stencil and kerncraft, all single core performance data shown on this page can be reproduced by:

Layer Condition Data

kerncraft -p ECM -p RooflineIACA -p Benchmark -p LC -P LC -m BroadwellEP_E5-2697_CoD.yml stencil.c -D N $GRID_SIZE -D M $GRID_SIZE -D P $GRID_SIZE -vvv --cores 1 --compiler icc

Cache Simulator Data

kerncraft -p ECM -p RooflineIACA -p Benchmark -p LC -P CS -m BroadwellEP_E5-2697_CoD.yml stencil.c -D N $GRID_SIZE -D M $GRID_SIZE -D P $GRID_SIZE -vvv --cores 1 --compiler icc

Thread Scaling Measurements

The generated benchmark code can be used to reproduce the thread scaling data shown on this page by:

kerncraft -p ECM -p RooflineIACA -p Benchmark -P LC -m BroadwellEP_E5-2697_CoD.yml stencil.c -D N $GRID_SIZE -D M $GRID_SIZE -D P $GRID_SIZE -vvv --cores $CORES --compiler icc

The roofline prediction can be obtained with kerncraft and the generated stencil:

kerncraft -p RooflineIACA -P LC -m BroadwellEP_E5-2697_CoD.yml stencil.c -D N $GRID_SIZE -D M $GRID_SIZE -D P $GRID_SIZE -vvv --cores ${threads} --compiler icc

Spatial Blocking Measurements

Generate benchmark code from the stencil with blocking and compile it as shown before:

stempel bench stencil.c -m BroadwellEP_E5-2697_CoD.yml -b 2 --store
OMP_NUM_THREADS=1 likwid-pin -C S0:0 ./stencil $GRID_SIZE $GRID_SIZE $GRID_SIZE $BLOCKING_M $BLOCKING_N $BLOCKING_P