Why Two GPUs Aren’t Twice as Fast
Summary
This article explains why using two GPUs for model training does not double the speed, even when the model fits on a single card. The bottleneck is the interconnect, the "wire" between GPUs, which becomes critical during the "all-reduce" operation where partial gradients are combined and broadcast. The author details different interconnect paths, from slowest (cross-socket PCIe, ~22 GB/s measured) to fastest (NVLink, a datacenter feature). An experiment using two consumer RTX 5090 GPUs on vast.ai measured the PCIe bus bandwidth at approximately 22 GB/s, significantly lower than the theoretical ~50 GB/s for a clean PCIe 5.0x16 link due to cross-socket communication (SYS topology). Rerunning the test with the suboptimal gloo backend, which routes through the CPU, dropped bandwidth to about 1.7 GB/s, a 13x reduction, proving the interconnect is the bottleneck. The article also provides a formula, T ≈ 2(N−1)/N · bytes / busbw, to predict all-reduce time, showing that for a 200 MB gradient, a 2-GPU setup takes ~9 ms, while an 8-GPU setup takes ~16 ms.
Key takeaway
For AI Engineers optimizing multi-GPU training, understand that interconnect bandwidth, not raw GPU power, often limits performance. Your system's GPU topology, visible via "nvidia-smi topo -m", directly impacts all-reduce speeds. Prioritize minimizing data transfer or overlapping communication with computation to mitigate this bottleneck. Do not assume linear scaling; instead, measure your specific interconnect performance to accurately predict training times and optimize resource allocation.
Key insights
Distributed GPU training speed is often bottlenecked by interconnect bandwidth, not GPU compute power.
Principles
- Interconnect speed dictates all-reduce performance.
- Topology (e.g., cross-socket PCIe) significantly impacts bandwidth.
- All-reduce cost scales with 2(N−1)/N factor.
Method
Measure interconnect bus bandwidth by sweeping all-reduce operations across message sizes using NCCL, then validate by comparing with a slower backend like gloo, and predict using the T ≈ 2(N−1)/N · bytes / busbw formula.
In practice
- Use "nvidia-smi topo -m" to identify GPU interconnect type.
- Time GPU operations with CUDA events for accuracy.
- Overlap communication with computation to hide latency.
Topics
- GPU Interconnects
- Distributed Training
- All-reduce
- NCCL
- PCIe
- NVLink
- Bandwidth Measurement
Code references
Best for: Machine Learning Engineer, AI Engineer, AI Student
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.