Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Booking time on a shared machine
A supercomputer is shared by hundreds of people, like a laboratory with expensive instruments. You can’t just walk in and start: you fill in a booking form (“I need 4 machines with 8 GPUs for 6 hours”) and a scheduler fits everyone’s bookings into the calendar as tightly as it can. Small, short bookings can slip into gaps between big ones, as long as they don’t delay anyone. Asking for far more time than you need makes that harder for everyone.
Climate and CFD simulations, trajectory Monte Carlo campaigns and large model training run on schedulers at national labs, universities and space agencies. Writing correct batch scripts, sizing requests, using job arrays and reading accounting data decide how much science you get from an allocation.
- 1. On a cluster, a scheduler…
- 2. Why ask for a realistic run time?
- 3. In the demo, under FCFS, what happens while the 8-node job waits?
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.A batch script
#!/bin/bash
#SBATCH --job-name=orbit-sweep
#SBATCH --nodes=2 # machines
#SBATCH --ntasks-per-node=4 # MPI ranks per node
#SBATCH --cpus-per-task=8 # threads per rank (OMP_NUM_THREADS)
#SBATCH --gres=gpu:a100:4 # GPUs per node
#SBATCH --mem=256G # memory per node
#SBATCH --time=1-12:00:00 # walltime limit (D-HH:MM:SS); the job is killed when it runs out
#SBATCH --partition=gpu
#SBATCH --output=logs/%x_%j.out # %x job name, %j job id
module load cuda/12.4
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
srun python simulate.pysbatch job.sh # submit; prints the job id
squeue -u $USER # your queued and running jobs
scancel 123456 # cancel
sacct -j 123456 --format=JobID,Elapsed,MaxRSS,State,ExitCode # accounting after the fact
salloc -N1 --gres=gpu:1 -t 1:00:00 # interactive allocation#SBATCH lines are read only up to the first command. PBS Pro and Torque use #PBS with qsub, qstat, qdel; resources are written as -l select=2:ncpus=32:mpiprocs=4:ngpus=4,walltime=36:00:00.
- 1. Which command submits a batch script in Slurm?
- 2. What happens when a job exceeds its --time?
- 3. #SBATCH lines after the first command are…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.The resource model
- Node: a machine. Task: a process (usually an MPI rank) started by
srun. CPUs per task: cores for its threads. GRES: generic resources such as GPUs. - Total cores = tasks × cpus-per-task; for a hybrid MPI + OpenMP code, ranks × threads should match the cores you request, and
srunbinds them. - Memory:
--memper node or--mem-per-cpu; exceeding it gets the job killed by the cgroup (exit 137, C4.3). - Job arrays:
--array=0-99%10runs 100 independent tasks, at most 10 at a time;$SLURM_ARRAY_TASK_IDselects the parameter set. Ideal for parameter sweeps and Monte Carlo batches. - Dependencies:
sbatch --dependency=afterok:123456 post.shchains pre-processing, simulation and analysis. - Accounting: allocations are charged in core-hours or GPU-hours (requested resources × elapsed time), whether or not you use them.
- 1. 2 nodes × 4 tasks per node × 8 CPUs per task = how many cores?
- 2. --array=0-99%10 means…
- 3. Slurm time '1-12' is…
Level 3: Advanced
★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.How the scheduler decides
Priority combines age (time waiting), fair share (groups that used less recently get more), job size, partition and QoS. Strict priority order alone (FCFS) wastes resources: when the highest-priority job needs many nodes, nodes sit idle until enough are free. Backfilling fixes this: EASY backfilling gives the first queued job a reservation (the earliest time enough nodes will be free, from running jobs’ requested end times) and lets later jobs start now if they fit and either finish before that reservation or use only nodes the reservation doesn’t need. Conservative backfilling gives every queued job a reservation.
Consequences for users: request realistic walltimes (padded requests block backfilling), split long work into checkpointed shorter jobs, use arrays instead of hundreds of separate submissions, and don’t request whole nodes for single-core jobs.
- 1. EASY backfilling computes the head job's reservation from…
- 2. A 1-hour job that requests 48 hours…
- 3. Fair share raises priority for groups that…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Scheduling, measured
Exercise 1. The sample script parses to 2 nodes × 4 ranks × 8 threads with 4 A100s per node and 256 GB per node for 1-12:00:00 = 36 h; an #SBATCH --time after module load is correctly ignored. Each array task costs 2304 core-hours and 288 GPU-hours. --array=0-15:4,20%2 expands to tasks 0, 4, 8, 12, 20 with at most 2 running, logs/%x_%A_%a.out becomes logs/orbit-sweep_770_12.out, and the PBS translation is select=2:ncpus=32:mpiprocs=4:ngpus=4:mem=256gb with walltime 36:00:00.
Exercise 2: FCFS versus EASY backfilling. An event-driven simulation of a 64-node cluster, 400 jobs per workload (power-of-two sizes from 1 to 64 nodes, lognormal runtimes around 1 hour, Poisson arrivals at an offered load of 0.9), averaged over 5 workloads:
| Policy | utilization | mean wait | mean bounded slowdown |
|---|---|---|---|
| FCFS | 52% | 52 h | 82 |
| EASY backfilling, exact requests | 80% | 5.2 h | 7.6 |
| EASY backfilling, requests 3× runtime | 78% | 5.4 h | 8.2 |
Under FCFS, wide jobs at the head of the queue leave nodes idle, the queue grows faster than it drains and waits explode. Backfilling raises utilization from 52% to 80% and cuts waits 10×. Padding every request threefold makes reservations pessimistic and backfilling more conservative, costing a little utilization and wait; the scheduler literature finds this effect varies by workload (sometimes padding even helps), but realistic requests are never worse for the job itself.
Schedulers in AI, robotics and aerospace
- Parameter sweeps and Monte Carlo (launch dispersions, sensitivity studies) as job arrays.
- Large-model training as multi-node GPU jobs with checkpointing to survive walltime limits and node failures (C6).
- Pipelines of pre-processing, simulation and post-processing chained with dependencies (or workflow tools such as Snakemake and Nextflow on top of Slurm).
- Cloud HPC: the same Slurm scripts run on cloud clusters (AWS ParallelCluster, Google Cloud HPC Toolkit) with autoscaling node pools.
References
- A. B. Yoo, M. A. Jette, M. Grondona (2003). “SLURM: Simple Linux Utility for Resource Management.” JSSPP Workshop, LNCS 2862.
- D. A. Lifka (1995). “The ANL/IBM SP scheduling system.” JSSPP Workshop, LNCS 949 (origin of EASY backfilling).
- A. W. Mu’alem, D. G. Feitelson (2001). “Utilization, predictability, workloads, and user runtime estimates in scheduling the IBM SP2 with backfilling.” IEEE TPDS, 12(6).
- D. G. Feitelson (2015). Workload Modeling for Computer Systems Performance Evaluation. Cambridge University Press.
- SchedMD. Slurm documentation (slurm.schedmd.com): sbatch, srun, job arrays, sacct; Altair PBS Professional User’s Guide.