Unit 11 of 14 · about 5 hours · explain

Gang scheduling, quotas, preemption, capacity and Kubernetes versus Slurm

A fast plan that never gets compact accelerators together finishes later than a slower plan that does. Scheduling decides which evidence the fleet can even produce.

You'll be able to

  • Explain gang scheduling and topology-aware placement for synchronous training jobs.
  • Use quotas, fairness, backfill and preemption vocabulary to predict queue and share behavior.
  • Compare Kubernetes and Slurm policy controls for one training job.
  • Explain capacity, queue time and accelerator fragmentation.

Covers

Gang scheduling and topology-aware placementQuotas, fairness, backfill and preemption vocabularyCapacity, queue time and accelerator fragmentationKubernetes and Slurm policy comparison
1

Read

In this order, only the parts listed

0 of 4 done

  1. The scheduling problem and paradigmsMachine Learning Systems Volume II - Fleet Orchestration and Performance Engineering

    The Scheduling Problem with gang scheduling and fragmentation, and Orchestration Paradigms with Slurm batch versus Kubernetes reconciliation plus Volcano and Kueue

  2. Placement, elasticity and tenancyMachine Learning Systems Volume II - Fleet Orchestration and Performance Engineering

    Topology-Aware Scheduling with compact placement, Elastic Scheduling with grow-shrink contracts, and Multi-Tenancy and Quotas with fair-share, borrowing and preemption

  3. Slurm user controlsMachine Learning Engineering Open Book - Network, Debug, Training Performance and Orchestration

    Partitions with sinfo and scontrol, wait time with squeue, allocation and faulty-node exclusion, plus FairShare with sshare

  4. Kubernetes versus Slurm for GPUsAI Systems Performance Engineering - Chapters 1 to 5, 13 and 14

    Chapter 3, Job Scheduling with Kubernetes and SLURM, with Kubernetes Topology Manager and Slicing a GPU with MIG

2

Focus on

  • Synchronous collectives barrier across ranks, so a training job needs all its accelerators together or none. Fragmentation is idle GPUs that no queued shape fits; topology-aware placement keeps collectives on fast tiers.
  • Quotas cap shares, fair-share favors historically under-served teams, backfill slides small jobs into idle holes, and preemption reclaims with a checkpoint-and-restart cost.
  • Slurm speaks partitions, jobs and FairShare. Kubernetes speaks queues, priorities and reconcilers with gang and topology plugins. Both need the same two guarantees: all-or-nothing start and compact placement.
Common mistakes · 3
  • Demanding gang scheduling for everything. Asynchronous shards and elastic jobs can grow or shrink; only synchronous barriers need all-or-nothing.
  • Reading fair-share as an equal split now. It weights history, so a recently heavy team waits behind a light one at equal quotas.
  • Scheduling without topology. Scattered ranks across slow tiers run measurably slower at identical GPU count.
3

Try it yourself

Closed-book, before checking anything

Without notes, state the gang condition for a synchronous job with ranks, give one fragmentation example where free GPUs cannot fit the next queued shape, and name the Slurm and Kubernetes control that expresses each of quota, priority and topology.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why does synchronous data-parallel training need gang scheduling?Answer

    Every step barriers across ranks in collectives. A partially started job holds accelerators while waiting for the rest, wasting the held share.

  2. 2.Eight GPUs are free as four plus four on two nodes but the queue wants eight compact. What is this?Answer

    Fragmentation with a topology constraint. The GPUs are idle yet unusable for the queued shape without crossing the slower tier.

  3. 3.How do backfill and preemption differ in cost?Answer

    Backfill uses idle holes without disturbing running jobs. Preemption reclaims running capacity and pays checkpoint, lost-work and restart costs.

  4. 4.Which controls set quota and topology in Slurm versus Kubernetes?Answer

    Slurm uses partitions, QoS and FairShare with node constraints and exclusions. Kubernetes has ResourceQuota and PriorityClass built in; queues, gang admission and cross-node topology placement come from add-ons such as Kueue or Volcano, while the kubelet Topology Manager only aligns CPUs and devices inside one node.

