Spack¶
Spack is a package management tool designed to support multiple versions and configurations of software. You can use centrally installed software and /or install your software of choice on maxwell cluster via Spack.
You can access spack command on Maxwell cluster using:
source /software/spack/activate_spack.sh
The first time you run a spack command on Maxwell (e.g. spack list), it might take several minutes depending on the load on the login node. You can either wait until it finishes or run it inside a tmux session using:
tmux new -s session_name # starts a new tmux session with a name "session_name"
spack list # Lists packages available to install
You can close your terminal or detach from the session using Ctrl+b d, do other work, and come back later to check if it has completed with tmux a -t session_name
Some usefull spack commands:
spack compilers # List installed compilers
spack list torch # List packages whose name contains "torch"
spack info <pkg> # Show detailed information about a package
spack find # List installed packages
spack load <pkg> # Load a package to use
spack install <pkg> # Install your software of choice
spack clean --all # Clean all temporary files
spack help # More informations about Spack’s options
Spack with slurm¶
Example mpi code with slurm job script mpi_example.sh
#!/bin/bash -l # Bash as a login shell
#SBATCH --job-name=mpi_test # Name your job, optional
#SBATCH --output mpi_test_%J.out # Name your output, optional
#SBATCH --error mpi_test_%J.err # Name your error, optional
#SBATCH --nodes=2 # Request two nodes,
#SBATCH --ntasks=8 # 8 processors,
#SBATCH --time=00:10:00 # for 10 minutes
#SBATCH --partition=hpcgwgpu # Choose partition: hpcgwgpu, allcpu, allgpu, maxcpu, maxgpu,...
source /software/spack/activate_spack.sh # Make "spack" command available
spack load intel-oneapi-mpi@2021.16.0 # Load your application software, here MPI from Intel
mpif90 /software/spack/examples/mpi_sendreceive.f90 # compile your mpi code
mpirun ./a.out # Run your executable
Submit it to slurm via
sbatch mpi_example.sh
See the error (if any) with
cat mpi_test_*.err
See the ressult with
cat mpi_test_*.out
For further informations and example usages of spack on Maxwell, see Tutorial section on Maxwell documentation.