Skip to content
GenAI Learn/Distributed AI Infrastructure
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

GPU Clusters and AI Workload Scheduling

4 min readChapter 1 of 5

You'll learn to

  • -Describe a GPU cluster as servers with several GPUs each, and a scheduler that places jobs on them
  • -Explain gang scheduling and why a large training job can wait while many GPUs sit free
  • -Compare spreading jobs out with packing them together, and say what each is good for
  • -Name the other levers: priorities, preemption, quotas and topology awareness

Tip: the highlighter is on - just select any text below to mark it. Use the highlighter button up top to change color or turn it off. Highlights are saved on this device only. Log in to save them to your account instead.

One GPU server is easy to reason about. A company with a few hundred GPUs is a different problem. Many teams share them, with very different jobs: a training run that needs 64 GPUs together for a week, inference replicas that need to stay up forever, and a stream of short evaluation jobs. Someone has to decide which job goes on which GPU and when. That someone is the scheduler, and its decisions are the difference between 90 percent of an expensive cluster in use and 40 percent.

An Analogy: A Parking Garage With Cars and Buses

A garage has three floors. If every arriving car parks on whichever floor is emptiest, each floor ends up half full of cars scattered everywhere, and when a bus arrives that needs a whole floor, none is free, even though half the garage is empty. If cars are packed onto the first floors first, an empty floor stays available for the bus. Scheduling GPUs is the same puzzle, and the bus is a large training job.

What the Scheduler Works With

  • -Nodes: servers that each hold a few GPUs, often 8, connected tightly to each other. Moving data between nodes is slower than moving it inside one.
  • -Jobs with requests: a number of GPUs, memory, and sometimes a GPU type.
  • -Gang scheduling: a distributed training job needs all its GPUs at the same moment. Starting 6 of 8 and waiting for the rest wastes the 6.
  • -Priorities and preemption: an urgent job may push out a lower priority one, which must then be able to stop safely and restart, usually from a checkpoint.
  • -Quotas and fair share: each team gets a guaranteed amount, so one team cannot take everything.
  • -Topology awareness: keep the GPUs of one job on the same node or nearby, where links are fast.

The code below has three servers with 8 GPUs each and seven jobs: six small jobs of 2 GPUs, and one training job that needs a whole server. Two placement policies handle the same arrivals. Spread puts each job on the emptiest server. Pack puts each job on the fullest server that can still hold it.

Press Run: spreading jobs strands free GPUs, packing keeps a server empty for the big job

Under spread, the six small jobs land two to a server, leaving 4 free GPUs on every server, 12 free in total, and the training job that needs 8 on one server cannot start. It waits while a quarter of the cluster idles. Under pack, the small jobs fill the first two servers, a whole server stays empty, and the training job starts at once. Only 4 GPUs are left free afterward, so a smaller share of the cluster is wasted.

Neither policy wins everywhere. Spread isolates failures and balances heat and load, which suits inference replicas that should survive a server loss. Pack leaves room for big jobs and is better for mixed clusters with training in them. Real schedulers combine both, with queues, priorities and backfilling small jobs into gaps while a big one waits.

The metric to watch is not only how many GPUs are busy, but how long big jobs wait and how many GPUs are free in pieces too small to use. Fragmentation is invisible in an average utilization number.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!