When NCCL AllReduce Is Slow: Diagnose GPU Topology and Training Throughput
NCCL is NVIDIA’s library for collective communication among NVIDIA GPUs, such as exchanging sums or data shards. When AllReduce is slow, first check the rank-to-GPU communication path, message size, and whether every rank calls the collective under matching conditions. Do not diagnose a training job from one `nccl-tests` number alone; connect logs and the GPU timeline of the real workload.
When NCCL AllReduce Is Slow: Diagnose GPU Topology and Training Throughput
NCCL is NVIDIA’s library for collective communication among NVIDIA GPUs, such as exchanging sums or data shards. When AllReduce is slow, first check the rank-to-GPU communication path, message size, and whether every rank calls the collective under matching conditions. Do not diagnose a training job from one nccl-tests number alone; connect logs and the GPU timeline of the real workload.
What do NCCL and AllReduce do?
NCCL is not a training framework or distributed job manager. An application or framework calls collectives such as AllReduce, Broadcast, AllGather, and ReduceScatter on each rank; NCCL moves data and performs the operation across GPUs. A rank is an ordinal in a communicator, not necessarily a GPU number.
In data-parallel training, each GPU computes gradients for its mini-batch and then uses AllReduce to sum the values from all ranks. The reduced result is delivered to every rank so that each GPU can continue with the same gradient. NVIDIA’s documentation says each rank participating in a collective must use the same count and datatype for a complete operation. Mismatched participation or ordering can lead to undefined behavior, including hangs, crashes, or corrupted data. For operations with a root, the root is a rank, not a device number. NCCL collective operations
Why can the same AllReduce use a slower path?
NCCL builds communication using GPU-to-GPU PCIe/NVLink paths, GPU-to-NIC paths, the inter-node network, and CPU/memory NUMA placement. If framework rank-to-GPU assignment or process CPU/NIC binding does not fit the topology, data may take a longer route or communication may fail to overlap computation. NVIDIA notes that an IP interface marked UP may still be unable to communicate with other nodes, causing initialization failures or hangs. NCCL networking troubleshooting
Message size matters too. With small messages, fixed call and synchronization latency can dominate. With large messages, link throughput matters more. A single “AllReduce speed” number can hide which range is slow. Results are also hard to compare when rank counts, GPU placement, or message sizes differ.
Narrow down the cause from the symptom
| Symptom | Compare first | Next direction |
|---|---|---|
| Only small messages are slow | Rank count, call frequency, CPU scheduling, synchronization and ordering | Check fixed latency or rank progress imbalance. |
| Large-message performance is low on one node | nvidia-smi topo -m, P2P/NVLink/PCIe paths for the GPU pairs, message size | Compare GPU-link tests with NCCL measurements. |
| One node is fine, but multiple nodes are slow or hang | Rank placement, NIC/interface selection, link state, inter-node bandwidth and latency | Separate the network path with NCCL logs and ibstat/ib_write_bw/ib_write_lat. |
| The benchmark is fast but training is slow | Real collective sizes/frequency, per-rank delays, and compute/communication overlap | Profile the training step and find waits that remain after collectives. |
Diagnose in five steps
Assume compatible NVIDIA GPUs, CUDA and NCCL, plus a reproducible training workload. The NCCL 2.32.6 release notes checked for this article list CUDA 12.x and 13.x support, but that alone does not guarantee a particular framework container or driver combination. Verify the installed stack and framework support matrix. NCCL 2.32.6 release notes
Freeze the reproduction conditions and collective contract. Record node/GPU counts, each process’s rank-to-GPU mapping, operation, count, datatype, message size, and call order. Confirm that every rank invokes the corresponding collective in the same order with compatible arguments.
Start with supported NCCL built-in diagnostics. With NCCL 2.31 or newer, set
NCCL_RUN_DIAGNOSTICS=1to run checks at communicator initialization. These exercise real paths such as P2P and multi-node networking, but they are informational diagnostics, not performance benchmarks. A clean report does not guarantee application correctness or throughput. NCCL built-in diagnosticsCollect initialization, topology, and communication-selection logs.
NCCL_DEBUG=INFOrecords detailed information;NCCL_DEBUG_SUBSYScan narrow it to initialization, topology, tuning, and networking. Put%hand%pin the filename to separate processes, and turn detailed logging off after diagnosis. This example launches the application from a Linux shell. NCCL logging guideNCCL_DEBUG=INFO \ NCCL_DEBUG_SUBSYS=INIT,GRAPH,TUNING,NET \ NCCL_DEBUG_FILE=/tmp/nccl_%h_%p.log \ ./my_appRun a communication microbenchmark across message sizes. NVIDIA’s
nccl-testschecks correctness as well as performance. This example measures AllReduce from 8 bytes to 128 MiB, doubling the size each time, on one node with eight available GPUs. If your hardware does not meet that condition, adapt the GPU count and size range. Multi-node testing requires an MPI-enabled build and a correct process placement. NVIDIA nccl-tests usage./build/all_reduce_perf -b 8 -e 128M -f 2 -g 8Profile real training and change one condition at a time. Use Nsight Systems NCCL tracing to inspect per-rank collective calls, GPU execution, and overlap between computation and communication. If benchmark and training results differ, compare actual message sizes and frequency, rank delays, and overlap first. Nsight Systems NCCL tracing
Connect benchmark numbers to real throughput
In nccl-tests, algbw is the algorithm bandwidth: operation data size divided by time. busbw adjusts for the collective and rank count; its formula differs by operation. Consider bandwidth for large messages and latency for small ones. Comparing algbw across different collectives or rank counts directly with a hardware link rate can mislead. NCCL Tests performance metrics
A microbenchmark compares a communication path for fixed messages and placement; it does not predict a training step or model throughput. If communication overlaps computation, a busy link may add little to training latency. Conversely, if one rank is late after a collective, every other rank may wait and the whole step grows. After isolating the cause, try rank placement, NUMA/NIC affinity, or network settings. NCCL debug and forced-tuning environment variables can cause slowdowns or hangs depending on version and system; remove experimental settings and remeasure after each change. NCCL performance and tuning · NCCL environment variables
References
[NVIDIA NCCL 2.32.6 release notes](https://docs.nvidia.com/deeplearning/nccl/archives/nccl_2326/release-notes/rel_2-32-6.html)
[NVIDIA NCCL collective operations](https://docs.nvidia.com/deeplearning/nccl/archives/nccl_2326/user-guide/docs/usage/collectives.html)
[NVIDIA NCCL built-in diagnostics](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting/diagnostics.html)
[NVIDIA NCCL logging](https://docs.nvidia.com/deeplearning/nccl/archives/nccl_2326/user-guide/docs/troubleshooting/logging.html)
[NVIDIA NCCL performance and tuning](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting/performance_and_tuning.html)
[NVIDIA NCCL Tests](https://github.com/NVIDIA/nccl-tests)
[NVIDIA NCCL Tests performance metrics](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md)
[NVIDIA Nsight Systems NCCL tracing](https://docs.nvidia.com/nsight-systems/UserGuide/index.html)
References
- NVIDIA NCCL 2.32.6 Release Notes
- NVIDIA NCCL Collective Operations
- NVIDIA NCCL Built-in Diagnostics
- NVIDIA NCCL Logging
- NVIDIA NCCL Networking Troubleshooting
- NVIDIA NCCL Performance and Tuning
- NVIDIA NCCL Environment Variables
- NVIDIA nccl-tests
- NVIDIA nccl-tests Performance Metrics
- NVIDIA Nsight Systems User Guide