Contents
Slurm Quick Start
Most users only need four steps to get started:
- Choose a partition
- Write a batch script
- Submit it with
sbatch - Monitor it with
squeueorsacct
Minimal Batch Script
Create a file named hello_slurm.sh:
#!/bin/bash -l
#SBATCH --partition=scu-cpu
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --job-name=hello_slurm
#SBATCH --time=00:02:00
#SBATCH --mem=1G
#SBATCH --output=hello_slurm-%j.out
#SBATCH --error=hello_slurm-%j.err
source ~/.bashrc
echo "Starting at: $(date)"
echo "Job ID: $SLURM_JOB_ID"
echo "Node: $(hostname)"
echo "Cluster: $SLURM_CLUSTER_NAME"
echo "TMPDIR: $TMPDIR"
sleep 30Submit the Job
sbatch hello_slurm.shSlurm will return a job ID. By default, Slurm writes output to a file such as slurm-<jobid>.out unless you override it with --output.
Check Job Status
squeue -u <cwid>Check Completed Jobs
sacct -u <cwid> -S $(date -d "-7 days" +%D)Quick Interactive Session
srun -n1 --pty --partition=scu-cpu --mem=8G bash -iQuick GPU Interactive Session
srun -n1 --pty --partition=scu-gpu --mem=16G --gres=gpu:1 bash -iGPU requests are often site-configured as GRES, so --gres=gpu:1 is a common pattern.