Every training step ends with an all-reduce Four GPUs on two nodes train one model with data parallelism. After each backward pass, every GPU holds its own gradients, and all of them must end up with the same sum. That collective is an all-reduce.
A communication library such as NCCL runs it. Some of the traffic stays inside a node, and some has to cross the network to the other node. The slowest link sets the pace for everyone.
Key idea GPUs that wait for the network sit idle. In large jobs, communication speed decides how much of the expensive compute you actually use.
Inside a node: NVLink and NVSwitch beat PCIe GPUs in one node can talk over PCIe, but PCIe is shared with NICs and storage and has far less bandwidth than a direct GPU link. NVLink connects GPUs directly, and an NVSwitch lets every GPU in the node reach every other one at full NVLink speed.
NCCL picks the best path it finds. On a node with NVLink it uses peer-to-peer copies over NVLink. Without it, traffic goes over PCIe, and across CPU sockets it is slower still.
Key idea nvidia-smi topo -m prints the matrix. NV# means NVLink, PIX or PXB means a shared PCIe switch, and SYS means the path crosses the CPU interconnect.
Across nodes the plain way: through the CPU and kernel Over ordinary TCP, data leaves GPU 0 for host memory, goes through the kernel network stack, and only then reaches the NIC. The other node does the same in reverse.
Every hop adds copies, system calls and CPU work. The link may be fast, but the host path in the middle cannot keep up with what GPUs produce.
RDMA: the NIC writes into remote memory itself With RDMA (remote direct memory access), the application registers a memory region with the NIC once. After that, the NIC reads and writes memory on the other node directly. The data path skips the kernel and the remote CPU.
Two fabrics carry RDMA. InfiniBand is a separate network with its own switches and a subnet manager. RoCE v2 carries the same RDMA transport inside UDP/IP packets, so it runs on Ethernet switches.
Key idea ibv_devinfo lists RDMA devices. link_layer shows InfiniBand or Ethernet (RoCE), and the port must be PORT_ACTIVE.
GPUDirect RDMA: the NIC reads GPU memory directly Plain RDMA still bounces through host memory: GPU to host, then host to NIC. GPUDirect RDMA removes that bounce. The NIC reads and writes GPU memory over PCIe, peer to peer.
It works best when the GPU and its NIC sit under the same PCIe switch. It needs driver support on the host, such as the nvidia-peermem module or DMA-BUF. In NCCL logs the channel line then shows GDRDMA.
Key idea Check nvidia-smi topo -m: the GPU and the NIC it uses should show PIX or PXB. SYS means GPUDirect traffic crosses CPU sockets and loses much of its benefit.
Rail-optimized: one NIC per GPU, one switch per rail Large GPU servers have one high-speed NIC per GPU. In a rail-optimized design, NIC 0 of every node plugs into the rail 0 switch, NIC 1 into rail 1, and so on.
GPU 0 on node A and GPU 0 on node B then talk through a single leaf switch. NCCL arranges its rings and trees so that most traffic stays on a rail, and NVLink inside the node moves data between rails.
Key idea Each GPU should use its nearest NIC. Pods that get GPUs and NICs from different PCIe branches lose the rail benefit, so topology-aware allocation matters.
RoCE needs a lossless Ethernet setup InfiniBand has credit-based flow control, so switches do not drop packets under load. Ethernet drops packets when a buffer fills, and RDMA recovers from loss badly: it retransmits large chunks and throughput collapses.
RoCE fabrics therefore use PFC (priority flow control), which pauses one traffic class instead of dropping it, and ECN marks that tell senders to slow down, as in the DCQCN congestion control. Both must match on NICs and every switch.
Watch out Watch the NIC and switch counters for pause frames, ECN marks and out-of-sequence or retransmit events. A mismatched priority on one switch port is enough to hurt the whole job.
On Kubernetes: a second network just for RDMA The primary CNI still gives the Pod eth0 for Service traffic, DNS and health checks. Multus attaches a second interface, such as net1, from a NetworkAttachmentDefinition, and that interface sits on the RDMA NIC.
The NIC also has to be allocated like a GPU. An RDMA shared device plugin or the SR-IOV device plugin advertises it as an extended resource, or a DRA driver such as DraNet hands it out as a device. The NVIDIA Network Operator can install the NIC driver, these plugins, Multus and IPAM together.
Key idea An RDMA Pod usually requests GPUs and an RDMA resource, carries the Multus networks annotation, and adds the IPC_LOCK capability so it can pin memory for the NIC.
NCCL quietly falls back to TCP sockets A new job runs, but each step takes many times longer than on the old cluster. Nothing crashes. With NCCL_DEBUG=INFO, the log says NET/Socket instead of NET/IB, so all inter-node traffic goes through the kernel over eth0.
Usual causes: the Pod has no RDMA device (no resource request or no Multus network), memory cannot be pinned (no IPC_LOCK, low memlock limit), NCCL_IB_DISABLE is set, or on RoCE the wrong GID index is chosen.
Watch out Test the layers in order: ib_write_bw between two Pods proves the RDMA path, and nccl-tests all_reduce_perf shows the bus bandwidth NCCL reaches. Compare both with the hardware rating.
Short paths, the right NIC, and proof in the logs Inside a node, NVLink and NVSwitch carry GPU traffic. Across nodes, RDMA over InfiniBand or RoCE v2 skips the kernel, and GPUDirect RDMA lets the NIC read GPU memory directly. A rail-optimized fabric gives each GPU its own NIC and switch.
On Kubernetes, the RDMA NIC is a second network and an allocated device, next to the normal Pod network. RoCE also needs PFC and ECN set the same way end to end.
Summary Do not trust a fast network on paper. Read the NCCL transport line and run all_reduce_perf on every new cluster before you start a long job.