Strong scaling series#
scripts/benchmark/scaling.py runs a strong scaling series of SeisSol on a cluster from a single campaign file: a
case, the builds and run-time variants to compare, the node counts, and the machine. It plans the runs, builds
SeisSol, checks every run before submitting it, submits one job per node count, follows the jobs, attempts again what
did not complete, and gathers what the runs wrote into tables, plots and a report.
It needs Python 3.10 or later, PyYAML for campaign files and machine profiles in YAML (JSON works without it), and matplotlib for the plots. Slurm is supported, and the local machine without a batch system, which runs a job when it is submitted, for trying a campaign out.
A first campaign#
version: 1
name: tpv5-strong
machine:
profile: supermuc-ng
slurm: {account: pn12ab}
case:
parameter_file: tpv5/parameters.par
set:
abortcriteria.endtime: 1.0
output.wavefieldoutput: 0
epoch_interval: 0.1
builds:
- name: current
variants: ../SeisSol/scripts/compile/compile-variants.yaml
preset: quick
variants:
- name: default
- name: two-ranks
ranks_per_node: 2
scaling:
nodes: {min: 4, max: 64, factor: 2}
repetitions: 3
min_cells_per_rank: 20000
job:
time_limit: "02:00:00"
scaling.py plan tpv5-strong.yaml # the runs and jobs it would submit
scaling.py check tpv5-strong.yaml # layouts, tools, SeisSol --check
scaling.py submit tpv5-strong.yaml # build, check, and submit
scaling.py status tpv5-strong.yaml # the state of every run
scaling.py report tpv5-strong.yaml # tables and plots of what ran
scripts/benchmark/examples/campaign.yaml is a commented example. Every command can be repeated: submit
submits only the runs that did not complete, and attempts a failed run again up to job.max_attempts times, as a
new attempt; a run whose check failed is not attempted again. A campaign keeps everything in its directory
(directory, by default <name>/ next to the campaign file), and the commands take that directory in place of
the campaign file as well.
The campaign file#
Paths are relative to the campaign file. Every mapping is checked for the keys it may have, so that a misspelt key is an error.
nameThe name of the campaign, of its directory and of its jobs.
machineThe machine profile: a name of
scripts/benchmark/machines/(e.g.supermuc-ng,lumi-g,local), a path, or a mapping withprofileand settings that replace those of the profile, e.g. the account.caseparameter_file: the parameter file of every run; the runs start in its directory, so that the files it names are found as in a run started by hand.set: overrides of every run, as--settakes them (Overriding parameters on the command line); the output prefix is set per run, in its directory.epoch_interval: an epoch at least every so much simulated time (EpochInterval, Run summary).env: environment variables of every run.cells: the cells of the mesh, if they should not come from the check.buildsThe executables to compare: each either
binary, an executable built before, orvariants, a variant-set file ofscripts/compile/compile_variants.py, withpreset,toolchain,set(its--setoptions) and, for a set that builds several executables,select, the one to take. A build of a variant-set file is built anew, in the campaign directory, whenever runs are submitted, so that a series measures the source as it is; CMake rebuilds only what changed.variantsThe variants of the runs, crossed with the builds:
envandsetof their own, a layout of their own (ranks_per_node,cpus_per_rank,threads_per_rank), andlauncher_args, appended to the launcher. Without variants, there is one,default.scalingnodes: a list of node counts, or a range{min, max, factor};min: autotakes the smallest node count that holds the mesh atmax_cells_per_node.repetitionsof every run. The guardsmin_cells_per_rankandmax_cells_per_nodeleave out the node counts at which a rank would hold too few cells to scale, or a node too many to fit; they need the cells of the mesh, which the check finds.order:interleaved(the default) orblocked.jobtime_limitof a job,run_time_limitof a run,max_attemptsof a run,report_job(a job that writes the report once all runs have ended),check_in_job(whether the job checks every run before running it; on by default) andwarmup_epochs, the epochs of a run that thesteadytime leaves out (one by default).
Machine profiles#
A machine profile says what a node is and how a run starts on it, after a job script that is known to run SeisSol well:
schedulerslurmorlocal.nodecores,threads_per_core,gpus,memoryandnuma_domainsof a node.layoutranks_per_node,cpus_per_rank(the CPUs of a rank, its workers and its communication thread),threads_per_rank(its OpenMP workers,OMP_NUM_THREADS) andgpus_per_rank.slurmpartition(one, or a list of{max_nodes, partition}by the size of a job),account,qos,constraint,exclusive,cpus_per_task(whether a job asks for the CPUs of a rank) andextrasbatch options.launcherThe command that starts a run, in front of the wrapper and the executable;
{nodes},{ranks},{ranks_per_node},{cpus_per_rank},{threads_per_rank}and{gpus_per_rank}stand for the values of the run, while shell variables such as${CPU_BIND}are left to the job.wrapperA script started per rank in front of the executable, e.g.
seissol-launch, which selects the GPU of a rank, or one that pins it.setupandenvShell lines that set up a job, e.g. module loads, and the environment of every run.
scaling.py profile job.sh -o machine.yaml drafts a profile from a job script: the #SBATCH options give the
layout and the scheduler settings, the exports the environment, the module loads and other lines the setup, and the
line that starts SeisSol the launcher, with its counts of nodes and ranks replaced by the placeholders. What a job
script does not say, such as the cores and the memory of a node, the draft guesses; read and correct it.
The runs#
Each node count gets a job of its own, which runs all builds, variants and repetitions at that node count, so that
their comparison does not depend on which nodes a job got. The repetitions take turns: the first one of every build
and variant, then the second one, each time in another order. Within a job, each attempt at a run gets a directory,
runs/<run>/attempt-<k>/, and a run ID (SEISSOL_RUN_ID), which the files of the attempt carry. Before it
runs, the job checks it (SeisSol --check, Checking a run before starting it); then it runs it, with the environment of its
variant, OMP_NUM_THREADS after its layout, and its output in output/ of its directory. The attempt leaves
started, check.json and check.log, seissol.log, exitcode (and check-failed if its check
failed), and the output of SeisSol, its run summary among it.
check, and submit before it submits, checks what it can before a job waits in a queue: whether the layouts fit
a node, whether the scheduler and the partitions take the jobs, and, with SeisSol --check of every build and
variant, whether the parameters, the files they name, the mesh with the receivers and sources in it, and the output
directories are fine. That check also finds the size of the mesh, which the guards of scaling need. An executable
built for the compute nodes may not run on a login node; then this check is left to the jobs.
The results#
collect, and report before it reports, gathers what the runs wrote into results/:
runs.csvA row per run, of its latest attempt that completed: its setting, its state (
completed,failed,check-failed,incomplete,killed,not-run,queued, …), and from its run summary its times (initialization, simulation, compute, IO, kernels and outside of them), load imbalance, cell updates and duplicate cell updates, FLOP/s and peak memory; thesteadytime of the epochs after the warm-up; and the problems of its pinning, as its thread pinning table shows them: ranks of a node that share CPUs, communication threads that share CPUs with workers, ranks with fewer CPUs than workers, or workers spread over NUMA domains.ranks.csvandepochs.csvThe tables of the ranks and of the epochs of every run that completed (Run summary).
report writes, per build and variant and per node count, the median time over the repetitions and its range, the
speedup and the parallel efficiency against the smallest node count of the series, the cell updates per second and
node, the share of the duplicate cell updates, the load imbalance, and the shares of the compute time outside of the
kernels and of the blocking IO (scaling.csv, scaling.json, report.md), and plots them (plots/). Its
checks name the runs that did not complete or had problems, series whose cell updates differ between the node
counts, and repetitions that spread by more than a tenth. --metric chooses the time to scale: total, the
simulation time of the slowest rank (the default); compute, its compute part; or steady, the epochs after
the warm-up, scaled to the whole simulation.