Spreading leaves no empty node for a big job
Eight nodes with 8 GPUs each, twelve small jobs needing 23 GPUs in all, then an 8-GPU job. Place the small jobs by spreading, then by packing, and watch whether the big job fits.
Filled slots carry the job number. Spread puts each job on the node with the most free GPUs.
- Free GPUs
- 41 of 64
- Most free on one node
- 6
- Empty nodes
- 0
Both leave 41 of 64 GPUs free. Spreading leaves every node partly used, with at most 6 free GPUs on any one, so the 8-GPU job can't start. Packing fills three nodes and leaves five empty.
That's fragmentation: plenty of free GPUs in total, scattered in pieces too small for the job.
Does that hold when jobs come and go? A quick simulation measured it, under these assumptions:
- 32 nodes of 8 GPUs
- jobs of 1, 2 or 4 GPUs, as half, 30% and 20% of arrivals
- jobs arrive at random and run for an exponentially distributed time that averages 2 hours
- the queue is first come, first served
Over about 19,500 simulated hours, averaged across three runs, it measured the share of time at least one node was entirely free, so an 8-GPU job could start at once:
| Cluster load | Spread | Pack |
|---|---|---|
| 60% | 5.2% of the time | 100% |
| 75% | 0.8% | 95.5% |
| 90% | 0.0% | 37.1% |
At 75% load, spreading almost never frees a whole node, and packing nearly always has one.
Real clusters show the same thing. The Philly study splits waiting into two causes: fair share and fragmentation. Across all jobs, fragmentation caused around 80% of the delay in waiting time. For jobs of 5 to 8 GPUs, it caused 74.2% of the times a job was delayed. Preemption easily reduces delays from fair share, but delays from fragmentation were much harder to overcome in the study's design.
Packing at admission isn't the whole answer, because jobs end in random places and leave holes. Netflix's Titus runs a background fix. In clusters shared by many tenants, it repacks by default, moving workloads now and then to defragment.
For GPU training, moving a job means checkpoint, stop, and restart elsewhere. So defragmenting is a kind of preemption, and it should obey the same rules.
In the editor, write place_all(jobs, nodes, per_node, choose) and big_job_fits(free, gpus). SMALL holds the widget's twelve jobs, and pack and spread are working pickers that you pass in as choose.