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:

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_baseline target x86-64-v3 (AVX2 and FMA, Haswell and Zen 1 or later) on x86-64. Set -Dsimd_baseline=x86-64-v2, native or another value for older hardware. The level does not change results while Eigen stays unvectorized, which is the default. -Dscalar_eigen=false opts into vectorized Eigen and can change results.

  • Use one provider for each linked library, and check the result with ldd (eb-local check on 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.

  • --ntasks is the rank count. --cpus-per-task is the CPU count per rank, and the srun line repeats it for the step.

  • gprn exits with 0 when the search converged (or when --max-iterations 0 requested 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: read band/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_THREADS in place of srun. A wrapper that may run both inside and outside a Slurm job can test SLURM_JOB_ID and pick srun or mpirun from it.

  • mpirun -np N can stop with a message about the number of slots available. Open MPI’s runtime sizes the slots from SLURM_NTASKS and SLURM_TASKS_PER_NODE, and a step with fewer tasks than N (a wrapper such as srun -n 1 python -m snakemake is one) reports fewer. Set both variables to N and unset SLURM_STEP_NUM_TASKS and SLURM_NPROCS before calling mpirun from 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-threads or --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 of gprn itself. The MPI page lists their effect.

  • Threads of the oracle: OMP_NUM_THREADS, OPENBLAS_NUM_THREADS and MKL_NUM_THREADS. gprn and gprd set these and RAYON_NUM_THREADS to 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).

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