Why Two GPUs Aren’t Twice as Fast

· Source: LLM on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure, Software Development & Engineering · Depth: Intermediate, long

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

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

Topics

Code references

Best for: Machine Learning Engineer, AI Engineer, AI Student

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.