Topic 223 / Specialist
GPU and high-performance infrastructure
Chapter 13.15 · GPU and High-Performance Infrastructure
What and why
The training stage of the general ML lifecycle (→ 219) is usually the most compute-intensive part of the whole pipeline, and GPUs are the hardware most of that compute runs on — not because GPUs are simply faster CPUs, but because they're built for the specific kind of massively parallel arithmetic training and inference need. This inverts several assumptions the rest of this book relies on: GPUs are expensive, often scarce, and don't scale out cheaply the way stateless web servers do, so scheduling and utilization become first-order design concerns instead of an afterthought. Builds on: → 219 (AI/ML system architecture — the training stage).
Diagram
How it works
- GPU scheduling and sharing: because GPUs are expensive and often undersubscribed by a single job, a scheduler allocates GPU time or memory across multiple jobs or users — whole-GPU assignment, time-slicing, or partitioning one GPU's memory across jobs — rather than assuming one job per machine the way typical web workloads do.
- Interconnects: when a single GPU's memory or compute isn't enough, multiple GPUs, within a server or across servers, must exchange data during training; the speed of the link between GPUs is frequently as important as the GPUs' own compute, since a slow interconnect leaves fast GPUs waiting on each other.
- Distributed training — data parallelism (at awareness level): the same model is copied across multiple GPUs, each processing a different slice of the training data, periodically synchronizing updates — simple to reason about, but synchronization traffic grows with the number of GPUs involved.
- Distributed training — tensor parallelism (at awareness level): a single model's layers are split across multiple GPUs because the model itself is too large to fit in one GPU's memory, requiring communication between GPUs for every layer's computation, not just periodic synchronization.
- Distributed training — pipeline parallelism (at awareness level): different GPUs own different stages of the model, passing intermediate results forward — keeps any single GPU's memory requirement bounded to its stage, at the cost of pipeline "bubbles" when a later stage waits on an earlier one.
- Batch queues: because GPU capacity is scarce and jobs vary enormously in size and duration, jobs are typically submitted to a queue and scheduled when capacity frees up, rather than run immediately on demand the way a typical request handler would be.
- Utilization economics: an idle GPU is a sunk cost that doesn't shrink the way an idle, auto-scaled web server does (→ 95) — the usual "scale out cheaply, scale down when idle" assumption inverts here, because provisioning more GPU capacity is slow and expensive, and idle time between jobs is often the real driver of cost, not raw compute speed.
Practical example
(illustrative). A training job needs more memory than one GPU provides, so its model is split with tensor parallelism across 4 GPUs within one server (fast interconnect, frequent per-layer communication), while 8 such 4-GPU servers run data parallelism against each other (a slower inter-server link, less frequent synchronization). The more frequent the required communication — tensor parallelism, every layer — the faster the link it needs; the less frequent synchronization of data parallelism can tolerate a slower one.
When to use it
- Use when: designing or reasoning about infrastructure for training or heavy inference workloads where GPU cost and scarcity are real constraints driving design decisions.
- Avoid when: a workload's compute needs are modest enough to run on CPU-based infrastructure — most ordinary web services never need this topic at all — reach for GPU infrastructure only once a workload is demonstrably compute-bound on the kind of parallel arithmetic GPUs accelerate.
- Failure scenarios: provisioning GPUs sized for peak training load that then sit idle most of the time, inverting the usual elastic-scaling cost model; choosing data parallelism for a model too large for one GPU's memory, when it doesn't fit regardless of how training is parallelized, instead of tensor or pipeline parallelism; a slow interconnect silently becoming the bottleneck while the GPUs themselves appear underutilized in simple utilization metrics.
- Simpler alternative: CPU-based infrastructure and the ordinary scaling patterns (→ 90, → 95) for any workload that isn't demonstrably GPU-bound.
Practice
(Decision kind — judge scenarios and defend the choice; 20–30 min, no lab services). Given 3 scenarios — a model that fits on one GPU but needs faster training, a model too large for one GPU's memory, and a model whose stages have very uneven compute cost — decide which parallelism strategy (data, tensor, or pipeline) fits each, and justify against the other two. Done when you can state the specific failure each wrong choice would hit (for example, "doesn't fit in memory" versus "needless communication overhead").
Key takeaway
GPU infrastructure inverts the usual scale-out economics: units are expensive and scarce, so scheduling, interconnect speed, and utilization are first-order design concerns, and the parallelism strategy must match why a model doesn't fit on one GPU. Done when you can: pick a parallelism strategy for a given constraint and name the failure the other two would hit. Used next in: nowhere else in this book — a specialization for teams operating training or heavy-inference infrastructure directly.
References
None — this topic makes no external claims.
Source directory