16/34
Part 3 of 5 · PlacementLearn and do

Start every worker of a gang, or none

24 free GPUs on 3 nodes, and jobs A and B need 16 GPUs each, 1 GPU per pod:

NodeOne pod at a timeAll or nothing
1A A A A A A A AA A A A A A A A
2A A A A B B B BA A A A A A A A
3B B B B B B B Bfree
resultA holds 12 and B holds 12: neither can startA has all 16 and runs. B waits and holds nothing

Netflix's GPU post describes a training job as a gang. Its workers move in lockstep and exchange data every step. So the job moves only as fast as its slowest worker, and it stops entirely if one dies. Start half the workers, and they sit idle holding GPUs while they wait for the rest.

Two jobs make it worse. A scheduler that places pods one at a time can give each job 12 GPUs. Neither can start, neither will let go, and 24 GPUs are held doing nothing. Kueue's docs describe the same trap: two such jobs can deadlock, each holding part of what the other needs.

The fix is all-or-nothing admission: a job is admitted only when all of its pods can be placed. Volcano, a batch scheduler for Kubernetes, lists gang scheduling first among its policies: all tasks of a job start at the same time. Kueue reserves quota for every pod of a job at once.

Kueue also has a timeout as a fallback, and its docs are honest about it. It's a heuristic that doesn't prevent partial scheduling, but it does stop a partly scheduled job from holding resources forever.

Quota alone isn't enough either. Kueue's docs give the case of 8 free GPUs split across two nodes with 4 each. A single 8-GPU pod passes the quota check, is admitted, and then gets stuck forever at kube-scheduler. Admission has to check placement, not just totals.

In the editor, write place_gang(free, pods): all-or-nothing admission for one job. free lists each node's free GPUs and pods each pod's GPUs, so the table's case is [8, 8, 8] and sixteen 1-GPU pods.