You're done when

You can predict queue, share and placement outcomes for one job under stated quotas and topology, and name the control that enforces each.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 8 more in the section
  • Machine Learning Systems Volume II - Fleet Orchestration and Performance EngineeringML Systems Textbook · primary

    Read Scheduling Problem, Orchestration Paradigms, Topology-Aware Scheduling, Elastic Scheduling, Cost Optimization, Multi-Tenancy and Quotas and Debugging Cluster Utilization, then Memory Wall and Roofline Diagnosis, Graph Compilation, Communication-Computation Overlap, System Profiling and Measurement at Scale at https://mlsysbook.ai/vol2/performance_engineering/performance_engineering.html. Use the framework to choose one bottleneck-specific lab and one rollback metric.

  • AI Systems Performance Engineering - Chapters 1 to 5, 13 and 14Chris Fregly (O'Reilly) · required

    Use Chapter 1 for goodput and reproducibility, Chapters 2 to 5 for topology, orchestration, communication, storage and the data pipeline, Chapter 13 for PyTorch profiling and scaling, and the Chapter 14 sections on graph breaks and recompilation. Run only the companion labs for the bottleneck you observe, preserve workload correctness and record hardware assumptions.

  • Machine Learning Engineering Open Book - Network, Debug, Training Performance and OrchestrationStas Bekman · required

    Use network/debug/README.md, the hang, crash and OOM sections of debug/pytorch.md, training/performance/README.md, storage/README.md and orchestration/slurm/users.md as an incident-driven reference. Build one symptom-to-evidence-to-cause runbook rather than reading every page.

Also in this section

  • PyTorch Flight Recorder TutorialsPyTorch · support

    Read the environment-variable Flight Recorder tutorial (trace buffer, dump on timeout, fr_trace analysis), then the newer tutorial at https://docs.pytorch.org/tutorials/intermediate/debug_hangs_with_flight_recorder.html, which needs torchcomms and can run on CPU with Gloo. Diagnose one injected hang from per-rank dumps.

  • MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUsJiang et al. (NSDI 2024) · support

    Read the efficiency optimizations, the fault-tolerance loop (heartbeats, diagnostics, fast restart) and the straggler and diagnosis tooling. Its MFU and scale numbers are its own cluster's results.

  • Revisiting Reliability in Large-Scale Machine Learning Research ClustersKokolis et al. (2024) · support

    Read the failure taxonomy, mean time to failure versus job size and the scheduler-side metrics. Use them to model goodput with failures for one job size.

  • How to Scale Your Model - Chapters 1, 5, 9 and 12Google DeepMind · required

    Use rooflines, training cost models, profiling workflow and GPU topology to predict the dominant limit of one run. Compare the prediction with a trace and quantify the residual before proposing a change.

  • CS336 Assignment 2 (Spring 2026) - Profiling and Parallelism AnalysisStanford University · required

    Revisit Section 2 profiling and Section 8 communication analysis. Produce warmup-controlled timing, Nsight or PyTorch traces, memory evidence and analytic DP, FSDP, TP and 2D comparisons on configurations you can execute honestly.

  • Ultra-Scale Playbook - Benchmarking ConfigurationsHugging Face · support

    Study the configuration-search experiments and Lessons learned on benchmarking as method. Its heatmaps are its own H100 cluster's results; reproduce the method on a tiny legal search space, separating analytic predictions, simulations and measurements.

  • TorchTitanPyTorch · depth

    Read docs/debugging.md (memory snapshots, fake-backend modes, Flight Recorder dumps) and the CPU unit tests under tests/unit_tests/cpu/, then the configuration, metrics, profiling, checkpoint and parallelization seams at a pinned commit. Select one bounded issue or measurable improvement and follow the contribution standards; do not attempt a wholesale rewrite.

  • Distributed Training Systems LaboratoryRoadmap-Final · support

    Complete the capstone with a fixed workload, correctness oracle, analytic plan, fault campaign, aligned traces and one real-code extension. Label CPU simulation, single-GPU evidence and multi-GPU evidence separately.