Accelerators and scheduling
Place accelerator workloads using multidimensional resource requests, topology, fairness, and interruption costs.
On this page
The question for today
What you’ll understand
- Recognize memory, bandwidth, and placement as scheduling constraints.
- Explain why aggregate free devices do not guarantee a schedulable job.
- Calculate allocation efficiency while preserving fairness and recovery needs.
A cluster can show idle accelerators while a training job waits. Perhaps the job needs four linked devices on one node and every node has only two free. Perhaps device memory, CPU preprocessing, or a tenant quota is the real constraint. Scheduling translates workload requirements into an allocation over time. To judge it, measure useful completed work and waiting time alongside utilization.
Describe a workload as a resource vector
An accelerator request includes device type and count, memory needs, CPU, host memory, storage throughput, and communication expectations. Some are consumable quantities; others are compatibility constraints. A binary built for one device capability may not run on another. Kubernetes exposes accelerators through device plugins or applicable allocation mechanisms. For device-plugin GPU resources, requests and limits must match when both are set; an omitted request defaults to the limit. The scheduler does not infer a model's memory peak.
Requests guide placement and reservations; utilization is what the program actually consumes over time. Under-requesting CPU can starve data loading even when the accelerator is reserved. Over-requesting whole devices creates waste when safe partitioning would suffice, but sharing introduces memory, bandwidth, and isolation concerns. Do not assume a reported percentage of device activity is equivalent to useful arithmetic efficiency. Collect application throughput and stall information to distinguish a well-used device from a busy wait or repeated failed work.
Place communicating workers together deliberately
Data-parallel jobs synchronize gradients, while tensor-parallel layers may communicate several times during one forward pass. A placement that is acceptable for one can be poor for the other. Model fast interconnect groups and cross-rack links explicitly. Scheduling all necessary workers together avoids reserving three devices indefinitely while waiting for a fourth. Gang scheduling is a policy and implementation choice; simply creating several independent pods does not prove simultaneous start or topology-aware placement.
Fragmentation occurs when free resources cannot satisfy the shape of waiting requests. Eight free devices spread across four nodes are different from eight free devices within one fast group. Repacking can improve fit but interrupts running work, so evaluate checkpoint age, restart time, and queue fairness before preemption. Reserve capacity for latency-critical inference and for recovering essential services. Allowing training to occupy every available slot can make a small production failure impossible to repair quickly.
Balance fairness with productive utilization
Fairness requires a declared unit: devices, device-seconds, a weighted share, or a dominant resource share. Equal job counts are misleading when one job requests one accelerator and another requests sixty-four. Priorities, quotas, queue aging, and preemption rules should be visible to users. Backfilling a small job into an otherwise idle gap can improve utilization, provided its expected duration and interruption policy do not indefinitely delay the large job that created the gap.
Track waiting time by workload class, useful accelerator-hours, completion time, failed allocations, and work lost to preemption. A scheduler can improve reported occupancy by admitting jobs that immediately contend for the same network. Compare against workload-level objectives instead. The following allocation efficiency is an accounting metric: it penalizes reserved idle time, but it does not establish fairness, numerical efficiency, or successful completion. Use it as one diagnostic alongside those outcomes.
Work it through
Spot a placement constraint hidden by totals
Two nodes each have eight accelerators. Each currently runs a five-device job. A new job requires four devices on a single node. Assume existing jobs cannot shrink and the new job cannot span nodes.
Count aggregate free capacity: each node has three free devices, giving six free devices in total.
Check the actual placement constraint: the four-device job needs one node with at least four free devices. Neither node qualifies.
Do not report this as a lack of total devices. It is fragmentation under the single-node constraint. The feasible options include waiting, changing the job topology if supported, or preempting an eligible existing job.
If one five-device job is preempted, its node has eight free devices and the waiting job fits. Compare the discarded or checkpointed work with the benefit of earlier completion before choosing that action.
Six idle devices do not imply that a four-device job can start. Schedulability depends on the shape and location of capacity.
The living notebook
Explore the model
Interactive lab · queue
Explore a waiting-job backlog
Vary the arrival and service rates of equal-sized jobs in a fluid queue starting with four jobs. The separate M/M/1 mean assumes Poisson arrivals and exponential service. Real accelerator jobs have resource shapes and topology constraints that this scalar queue deliberately cannot represent.
- Fluid backlog
- 4
- Net rate · λ − μ
- −1 /s
- M/M/1 mean residence
- 1 s
Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forQueue capacity is necessary, but a stable scalar queue does not prove that individual resource requests can be placed.
Pause & reason
Check your understanding
Your turn
Try it yourself
A job reserves four accelerators for 45 minutes. Loading takes five minutes and useful computation takes 35 minutes; the final five minutes are idle before cleanup. Find allocation efficiency. Would shortening loading alone prove higher model FLOP utilization?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Multiply both useful and reserved durations by the same device count. Separate reservation efficiency from efficiency while kernels are running.
Compare with the solution
Reserved time is 4 × 45 = 180 accelerator-minutes; useful time is 4 × 35 = 140. Allocation efficiency is 140/180 ≈ 77.8%. Faster loading can improve reservation efficiency without changing kernel-level FLOP utilization. Also verify that the useful computation produces valid results, rather than treating all busy time as productive.
Keep the idea
Take it with you
- Declare every resource and placement constraint that matters to the job.
- Fragmentation and topology can strand substantial aggregate capacity.
- Fairness and completed useful work must accompany utilization metrics.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.