===================== 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 :doc:`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: .. code:: bash 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 (:doc:`Native EasyBuild installation ` explains the downloads). The routes to a binary are: - pixi, for a portable build: the tasks of :doc:`Run a search across MPI ranks `. The default pixi environment is a generic x86-64-v3 binary (:doc:`EESSI overlay vs. the default pixi environment `). - The site's compiler, MPI and BLAS through EESSI and EasyBuild: :doc:`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 without ``LD_LIBRARY_PATH`` (`Compile your code against EESSI `_). - :doc:`Spack installation ` with the ``+mpi`` variant (:doc:`Installation <../getting-started/installation>`). - Kokkos with CUDA or HIP for local dense GP operations: :doc:`Build the Kokkos backend for CPU, CUDA or HIP `. - Downstream packages of ``libgpridge``: :doc:`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_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 :doc:`tutorial <../tutorials/gprn_lj_pentamer>` on four ranks of one node: .. code:: bash #!/bin/bash #SBATCH --job-name=gprn-band #SBATCH --partition= #SBATCH --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 ```` and ```` 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 (:doc:`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 :doc:`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 (:doc:`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``. .. table:: +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Path | Content | +======================================+===============================================================================================================================================================================================================================================================================================================+ | the log on standard output | one copy, from rank 0; redirect it to a file | +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--output`` | HDF5 result of the search | +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--write-con`` | final band, one frame per image | +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--oracle-stencil`` | JSON file of the validation stencil | +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``obs-archive/`` beside ``--output`` | readcon-db archive of every oracle evaluation (``observations.rdb/``, an LMDB database), the ``irc_certificate.txt`` of the :doc:`IRC certificate ` , and at the end of a run ``kernel.txt`` and ``training/``, the fitted kernel and the final training set that seed a single-ended search | +--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ``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 ``gprn`` archive needs a readcon-db build; without one, ``gprn`` exits with status 2 unless you pass ``--gp-observation-archive off``. - Give every independent search its own ``--output`` directory. 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 to ``band-$SLURM_ARRAY_TASK_ID/``. - Write to storage that outlives the job: project or shared scratch space. A node-local directory such as ``$TMPDIR`` goes 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: .. code:: bash 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``: .. code:: bash 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): (endpoints=0, initial=0, outer=, dimer=0, certificate=0, transition=0) Oracle calls (with validation): (validation=0) Oracle calls: (neb=, 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``: .. code:: bash 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 :doc:`performance guide <../explanation/performance>` explains how to measure scaling, and :doc:`Find where a search spends its time ` covers the profilers. See also -------- - :doc:`Run a search across MPI ranks `: the build tasks, launch lines and flags. - :doc:`Native EasyBuild installation `, :doc:`EESSI overlay vs. the default pixi environment ` and :doc:`Native packages and downstream bindings `. - :doc:`gprn flag reference <../reference/cli_reference_gprn>`: ``--output``, ``--write-con``, ``--gp-observation-archive``, ``--max-iterations``. - `eb-local documentation `_ and `EasyBuild documentation `_.