Running Containerized Jobs with Apptainer
Running Your First Containerized Job
#!/bin/bash #SBATCH --job-name=torch_matmul-apptainer #SBATCH --output=jid-%j.name-%x.log #SBATCH --gpus-per-node=8 #SBATCH -N1 # Script created in step 1. MATMUL_PY="$PWD/torch_matmul.py" # pytorch-rocm image from Docker Hub, published by AMD CONTAINER_IMAGE='rocm/pytorch:rocm7.1.1_ubuntu22.04_py3.10_pytorch_release_2.9.1' CONTAINER_SAVE="./rocm+pytorch+rocm7.1.1_ubuntu22.04_py3.10_pytorch_release_2.9.1.sif" # pull the image from Docker Hub and save to disk apptainer pull "$CONTAINER_SAVE" "docker://$CONTAINER_IMAGE" # Mount torch_matmul.py into the container and run the benchmark srun apptainer exec "$CONTAINER_SAVE" \ /opt/venv/bin/python "$MATMUL_PY"$ sbatch torch-matmul-apptainer.sbatch Submitted batch job 4241 $ tail -f jid-4241.name-torch_matmul-apptainer.log INFO: Converting OCI blobs to SIF format INFO: Starting build... INFO: Fetching OCI image... INFO: Extracting OCI image... 2026/05/05 21:06:48 warn rootless{usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-ptp-helper} ignoring (usually) harmless EPERM on setxattr "security.capability" INFO: Inserting Apptainer configuration... INFO: Creating SIF file... Device: AMD Instinct MI325X n= 1024 145.11 TFLOPs n= 2048 448.87 TFLOPs n= 4096 630.48 TFLOPs n= 8192 753.88 TFLOPs
Useful apptainer commands
Command
Description
Last updated

