Run on an HPC cluster¶
Running a band or saddle search as a Slurm job means building for the CPU
that will run it, sizing ranks and threads against the allocation, keeping
the output of each search on durable storage, and resubmitting a search that
the time limit ended. This page covers each step for gprn and gprd, and
runs the resubmission on a small case. It assumes the MPI build and the
flags of Run a search across MPI ranks.
Build on the node type that will run the program¶
Login nodes submit jobs, inspect status and transfer files. Compile, test
and profile on an allocated compute node. By default salloc leaves your
shell on the login node, unless the site sets
LaunchParameters=use_interactive_step (salloc manual). Start the build with
srun, and print the host and the job to confirm where it runs:
salloc --nodes=1 --ntasks=16 --time=02:00:00
srun --ntasks=1 --cpus-per-task=16 bash -c '
hostname
printf "job=%s\n" "${SLURM_JOB_ID:?no allocation}"
pixi run -e scalapack build-scalapack-real
'
The pixi task takes its job count from SLURM_CPUS_PER_TASK, then
SLURM_CPUS_ON_NODE, then nproc. The build downloads the Meson wraps and
the Cargo crates that the repository pins, so run it where your site allows
network access (Native EasyBuild installation explains the downloads).
The routes to a binary are:
pixi, for a portable build: the tasks of Run a search across MPI ranks. The default pixi environment is a generic x86-64-v3 binary (EESSI overlay vs. the default pixi environment).
The site’s compiler, MPI and BLAS through EESSI and EasyBuild: Native EasyBuild installation, with the ScaLAPACK recipe for MPI. eb-local sets up the shell:
eval "$(eb-local dev MODULE...)"loads EESSI, the modules you name and a build environment that records library paths in the executable, so the program runs withoutLD_LIBRARY_PATH(Compile your code against EESSI).Spack installation with the
+mpivariant (Installation).Kokkos with CUDA or HIP for local dense GP operations: Build the Kokkos backend for CPU, CUDA or HIP.
Downstream packages of
libgpridge: Native packages and downstream bindings.
Two rules apply to every route.
Build on the node type that will run the program. EESSI chooses its binaries for the CPU it finds when it loads, and eb-local keeps one tree per CPU target, so a build on one node type is not found on another. The default pixi build and the Meson option
simd_baselinetarget x86-64-v3 (AVX2 and FMA, Haswell and Zen 1 or later) on x86-64. Set-Dsimd_baseline=x86-64-v2,nativeor another value for older hardware. The level does not change results while Eigen stays unvectorized, which is the default.-Dscalar_eigen=falseopts into vectorized Eigen and can change results.Use one provider for each linked library, and check the result with
ldd(eb-local checkon an EESSI build prints the run paths and reports problems). EESSI’s installations are read-only: a test that patches an executable needs a private writable copy.
The eb-local build workspace lives on the allocation’s node-local disk and
goes when the job ends. Its install prefix defaults to $HOME/eessi
(option --project DIR or the prefix setting change it), and must be
neither on shared scratch nor below the node-local root (Where a build puts things).
The EasyBuild recipes use EESSI 2026.06. The pixi overlay in eessi/ pins
its own, older modules.
Write the job script¶
One Slurm task is one MPI rank. The script below runs the pentamer band of the tutorial on four ranks of one node:
#!/bin/bash
#SBATCH --job-name=gprn-band
#SBATCH --partition=<partition>
#SBATCH --account=<account>
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --cpus-per-task=1
#SBATCH --time=02:00:00
#SBATCH --output=%x-%j.out
# Load the modules or the environment that built the binary here.
GPRN=$HOME/gpridge/bld-gprn/gprn
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
mkdir -p band
srun --cpus-per-task="$SLURM_CPUS_PER_TASK" --export=ALL \
"$GPRN" --reactant reactant.con --product product.con \
--potential lj --nimages 7 --gp-model-profile gprd_zbl \
--output band/neb.h5 --write-con band/band.con > band/gprn.log 2>&1
status=$?
echo "gprn exit status: $status"
exit "$status"
Replace
<partition>and<account>with the values of your site, or drop the lines where the scheduler has defaults.--ntasksis the rank count.--cpus-per-taskis the CPU count per rank, and thesrunline repeats it for the step.gprnexits with 0 when the search converged (or when--max-iterations 0requested band setup only), 2 when it did not or when the observation archive is misconfigured, and 1 on an error. The script passes the status on, so Slurm marks a search that did not converge as a failed job. Status 2 is not a crash: readband/gprn.log.If your MPI library is not built for Slurm’s launcher, start the ranks with
mpirun -np "$SLURM_NTASKS" -x PATH -x LD_LIBRARY_PATH -x OMP_NUM_THREADSin place ofsrun. A wrapper that may run both inside and outside a Slurm job can testSLURM_JOB_IDand picksrunormpirunfrom it.mpirun -np Ncan stop with a message about the number of slots available. Open MPI’s runtime sizes the slots fromSLURM_NTASKSandSLURM_TASKS_PER_NODE, and a step with fewer tasks thanN(a wrapper such assrun -n 1 python -m snakemakeis one) reports fewer. Set both variables toNand unsetSLURM_STEP_NUM_TASKSandSLURM_NPROCSbefore callingmpirunfrom such a step.
Set ranks and threads¶
Three counts decide the load, and their product must stay within the cores of the allocation.
Ranks:
--ntasks. Under MPI the ranks share the oracle points of a step and the dense linear algebra (the MPI page explains both).Threads inside a rank:
--cpus-per-task, used through--linalg-threadsor--kernel-threads(default 1 each; both above 1 is an error). Distributed builds reject OpenMP at configure time, so these two flags are the threads ofgprnitself. The MPI page lists their effect.Threads of the oracle:
OMP_NUM_THREADS,OPENBLAS_NUM_THREADSandMKL_NUM_THREADS.gprnandgprdset these andRAYON_NUM_THREADSto 1 when they are unset, and keep what you export. Export the values your oracle library should use before the launcher.
Pin the process layout for timing comparisons and check the CPU binding of the step, because an inherited binding mask can conflict with a smaller diagnostic step. Request a GPU in every Slurm step that uses it, and record the visible device and driver inside that step (How to: Run gprn on the GPU).
Keep the output of each search¶
A gprn run produces the files below. --output defaults to
gpr_neb_out.h5.
Path |
Content |
|---|---|
the log on standard output |
one copy, from rank 0; redirect it to a file |
|
HDF5 result of the search |
|
final band, one frame per image |
|
JSON file of the validation stencil |
|
readcon-db archive of every oracle evaluation ( |
gprd prints its log to standard output and writes its archive to
obs-archive/ beside --pos (--gp-observation-archive auto).
Rank 0 writes all of these files. The
gprnarchive needs a readcon-db build; without one,gprnexits with status 2 unless you pass--gp-observation-archive off.Give every independent search its own
--outputdirectory. A run adopts every row already in the archive beside its--output, so two searches in one directory train on each other’s evaluations. A job array should write toband-$SLURM_ARRAY_TASK_ID/.Write to storage that outlives the job: project or shared scratch space. A node-local directory such as
$TMPDIRgoes with the allocation, so copy the output directory back before the job ends. Check inode use as well as bytes: the archive and the logs are many small files.Keep the source archives, the manifests and the results on shared storage, and unpack environments and build trees onto the allocation’s scratch. Copy results back and verify their checksums before the allocation ends.
Resubmit an interrupted search¶
The archive makes a restart cheaper. A new gprn run on an existing
archive trains the GP on every finite row in it and does not request the
same geometries again (setObservationArchive in gpr/neb/Session.h).
The search starts again from the endpoints and the band, not from the
optimizer state of the old run. The archive is appended to while the run
progresses, so a job that the time limit kills leaves the rows it had
evaluated. This restart behaviour is that of gprn.
The block shows it on the pentamer. A run limited to three outer iterations stands in for a job that ran out of time:
examples="$GPRIDGE_ROOT/examples/lj-pentamer"
cp "$examples/reactant.con" "$examples/product.con" .
status=0
gprn --reactant reactant.con --product product.con \
--potential lj --nimages 7 --gp-model-profile gprd_zbl \
--max-iterations 3 --output band/neb.h5 > first.log 2>&1 || status=$?
test "$status" -eq 2
grep -E '^(Oracle calls:|Converged:)' first.log
Oracle calls: 8 (neb=8, dimer=0, certificate=0, transition=0)
Converged: no
The exit status 2 marks the search as not converged, as in a job that
timed out. Submit the same command again with the same --output:
gprn --reactant reactant.con --product product.con \
--potential lj --nimages 7 --gp-model-profile gprd_zbl \
--output band/neb.h5 > second.log 2>&1
grep -E '^(Oracle calls|Converged:|Certified:)' second.log
grep -q 'endpoints=0' second.log
grep -q '^Converged: yes' second.log
awk '/^Barrier energy/ { b = $4 } END { exit !(b > 0.622 && b < 0.625) }' second.log
Oracle calls (to convergence): <n> (endpoints=0, initial=0, outer=<n>, dimer=0, certificate=0, transition=0)
Oracle calls (with validation): <n> (validation=0)
Oracle calls: <n> (neb=<n>, dimer=0, certificate=0, transition=0)
Converged: yes
Certified: yes
The second run converged with 7 oracle calls and none for the endpoints, which the first run had already evaluated. The block asserts that the barrier lies within 1e-3 eV of 0.6232 eV, the value of the pentamer tutorial’s fresh run, which needed 17 calls. The counts depend on the build and the machine.
Python environments for the workflow¶
Use the native stack for the compiled programs. When a workflow needs a
separate Python environment, pixi-pack packs an environment of the
manifest as one archive (pixi global install pixi-pack pixi-unpack, or
pixi exec pixi-pack). Pack on a host with network access and unpack on
the allocation’s scratch. The manifest names its platform linux-build:
pixi-pack --environment analysis --platform linux-build pixi.toml
pixi-unpack environment.tar
source activate.sh
Pack creates environment.tar, and unpack creates env/ and activate.sh.
Named platforms need a lockfile of version 7 or later, which pixi.lock
has. pixi-pack bundles only PyPI wheels, so a source-only PyPI dependency
needs a wheel that you build and keep, or the flag
--ignore-pypi-non-wheel, which skips it.
Measure a run¶
Time initialisation, warm-up and repeated work separately. Compare runs
with the same inputs, seeds, precision and convergence rule, and keep the
oracle counts, the final geometries and the certificate result with the
wall time. Run the repository’s native tests through meson test so that
each gets its declared working directory and environment. The
performance guide explains how to
measure scaling, and Find where a search spends its time
covers the profilers.
See also¶
Run a search across MPI ranks: the build tasks, launch lines and flags.
Native EasyBuild installation, EESSI overlay vs. the default pixi environment and Native packages and downstream bindings.
gprn flag reference:
--output,--write-con,--gp-observation-archive,--max-iterations.