NCCL and RDMA networking
A multi-node GPU cluster where NCCL provably uses the fast fabric (NET/IB/GDRDMA over InfiniBand or RoCE), with a test ladder from NIC to engine so each layer is proven before the next.
Scope: NVIDIA GPUs, NCCL, RDMA fabrics (InfiniBand, RoCE), GPUDirect RDMA, nccl-tests and perftest. Not engine flags (see vllm, sglang, tensorrt-llm, multi-node-inference) and not Apple RDMA over Thunderbolt (see exo).
Work through the steps in order. Load a reference only when a step names it.
Discover first
Read-only, no root needed unless stated. scripts/nccl-net-check.sh runs the safe ones.
nvidia-smi topo -m # GPU/NIC distances: NV#, PIX, PXB, PHB, SYS
nvidia-smi topo -p2p n # NVLink peer matrix
ibstat 2>/dev/null || ibstatus 2>/dev/null # State Active, Rate, link layer
rdma link show 2>/dev/null; ip -br link | grep -Ei 'ib|mlx|eth|en'
lsmod | grep -E 'nvidia_peermem|nvidia-peermem|mlx5_core|ib_core'
ulimit -l # want unlimited for RDMA registration
cat /proc/cmdline | tr ' ' '\n' | grep -i iommu; dmesg 2>/dev/null | grep -iE 'iommu|dmar' | head -3
env | cut -d= -f1 | grep '^NCCL_' || true # names only
python3 -c 'import torch;print(torch.cuda.nccl.version())' 2>/dev/null
ls /dev/infiniband 2>/dev/null; command -v ib_write_bw all_reduce_perf
gh api repos/NVIDIA/nccl/releases/latest --jq .tag_name
Ask only what discovery cannot show: fabric (InfiniBand or RoCE), switch vendor and congestion settings, NIC model, nodes and GPUs per node, bare metal vs VM vs container vs Kubernetes, which engine runs on top.
Decision flow
- NCCL log says
NET/Socket or training is slow across nodes: walk the ladder bottom-up. -> references/diagnostics.md
- NIC or port not Active, Rate low, SM missing: fabric layer. ->
references/fabric-and-gpudirect.md
- GPUDirect RDMA not used:
nvidia-peermem or DMA-BUF, ACS, IOMMU, topology. -> references/fabric-and-gpudirect.md
- Wrong interface, HCA, GID index, hang at init: ->
references/env-vars.md, then references/troubleshooting.md
- Containers or Kubernetes: IPC_LOCK, /dev/shm, devices, host network. ->
references/containers-and-engines.md
- Fabric is proven, NCCL still below expectation: tuning. ->
references/performance-tuning.md
- New NCCL or driver: ->
references/updating.md
Rules
- Prove bottom-up. NIC link, then
ib_write_bw, then GPU-memory ib_write_bw, then nccl-tests, then the engine. Never tune NCCL variables before the lower layers pass.
- Ask before changing the system.
modprobe, sysctl, limits.conf, ACS changes, IOMMU or BIOS settings and driver updates need approval, a rollback and usually a reboot.
- Set as little as possible. NCCL auto-detects topology; upstream discourages broad tuning variables in production. Pin only
NCCL_SOCKET_IFNAME and NCCL_IB_HCA (with = for exact names) when detection picks wrong.
- Do not set
NCCL_IB_GID_INDEX on NCCL 2.21+. The GID index is selected dynamically; older versions need show_gids.
- Never use
NCCL_DEBUG=ATTN site-wide. Versions before 2.32 do not know it and drop to no logging; use NCCL_DEBUG=WARN NCCL_DEBUG_LEVELS=ATTN.
- NCCL traffic is not encrypted by default. Keep bootstrap and RDMA on a private network segment; an OpenSSL build can encrypt only NCCL's TCP socket traffic, not IB or RoCE.
- Same versions everywhere. NCCL, drivers and OFED/DOCA on every node; frameworks may bundle their own NCCL.
- Secrets never touch output. Nothing here needs keys; do not print job env dumps that may include tokens (
env | cut -d= -f1).
- Verify upstream. Variables and defaults come from the NCCL user guide for the installed version.
Workflows
Prove the fabric
Make an engine use it
Diagnose a hang or slowdown
Reference index
| File |
Read when |
references/diagnostics.md |
The test ladder, nccl-tests, reading busbw and NCCL logs |
references/fabric-and-gpudirect.md |
InfiniBand vs RoCE checks, peermem or DMA-BUF, ACS, IOMMU |
references/env-vars.md |
The NCCL variables that matter, values, defaults, config file |
references/containers-and-engines.md |
Docker, Kubernetes, vLLM, SGLang, TensorRT-LLM specifics |
references/performance-tuning.md |
Rails, QPs, algo, channels, NVLS, what not to touch |
references/install.md |
NCCL, nccl-tests, perftest, rdma-core, bundled NCCL |
references/updating.md |
Version alignment, upgrades, rollback |
references/troubleshooting.md |
Symptom to cause to fix |
Script: scripts/nccl-net-check.sh (read-only node check). Template: templates/nccl.conf.
Companion skills
Install any with npx skills add ScaleDockHQ/llm-skills --skill <name>.
multi-node-inference: parallelism strategy across nodes.
vllm, sglang, tensorrt-llm: engines that use NCCL.
disaggregated-serving: KV transfer over RDMA between prefill and decode.
choosing-hardware: NIC and fabric sizing.
exo: Apple RDMA over Thunderbolt, a different stack.
1---2name: nccl-rdma-networking3description: NCCL over InfiniBand, RoCE and GPUDirect RDMA for multi-node GPU inference and training, verifying the fabric before tuning NCCL. Use to diagnose NET/Socket instead of NET/IB/GDRDMA, slow or hung cross-node tensor parallelism, ibv_create_qp or ibv_modify_qp failures, wrong NCCL_IB_HCA, NCCL_SOCKET_IFNAME or GID index, nccl-tests busbw, ACS, IOMMU, nvidia-peermem. Not Apple RDMA (exo skill).4license: MIT5compatibility: Commands assume Linux with NVIDIA GPUs, bash and the rdma-core, perftest and nccl-tests tools where named. Most checks need no root; module loads, sysctl, limits and BIOS/ACS changes need the user's explicit approval and a reboot plan.6metadata:7 source: https://skillmd.com/skills/scaledockhq/nccl-rdma-networking8 author: ScaleDockHQ9 version: "0.1.0"10---1112# NCCL and RDMA networking1314A multi-node GPU cluster where NCCL provably uses the fast fabric (`NET/IB/GDRDMA` over InfiniBand or RoCE), with a test ladder from NIC to engine so each layer is proven before the next.1516**Scope:** NVIDIA GPUs, NCCL, RDMA fabrics (InfiniBand, RoCE), GPUDirect RDMA, nccl-tests and perftest. Not engine flags (see `vllm`, `sglang`, `tensorrt-llm`, `multi-node-inference`) and not Apple RDMA over Thunderbolt (see `exo`).1718Work through the steps in order. Load a reference only when a step names it.1920## Discover first2122Read-only, no root needed unless stated. `scripts/nccl-net-check.sh` runs the safe ones.2324```bash25nvidia-smi topo -m # GPU/NIC distances: NV#, PIX, PXB, PHB, SYS26nvidia-smi topo -p2p n # NVLink peer matrix27ibstat 2>/dev/null || ibstatus 2>/dev/null # State Active, Rate, link layer28rdma link show 2>/dev/null; ip -br link | grep -Ei 'ib|mlx|eth|en'29lsmod | grep -E 'nvidia_peermem|nvidia-peermem|mlx5_core|ib_core'30ulimit -l # want unlimited for RDMA registration31cat /proc/cmdline | tr ' ' '\n' | grep -i iommu; dmesg 2>/dev/null | grep -iE 'iommu|dmar' | head -332env | cut -d= -f1 | grep '^NCCL_' || true # names only33python3 -c 'import torch;print(torch.cuda.nccl.version())' 2>/dev/null34ls /dev/infiniband 2>/dev/null; command -v ib_write_bw all_reduce_perf35gh api repos/NVIDIA/nccl/releases/latest --jq .tag_name36```3738Ask only what discovery cannot show: fabric (InfiniBand or RoCE), switch vendor and congestion settings, NIC model, nodes and GPUs per node, bare metal vs VM vs container vs Kubernetes, which engine runs on top.3940## Decision flow41421. **NCCL log says `NET/Socket` or training is slow across nodes:** walk the ladder bottom-up. -> `references/diagnostics.md`432. **NIC or port not Active, Rate low, SM missing:** fabric layer. -> `references/fabric-and-gpudirect.md`443. **GPUDirect RDMA not used:** `nvidia-peermem` or DMA-BUF, ACS, IOMMU, topology. -> `references/fabric-and-gpudirect.md`454. **Wrong interface, HCA, GID index, hang at init:** -> `references/env-vars.md`, then `references/troubleshooting.md`465. **Containers or Kubernetes:** IPC_LOCK, /dev/shm, devices, host network. -> `references/containers-and-engines.md`476. **Fabric is proven, NCCL still below expectation:** tuning. -> `references/performance-tuning.md`487. **New NCCL or driver:** -> `references/updating.md`4950## Rules5152- **Prove bottom-up.** NIC link, then `ib_write_bw`, then GPU-memory `ib_write_bw`, then nccl-tests, then the engine. Never tune NCCL variables before the lower layers pass.53- **Ask before changing the system.** `modprobe`, `sysctl`, `limits.conf`, ACS changes, IOMMU or BIOS settings and driver updates need approval, a rollback and usually a reboot.54- **Set as little as possible.** NCCL auto-detects topology; upstream discourages broad tuning variables in production. Pin only `NCCL_SOCKET_IFNAME` and `NCCL_IB_HCA` (with `=` for exact names) when detection picks wrong.55- **Do not set `NCCL_IB_GID_INDEX` on NCCL 2.21+.** The GID index is selected dynamically; older versions need `show_gids`.56- **Never use `NCCL_DEBUG=ATTN` site-wide.** Versions before 2.32 do not know it and drop to no logging; use `NCCL_DEBUG=WARN NCCL_DEBUG_LEVELS=ATTN`.57- **NCCL traffic is not encrypted by default.** Keep bootstrap and RDMA on a private network segment; an OpenSSL build can encrypt only NCCL's TCP socket traffic, not IB or RoCE.58- **Same versions everywhere.** NCCL, drivers and OFED/DOCA on every node; frameworks may bundle their own NCCL.59- **Secrets never touch output.** Nothing here needs keys; do not print job env dumps that may include tokens (`env | cut -d= -f1`).60- **Verify upstream.** Variables and defaults come from the NCCL user guide for the installed version.6162## Workflows6364### Prove the fabric6566- [ ] Run `scripts/nccl-net-check.sh` on each node -> `references/diagnostics.md`.67- [ ] `ib_write_bw` host memory, then `--use_cuda=<gpu>` between two nodes.68- [ ] Build nccl-tests; run `all_reduce_perf` single node, then two nodes with `NCCL_DEBUG=INFO`; confirm `NET/IB` and `GDRDMA`.6970### Make an engine use it7172- [ ] Set `NCCL_SOCKET_IFNAME` (bootstrap) and `NCCL_IB_HCA`; add `IPC_LOCK`, `/dev/shm`, RDMA devices to containers -> `references/containers-and-engines.md`.73- [ ] Launch with `NCCL_DEBUG=INFO`; grep for `NET/IB` and `GDRDMA`, not `NET/Socket`.7475### Diagnose a hang or slowdown7677- [ ] `NCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=INIT,NET`; match the error to `references/troubleshooting.md`.78- [ ] `rdma statistic`, `ethtool -S`, `perfquery` while the test runs.7980## Reference index8182| File | Read when |83| -------------------------------------- | ------------------------------------------------------------- |84| `references/diagnostics.md` | The test ladder, nccl-tests, reading busbw and NCCL logs |85| `references/fabric-and-gpudirect.md` | InfiniBand vs RoCE checks, peermem or DMA-BUF, ACS, IOMMU |86| `references/env-vars.md` | The NCCL variables that matter, values, defaults, config file |87| `references/containers-and-engines.md` | Docker, Kubernetes, vLLM, SGLang, TensorRT-LLM specifics |88| `references/performance-tuning.md` | Rails, QPs, algo, channels, NVLS, what not to touch |89| `references/install.md` | NCCL, nccl-tests, perftest, rdma-core, bundled NCCL |90| `references/updating.md` | Version alignment, upgrades, rollback |91| `references/troubleshooting.md` | Symptom to cause to fix |9293Script: `scripts/nccl-net-check.sh` (read-only node check). Template: `templates/nccl.conf`.9495## Companion skills9697Install any with `npx skills add ScaleDockHQ/llm-skills --skill <name>`.9899- `multi-node-inference`: parallelism strategy across nodes.100- `vllm`, `sglang`, `tensorrt-llm`: engines that use NCCL.101- `disaggregated-serving`: KV transfer over RDMA between prefill and decode.102- `choosing-hardware`: NIC and fabric sizing.103- `exo`: Apple RDMA over Thunderbolt, a different stack.