Kahibaro
Discord Login Register

Using precompiled software on clusters

Why precompiled software is common on HPC clusters

On most HPC systems, users rely heavily on software that has already been compiled and installed by system administrators. This is because:

Your main tasks as a user are therefore:

Where precompiled software lives on a cluster

Clusters usually have a structured software stack, often under directories like:

You normally do not need to know exact paths; instead, you use:

Discovering available precompiled software

Using the module system

On most clusters, the module system is your primary interface to precompiled software.

Common commands (exact syntax may vary slightly by site):

Typical information you see:

Site documentation and software catalogs

Clusters often provide:

Always check your site documentation for:

Loading and managing software environments

Basic workflow with modules

The typical sequence:

  1. Check what’s available:
    • module avail
  2. Load required modules:
    • module load gcc/12.2.0
    • module load openmpi/4.1.5
    • module load fftw/3.3.10
  3. Verify settings:
    • which mpicc
    • echo $LD_LIBRARY_PATH

Additional useful commands:

Dealing with module hierarchies

Many systems use hierarchical modules, where:

Example:

module purge
module load gcc/12.2.0
module load openmpi/4.1.5
module load hdf5/1.12.2-mpi
module load petsc/3.20

If you change the base compiler, most dependent modules will no longer be valid; you typically:

module purge
module load intel/2024.0
module load intel-mpi/2021
module load hdf5/1.12.2-mpi

Making environments reproducible

To ensure that you and collaborators use the same stack:

# env_hpc.sh
module purge
module load gcc/12.2.0
module load openmpi/4.1.5
module load hdf5/1.12.2-mpi
module load python/3.11

Then in your batch script or interactive shell:

source env_hpc.sh

Linking your own code against precompiled libraries

Precompiled numerical libraries on clusters (BLAS, LAPACK, FFTW, PETSc, etc.) are usually made available as modules. Once loaded, they expose:

Common patterns to compile your code:

# Using library-specific wrappers or variables
module load gcc/12.2.0
module load openblas/0.3.26
gcc -O3 -o myprog myprog.c -lblas -llapack

For more complex libraries:

module load petsc/3.20
mpicc mycode.c \
  $(pkg-config --cflags --libs petsc) \
  -o mycode_petsc

Always consult:

Using precompiled applications

For end-user applications (CFD codes, chemistry packages, etc.), clusters generally provide:

Typical usage workflow:

  1. Load the application module:
    • module load lammps/2023.08-mpi
  2. Check what executable you should use:
    • which lmp_mpi
  3. In your job script, run it through srun, mpirun, or the site’s recommended launcher:
    • srun lmp_mpi -in in.lammps

Be careful to:

MPI, compilers, and compatibility

Precompiled parallel libraries and applications are tightly coupled to:

Implications for you:

Module hierarchies are designed to prevent most incompatible combinations, but you should still:

Application-specific environment helpers

Some precompiled packages install helper commands or scripts, such as:

When using these:

  module load gromacs/2023-mpi
  which gmx_mpi
  srun gmx_mpi mdrun -s topol.tpr

Using precompiled Python and R stacks

Clusters often provide:

Typical usage:

module load python/3.11
python -c "import numpy, mpi4py"

or:

module load r/4.3
Rscript myscript.R

Good practices:

Handling multiple versions and conflicts

Because many versions exist, you must manage choices:

Example:

module purge
module load gcc/12.2.0
module load openmpi/4.1.5
module load hdf5/1.12.2-mpi

If you later decide to use an Intel-based stack:

module purge
module load intel/2024.0
module load intel-mpi/2021
module load hdf5/1.12.2-mpi

Precompiled software in batch jobs

Everything you set up interactively must also be set up inside batch jobs. Common pattern in a job script:

#!/bin/bash
#SBATCH --job-name=myjob
#SBATCH --ntasks=32
#SBATCH --time=02:00:00
#SBATCH --partition=standard
module purge
module load gcc/12.2.0
module load openmpi/4.1.5
module load lammps/2023.08-mpi
srun lmp_mpi -in in.lammps

Points to remember:

When precompiled software is missing or insufficient

Sometimes the cluster does not provide exactly what you need:

Common approaches:

Even if you build your own code, it’s usually best to:

Good practices when using precompiled software

Using precompiled software effectively is largely about managing environments carefully and consistently; once you master modules and the site’s conventions, most HPC numerical libraries and applications become straightforward to use.

Views: 16

Comments

Please login to add a comment.

Don't have an account? Register now!