An nccl-tests all_reduce_perf run on four RoCE-connected 8-GPU nodes shows a fraction of the fabric's rating; how do you read busbw and find the cause?
answer
- two bandwidth columns, one comparable
- a factor that depends on the collective
- judge the largest sizes
- Using network and NET/IB lines
- GDRDMA on the channel lines
basics
~10 sCompare busbw, not algbw, with the per-GPU link rating; for all-reduce busbw = algbw x 2(n-1)/n. If large-message busbw is still low, NCCL_DEBUG=INFO shows a socket fallback, too few adapters or missing GPUDirect RDMA.
solid answer
~40 sFirst read the right column. nccl-tests' `algbw` is size over time; `busbw` multiplies it by `2(n-1)/n` for all-reduce so it can be compared with the hardware bottleneck whatever the rank count. At 32 ranks an `algbw` of 8 GB/s is a `busbw` of 15.5 GB/s: about 62% of a 25 GB/s per-GPU adapter rating, not 32%. Judge the largest sizes, where latency no longer dominates. If it is still short, run one node alone to clear NVLink, then read `NCCL_DEBUG=INFO`: `Using network Socket` means RDMA is not in use at all; a `NET/IB : Using` line listing fewer adapters than the node has points at `NCCL_IB_HCA`; channel lines without `/GDRDMA` mean data is staged through host memory. On RoCE, also check the GID NCCL picked (`NCCL_IB_GID_INDEX`, `AUTO` by default in NCCL 2.32) against `show_gids`.
code
bash · 7 lines# One node first: does NVLink deliver? 8 GPUs, 8 B to 8 GiB, doubling
./build/all_reduce_perf -b 8 -e 8G -f 2 -g 8
# Then all four nodes, one process per GPU, with NCCL explaining its choices
export NCCL_DEBUG=INFO
export NCCL_DEBUG_SUBSYS=INIT,NET
mpirun -np 32 -N 8 ./build/all_reduce_perf -b 8 -e 8G -f 2 -g 1go deeper
Recall that nccl-tests prints two bandwidths, algbw and busbw, and that busbw is the one to compare with the hardware rating.
Explain the 2(n-1)/n factor for all-reduce and (n-1)/n for all-gather and reduce-scatter, and why the largest message sizes are the ones to judge.
Show the isolation order, one node then two then all, and read the INFO lines for socket fallback, adapter count and missing GPUDirect RDMA before touching any tuning variable.
Make busbw acceptance runs part of bringing up a cluster: a recorded baseline per node pool, rerun after driver or firmware changes, so a regression is caught before a pretraining run pays for it.
## Two bandwidth columns nccl-tests prints, for every message size, the time and two bandwidths: - **algbw** (algorithm bandwidth) is size over time, `S / t`. It tells you how long an operation of that size takes, but for a collective it falls as you add ranks, because each rank has to move more than the buffer. - **busbw** (bus bandwidth) applies a per-collective correction so the number reflects how fast the **hardware bottleneck** ran (NVLink, PCIe or the network) and can be compared with that link's rating whatever the rank count. | Collective | busbw = algbw x | |---|---| | All-reduce | 2(n-1)/n | | Reduce-scatter | (n-1)/n | | All-gather | (n-1)/n | | All-to-all | (n-1)/n | | Broadcast, reduce | 1 | ## Reading the run Take a vision-transformer pretraining job on four 8-GPU nodes, each GPU with its own RoCE adapter rated at an illustrative 25 GB/s. At 1 GiB, `all_reduce_perf` reports `algbw` 8 GB/s. 1. n = 32, so the factor is 2 x 31 / 32 = 1.9375. 2. busbw = 8 x 1.9375 = 15.5 GB/s. 3. Against the 25 GB/s rating that is 62%, a real gap but nowhere near the 32% that comparing algbw suggested. 4. The time column gives the cost directly: 1 GiB is about 1.07 GB, so each all-reduce of that size takes about 134 ms at 8 GB/s algbw. Read the **largest** sizes. At small sizes time is mostly fixed latency, so bandwidth is low on any fabric; the curve should plateau as size grows, and the plateau is what you compare. ## Narrowing down where the bandwidth goes 1. **One node alone** (`-g 8`): busbw now reflects NVLink or NVSwitch. If this is low, the problem is inside the node: peer-to-peer disabled, GPUs that should share NVLink talking over PCIe. 2. **Two nodes, then four**: if the drop appears only across nodes, look at the network path. 3. **Read NCCL's INFO output** for the multi-node run. | INFO line | What it means | |---|---| | `Using network Socket` | Inter-node data goes over IP sockets; RDMA is not in use at all | | `NET/IB : No device found.` | NCCL saw no usable RDMA adapter in this process (check what the container exposes) | | `NET/IB : Using [0]mlx5_0:1/RoCE [1]mlx5_1:1/RoCE ...` | The adapters NCCL will use and their link layer; count them against the node's adapters | | `Channel 00/0 : 0[0] -> 8[0] [send] via NET/IB/0/GDRDMA` | A channel crossing nodes over RDMA with GPUDirect RDMA | | the same line without `/GDRDMA` | RDMA without GPUDirect: data is staged through host memory | ## The RoCE-specific variables - **`NCCL_IB_HCA`** filters the RDMA adapters. Entries are prefixes unless they start with `=`: `mlx5_1` also selects `mlx5_10` to `mlx5_19` if they exist, and `^=mlx5_1,mlx5_4` excludes two cards. A value that leaves eight GPUs sharing one or two adapters caps busbw at their share. - **`NCCL_IB_GID_INDEX`** chooses the GID, which on RoCE fixes the RoCE version and address NCCL uses. Its default in NCCL 2.32 is `AUTO` (`-1` remains a legacy alias), steered by `NCCL_IB_ROCE_VERSION_NUM` (default 2) and `NCCL_IB_ADDR_FAMILY` (default `AF_INET`). Set an explicit index only when the INFO output or `show_gids` shows the automatic pick is wrong. - **`NCCL_NET_GDR_LEVEL`** sets the maximum GPU-to-adapter distance at which GPUDirect RDMA is used (`LOC` never, `PIX`, `PXB`, `PHB`, `SYS` always); NCCL chooses it from the topology when unset. `NCCL_DMABUF_ENABLE` (default 1) turns itself off when the kernel or drivers do not support dma-buf. - **`NCCL_IB_DISABLE=1`** forces sockets. It is a test, not a fix: if a run is no slower with it set, RDMA was most likely not carrying the traffic before either. ## What is not NCCL's to fix If NCCL reports every adapter, RoCE on each, and `/GDRDMA` on the channels, yet busbw stays low, the likeliest remaining causes sit in the fabric itself: switch configuration for lossless RoCE traffic, congestion from other tenants, a degraded link. Hand those to the network team with the busbw curve as evidence. ## Mistakes interviewers listen for - Comparing algbw with the adapter's line rate. - Multiplying algbw by the rank count. - Judging the fabric from small-message rows. - Assuming a job that runs is using RDMA.
- Why does all-reduce algbw fall as you add ranks even on a healthy fabric?Each rank must move `2(n-1)/n` of the buffer, so at a fixed link speed the time per byte of buffer rises toward twice the single-link time and `algbw` falls toward half the link rate. `busbw` multiplies the factor back in, which is why it stays roughly flat across rank counts on healthy hardware and is the number to compare.
- The channel lines show NET/IB but no /GDRDMA. What does that cost and what controls it?Without GPUDirect RDMA the adapter cannot read or write GPU memory directly, so traffic is staged through host memory, adding copies and PCIe crossings. NCCL decides from the GPU-to-adapter distance, which `NCCL_NET_GDR_LEVEL` overrides (`LOC` disables it, `SYS` always allows it); `NCCL_DMABUF_ENABLE` is on by default but turns itself off when the kernel or drivers lack support.
- Compare all-reduce algbw directly with the adapter's line rate.
- busbw is algbw multiplied by the number of ranks.
- Small-message rows show whether the fabric meets its rating.
- NCCL_IB_HCA=mlx5_1 can only ever select the adapter mlx5_1.
- If the job runs at all, NCCL must be using RDMA between nodes.
Assumes NCCL 2.32 with nccl-tests 2.21: NCCL_IB_GID_INDEX defaults to AUTO since 2.32 (-1 is a legacy alias), and the busbw factors are nccl-tests' own.