Skip to content

8.4 Performance is useful only with reproducible science

These are unexecuted teaching inputs and starting models. Original diagrams are schematics, not calculated results. Validate version-specific syntax, licensed or authorized data, numerical convergence and the scientific model before using this workflow.

8.4.1 Model, units and provenance

Keep basis/potential files and executable versions traceable. Grid controls use Ry; common energy/force outputs use hartree and hartree/bohr. Read the unit in each output heading.

Shared inputs, conventions and evidence

Original schematic: Performance is useful only with reproducible science. No numerical results are claimed.
Original schematic: Performance is useful only with reproducible science. No numerical results are claimed.

8.4.2 Unexecuted inputs and explicit deltas

Use the accompanying instructions to identify the parent calculation and placement of every delta; a snippet is not automatically a standalone input. Preserve all blank-line and file-provenance requirements.

8.4.2.1 Input block 1

PRINT_LEVEL LOW
&TIMINGS ON
  THRESHOLD 0.01
  SORT_BY_SELF_TIME T
&END TIMINGS

8.4.2.2 Input block 2

export OMP_NUM_THREADS=4
export OMP_PLACES=cores
export OMP_PROC_BIND=close
mpiexec -n 4 cp2k.psmp -i bench.inp -o bench_4x4.out

8.4.3 Worked investigation

Intuition and prerequisite. More processes do not guarantee a faster calculation. CP2K distributes grids, sparse matrices, exchange integrals, and other work differently, so the useful MPI/OpenMP balance depends on the scientific workload and machine. Strong scaling keeps the problem fixed while increasing resources; throughput asks how many independent useful calculations finish per allocation. A tiny water molecule is a poor proxy for production liquid-water MD or hybrid calculations. Select a representative, already converged input, and fix its geometry, restart state, numerical thresholds, output frequency, and number of steps before benchmarking. The official CP2K benchmark suite emphasizes workload-specific comparisons and MPI/OpenMP layouts.

Original input delta, valid syntax. Merge this inside the existing GLOBAL section. It changes reporting, not the physical Hamiltonian. The timing controls are documented in the 2025.2 TIMINGS reference.

See input block 1 above.

THRESHOLD 0.01 requests contributions at about the one-percent reporting threshold. Exclusive/self time differs from inclusive time: adding inclusive totals across nested routines double-counts work. Timing output is normally produced at termination, so retain a cleanly finished representative benchmark.

Launch example: shell template, not CP2K input and not executed here. The following assumes an allocated host with at least 16 physical cores, a compatible MPI launcher, and an MPI+OpenMP executable named cp2k.psmp. Scheduler commands, affinity policy, and executable names must be adapted to the actual site.

See input block 2 above.

Four ranks times four threads represent 16 software workers; verify placement on distinct permitted physical cores. These variables alone cannot guarantee correct binding or prevent a threaded math library from oversubscribing. Consult site guidance and inspect actual affinity. The University of Edinburgh EPCC placement discussion demonstrates why distribution matters; its historical hardware measurements are not predictions for a current machine.

Procedure. 1. Record CP2K version/build, compiler, MPI, BLAS/FFT libraries, accelerator backend, CPU/GPU model, node count, rank/thread layout, binding, and data-file hashes. 2. Prepare independent run directories with identical initial files. Decide whether setup is part of the target cost; report both end-to-end time and steady-state MD/SCF performance where relevant. 3. At fixed core count, compare reasonable MPI×thread layouts. Then perform strong scaling across allocations, keeping the scientific problem unchanged. 4. Repeat runs sufficiently to identify machine noise. Report a median and spread, memory use, successful SCF iteration count, and completed steps. A quicker unconverged calculation is not a speedup. 5. Compare energies and forces within declared numerical tolerances. For long chaotic MD, require consistent statistical observables rather than identical late-time coordinates. 6. Archive inputs, restart files, complete output, job script, environment manifest, and analysis code. Test that another person can recreate the benchmark setup from that archive.

Interpretation and sanity. Relative to a baseline using P0 cores, speedup is S(P)=T(P0)/T(P), and efficiency is S(P)/(P/P0). Core-hours scale as P×T(P), so minimum wall time need not minimize cost. Compare measured SCF work: different reduction order can change iteration counts, making a pure hardware comparison less clean. For replica tasks, independent windows or displacements may deliver better throughput than overparallelizing one tiny calculation. GPU acceleration depends on the build, backend, and accelerated fraction of the workload; no universal speedup is promised.

Pitfalls, exercise, diagram. Changing cutoff, basis, ADMM, or SCF tolerance while tuning process layout changes both science and performance. A random seed does not guarantee bitwise agreement across rank counts, library versions, or hardware. Separate bitwise, numerical, and statistical reproducibility in the report. Exercise: build a blank results table with layout, wall time, core-hours, SCF work, energy deviation, and memory. Define acceptance criteria before benchmarking, then choose the layout for either minimum turnaround or maximum throughput.

8.4.5 Sources and further reading