Run these commands from the Alpha login node. Replace 12345 with your actual job ID.
Workshop-tested resources
Partition: alpha
Account: xx_micalves_workshop
QoS: priority
Reservation: nvidia_workshop
Node: alphagpu[11,16]
MIG GPU: gpu:1g.10gb:1These values are workshop-specific. For other work, use the allocation details from the cluster administrators.
The three Slurm commands
| Command | When to use it | Result |
|---|---|---|
| sbatch script.sbatch | Reproducible, non-interactive work | Returns a job ID; output goes to log files. |
| salloc options | Development or debugging | Reserves resources, then you enter them with srun. |
| srun options command | A one-off test or command | Runs the command under Slurm; it can request resources itself. |
Access the cluster
To access alpha you are expected to have set up your account, once set up you can ssh to alpha:
ssh <YOUR_USER_NAME>@alpha1.empireai.eduCopy the workshop to your home directory
Run this once on the Alpha login node. Each participant should work from their own copy rather than the shared workshop folder.
cd "$HOME" cp -r /projects/workshops/micalves_workshop/empire-ai-pytorch-workshop . cd "$HOME/empire-ai-pytorch-workshop"mkdir -p logs runs
logs/ must exist before running sbatch: Slurm creates the standard-output and error files before the job script begins.
Quick preflight
sacctmgr show assoc where user="$USER" format=User,Account%30,Partition,QOS%60
squeue -u "$USER"
# Confirm a workshop MIG GPU can be allocated.
srun -p alpha -A xx_micalves_workshop \
--reservation=nvidia_workshop --nodelist=alphagpu[11,16] --nodes=1 \
--gres=gpu:1g.10gb:1 nvidia-smi -LFind files and text on Alpha
Use the standard tools installed on the cluster:
# Find filenames below the current directory.
find . -type f -name '*.sbatch'
# Search text recursively. -n prints line numbers; -I skips binary files.
grep -RInI 'apptainer' .
# Search one log file while it is being written.
grep -n 'device=cuda' logs/shapes-pytorch-*.outBatch job with sbatch
Create a file named my_job.sbatch:
#!/bin/bash
#SBATCH --job-name=my-job
#SBATCH --output=logs/%x-%j.out
#SBATCH --error=logs/%x-%j.err
#SBATCH --partition=alpha
#SBATCH --account=xx_micalves_workshop
#SBATCH --qos=priority
#SBATCH --reservation=nvidia_workshop
#SBATCH --nodelist=alphagpu[11,16]
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --gres=gpu:1g.10gb:1
#SBATCH --mem=16G
#SBATCH --time=00:15:00
set -euo pipefail
hostname
nvidia-smi
python3 my_program.pymkdir -p logs # Required before sbatch; Slurm opens logs first.
sbatch my_job.sbatch
squeue -u "$USER"
squeue -j 12345
scontrol show job 12345
tail -f logs/my-job-12345.out
tail -f logs/my-job-12345.err
sacct -j 12345 --format=JobID,JobName,State,Elapsed,ExitCode,AllocTRES
scancel 12345PD means pending, R means running, CD means completed, and F means failed. For a pending reason, use scontrol show job 12345.
Interactive allocation with salloc
salloc --job-name=interactive \
--partition=alpha --account=xx_micalves_workshop --qos=priority \
--reservation=nvidia_workshop --nodelist=alphagpu[11,16] \
--nodes=1 --ntasks=1 --cpus-per-task=4 \
--gres=gpu:1g.10gb:1 --mem=16G --time=00:15:00
# After allocation is granted, enter the compute node.
srun --pty bash -l
nvidia-smi
python3 my_program.py
# Exit the compute node, then release the allocation.
exit
scancel "$SLURM_JOB_ID"Do not run GPU work on the login node. salloc only reserves resources; srun is what enters the allocated compute node.
One-command interactive srun
# Open a shell directly on the requested GPU.
srun -p alpha -A xx_micalves_workshop \
--reservation=nvidia_workshop --nodelist=alphagpu[11,16] --nodes=1 \
--gres=gpu:1g.10gb:1 --pty bash -l
# Or run a single test command directly.
srun -p alpha -A xx_micalves_workshop \
--reservation=nvidia_workshop --nodelist=alphagpu[11,16] --nodes=1 \
--gres=gpu:1g.10gb:1 nvidia-smi -LGPU requests: MIG versus full GPU
| Need | Typical request | Use it when |
|---|---|---|
| One H100 1g.10gb MIG slice | --gres=gpu:1g.10gb:1 | Workshop-tested; one 10 GB CUDA device. |
| One generic full GPU | --gres=gpu:1 | Full GPUs are allocatable and approved by the admins. |
| Four generic full GPUs | --gres=gpu:4 | The partition and account permit it; often use one task per GPU. |
| Named GPU resource | --gres=gpu:TYPE:COUNT | The cluster admins document the exact TYPE string. |
MIG is an isolated partition of a physical GPU. It looks like one CUDA device, but has less memory and compute than a full H100. Reduce batch size if necessary. Do not combine a full-GPU request with a MIG request unless the administrators explicitly document that configuration.
nvidia-smi -L
echo "$CUDA_VISIBLE_DEVICES"
python3 -c "import torch; print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0))"Run a container with Apptainer
The workshop image:
/projects/workshops/micalves_workshop/empire-ai-pytorch-workshop
/containers/pytorch-2.4.1-cuda12.4-runtime.sifThe --nv flag exposes the allocated NVIDIA GPU and compatible host driver libraries inside the container. The temporary directory is needed on this cluster when optional FUSE mounting helpers are unavailable.
srun -p alpha -A xx_micalves_workshop \
--reservation=nvidia_workshop --nodelist=alphagpu11 \
--gres=gpu:1g.10gb:1 --pty bash -lc '
module load apptainer/1.1.9
export APPTAINER_TMPDIR="/tmp/$USER/apptainer-$SLURM_JOB_ID"
mkdir -p "$APPTAINER_TMPDIR"
apptainer exec --nv \
$HOME/empire-ai-pytorch-workshop/containers/pytorch-2.4.1-cuda12.4-runtime.sif \
python3 -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0))"
'In a batch script:
module load apptainer/1.1.9
export APPTAINER_TMPDIR="/tmp/$USER/apptainer-$SLURM_JOB_ID"
mkdir -p "$APPTAINER_TMPDIR"
apptainer exec --nv --bind "$PWD:/workspace" \
$HOME/empire-ai-pytorch-workshop/containers/pytorch-2.4.1-cuda12.4-runtime.sif \
bash -lc 'cd /workspace && python3 src/train_shapes.py'The bind mount makes the host directory visible as /workspace, so checkpoints and logs remain after the container exits.
Run without a container
# Use only when the node provides the needed software/environment.
module load YOUR_PYTHON_OR_CUDA_MODULE
python3 my_program.pyIf PyTorch imports on the login node but not inside a job, you are using different Python environments. Use the Apptainer image, or set up an environment that is accessible from the compute node.
CPU-only job
Remove the GPU request:
#!/bin/bash #SBATCH --job-name=cpu-test #SBATCH --output=logs/%x-%j.out #SBATCH --error=logs/%x-%j.err #SBATCH --partition=alpha #SBATCH --account=xx_micalves_workshop #SBATCH --qos=priority #SBATCH --reservation=nvidia_workshop #SBATCH --nodelist=alphagpu[11,16]#SBATCH --nodes=1#SBATCH --cpus-per-task=4 #SBATCH --mem=8G #SBATCH --time=00:05:00 python3 cpu_program.py
Use a GPU reservation for CPU-only work only when the workshop administrator intends it.
Useful options
| Option | Meaning |
|---|---|
| --job-name=NAME | Queue and log label. |
| --output=PATH and --error=PATH | Standard-output and standard-error destinations. |
| --partition=alpha | Selects the partition. |
| --account=ACCOUNT | Charges the account. |
| --qos=QOS | Scheduling policy. |
| --reservation=NAME | Uses a reservation. |
| --nodelist=HOST | Pins a job to a permitted node. |
| --nodes=N | Node count. |
| --ntasks=N | Process/task count. |
| --ntasks-per-node=N | Processes on each node; useful for multi-GPU or multi-node work. |
| --cpus-per-task=N | CPU cores per process. |
| --gres=gpu:... | GPU or MIG request. |
| --mem=SIZE | System memory request. |
| --time=HH:MM:SS | Wall-time limit. |
| --exclusive | Whole node; use only with explicit permission. |
| --array=0-9 | Indexed copies of one script; use SLURM_ARRAY_TASK_ID inside it. |
| --dependency=afterok:12345 | Start only after job 12345 succeeds. |
Command-line options override matching SBATCH directives:
sbatch --time=00:30:00 --job-name=longer-test my_job.sbatchUseful environment variables
echo "$SLURM_JOB_ID"
echo "$SLURM_JOB_NODELIST"
echo "$SLURM_CPUS_PER_TASK"
echo "$CUDA_VISIBLE_DEVICES"
scontrol show hostnames "$SLURM_JOB_NODELIST"Common messages
| Message or result | Action |
|---|---|
| Requested node configuration is not available | Reuse the validated account, partition, reservation, node, and MIG settings; contact the admin if reservation capacity is unavailable. |
| Job remains PD | Run scontrol show job JOBID and check Reason. |
| ModuleNotFoundError: No module named torch | Host Python is being used; run through Apptainer or fix the environment inside the job. |
| torch.cuda.is_available() is False | Request a GPU and include apptainer exec --nv. |
| could not create temporary sandbox under /tmp | Set and create APPTAINER_TMPDIR on the compute node before apptainer exec. |
| squashfuse, fuse2fs, or underlay bind-mount INFO lines | Harmless if the command continues and CUDA validation succeeds. |
| Couldn't determine user account information | Node identity lookup problem; report it to the cluster admins. |
Workshop fast path
cd "$HOME"
cp -a /projects/workshops/micalves_workshop/empire-ai-pytorch-workshop .
cd "$HOME/empire-ai-pytorch-workshop"
mkdir -p logs runs
sbatch slurm/job_gpu.sbatch
squeue -u "$USER"See README.md for the complete PyTorch training walkthrough. Cluster documentation: https://empireai.freshdesk.com/support/solutions
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article