Collective Communication
Definition
A collective is a communication operation involving all ranks in a group (vs. point-to-point). These six primitives are the complete vocabulary of distributed training: broadcast, reduce, all-reduce, reduce-scatter, all-gather, all-to-all. Every parallelism strategy — DP, ZeRO/FSDP, TP, EP — is built from them and bounded by the interconnect they run on. NCCL is the standard NVIDIA implementation.
Key math / How it works
Notation: ranks; = associative reduction (usually sum); “chunk ” = the -th slice of a buffer.
| Primitive | Before → After (rank ) | Definition |
|---|---|---|
| Broadcast | root has → all have | copy one rank’s buffer to all |
| Reduce | → root has | reduce, result on one root |
| All-Reduce | → all have | reduce, result on every rank |
| Reduce-Scatter | vector in chunks → rank keeps | reduce, but scatter — each keeps its chunk |
| All-Gather | chunk → all have | concatenate every rank’s chunk |
| All-to-All | → | transpose: send chunk to rank |
The two identities that drive everything:
All-gather is the inverse of reduce-scatter (with the sum dropped). This decomposition is the lens behind ring all-reduce and ZeRO/FSDP (all-gather sharded weights before a layer, reduce-scatter grads after). All-to-all is the primitive behind MoE expert parallelism and sequence parallelism.
Ring all-reduce cost. Split each rank’s -byte buffer into chunks. Reduce-scatter = ring steps sending each; all-gather = another steps. Bytes sent per GPU:
Under the – model (message of bytes = ):
As the bandwidth term — constant, independent of , and provably bandwidth-optimal (Patarasuk & Yuan 2009). This is why ring all-reduce backs large-scale DP. But the latency term grows linearly in , so for small messages at large a tree (or double-binary-tree) all-reduce wins with latency. In-network reduction (NVLink SHARP / IB SHARP) halves ring volume toward by summing in the switch ASIC.
Contrast the naive baselines: reduce-to-root ( on one hot link, scales with ) and all-pairs ( too much data). The ring beats both by using every link equally with no hot spot.
Why it matters
The cost model’s means the fabric sets the constant: NVLink (~900 GB/s) is ~18× NDR InfiniBand (~50 GB/s/GPU). Placing each collective on the right link — chatty TP all-reduces on NVLink, once-per-step DP syncs across nodes on IB — is the central design lever of N-D parallelism.
Taught in
- 08-data-parallelism-and-collectives — §4 primitives, §5 ring all-reduce derivation.
See also
- nccl — topology-aware implementation
- data-parallelism — all-reduce as the gradient sync
- zero / fsdp — RS + AG decomposition in action
- tensor-parallelism — per-layer all-reduce
- expert-parallelism — all-to-all dispatch/combine
- gpu-systems-for-llms