Using Apptainer on AI.Panther

Body

Apptainer (formerly Singularity) lets you run software inside containers on the cluster. Always run containers on compute nodes, never on the login node.

Loading the Module

GPU nodes use AMD processors, so you need to load from the Zen 2 module stack:

module use /usr/local/spack/share/spack/modules/linux-ubuntu22.04-zen2
module load apptainer

For CPU-only work on Intel nodes, the default module path (/usr/local/spack/share/spack/modules/linux-ubuntu22.04-cascadelake) is already set, so a simple load works:

module load apptainer

Running Interactively

Request an interactive job first, then run your container:

# GPU example
srun --partition=gpu1 --gres=gpu:1 --cpus-per-task=3 --time=1:00:00 --pty bash
apptainer exec --nv my_container.sif python my_script.py

The --nv flag passes NVIDIA GPU drivers into the container.

Running via Slurm Batch Script

#!/bin/bash
#SBATCH --partition=gpu1
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=3
#SBATCH --time=4:00:00
#SBATCH --output=job_%j.out

module use /usr/local/spack/share/spack/modules/linux-ubuntu22.04-zen2
module load apptainer

apptainer exec --nv my_container.sif python my_script.py

Common Options

  • --nv — enable NVIDIA GPU support inside the container
  • --cleanenv — start with a clean environment (recommended to avoid host environment conflicts)
  • --bind /shared:/shared — bind-mount cluster storage into the container

Notes

  • Your home directory (/home1) and /shared are automatically accessible inside the container.
  • See the Troubleshooting: Illegal Instruction Error article if you get Illegal instruction (core dumped) on GPU nodes.

Details

Details

Article ID: 21524
Created
Thu 3/26/26 2:51 PM
Modified
Thu 3/26/26 2:51 PM