Dual-Node 16-GPU Training Link Verification: From Checks to Stable Training
This article is designed for AI cluster operations and training engineers. By following the steps provided, readers can verify high-speed network performance, ensure correct parallelism splitting, confirm that training computations match single-node results, and utilize monitoring to troubleshoot common faults. Note that all IPs, network interface names, device names, and paths in this article are examples and should be replaced with actual environment values before execution.
This article assumes a cluster composed of two servers, each equipped with 8 accelerators of the same model, interconnected via RoCEv2 or InfiniBand. After changes to drivers, CUDA, NCCL, operating systems, or switch firmware, the bandwidth reference values and configuration items in this article must be re-evaluated.
Before starting the verification, record the following version information for troubleshooting purposes:
- Accelerator driver and firmware versions
- CUDA and NCCL versions
- Operating system kernel version
- Switch system version (for RoCE environments)
- Training framework version
1. Topology and Bandwidth Checks
Step 1: Verify intra-node topology. Execute the vendor-specific topology query command on both machines. Using an NVIDIA environment as an example:
nvidia-smi topo -m
In the output, the connection type between cards should match the design. If communication between two cards requires crossing the inter-CPU link, cross-card communication will be slower, requiring adjustments to card allocation or parallelism strategy.
Step 2: Verify that cross-node communication uses the high-speed network interface.
ibstat # InfiniBand: Port state should be Active, and rate should match designibv_devinfo # Check link layer type and rate of the portsip -br addr # Confirm IP addresses of management and high-speed interfacesshow_gids # RoCE: View GID index; RoCEv2 typically uses the IPv4-mapped GID
Step 3: Single-link bandwidth test. Test a single link first to separate network interface issues from collective communication issues.
# Node A: Start the serverib_write_bw -d mlx5_0 -x 3 -s 8388608 -n 5000 --report_gbits# Node B: Start the client, pointing to Node A's high-speed interface IPib_write_bw -d mlx5_0 -x 3 -s 8388608 -n 5000 --report_gbits <Node_A_High_Speed_IP>
Step 4: Collective communication bandwidth test. Use the nccl-tests provided by NCCL to execute all_reduce between the two machines. The message size grows from 1MB to 1GB, doubling each time. This test consumes significant bandwidth and should be executed during a maintenance window, not while production tasks are running.
mpirun -np 16 -H <Node_A>:8,<Node_B>:8 \-x NCCL_SOCKET_IFNAME=<OOB_NIC_Name> \./all_reduce_perf -b 1M -e 1G -f 2 -g 1 -w 5 -n 20
Here, -w is the number of warmup iterations, and -n is the number of iterations for each message size.
Bandwidth Metrics
The tool will output two metrics:
- algbw (Algorithm Bandwidth): Data volume divided by time consumed, reflecting the speed seen by the application layer.
- busbw (Bus Bandwidth): For all_reduce, busbw = algbw × 2(n−1)/n, where n is the number of ranks participating in the communication. When n=16, the coefficient is 1.875. busbw reflects the actual utilization of the link; use this metric to determine if the network meets the standard.
When converting to per-NIC bandwidth, first confirm whether the tool output is per-rank or per-node.
- When each rank exclusively occupies one NIC, the per-rank busbw is the per-NIC result.
- When the output is per-node, the per-NIC result equals the per-node busbw divided by the number of participating NICs.
- When multiple ranks share one NIC, the per-NIC result equals the per-rank busbw multiplied by the number of ranks per NIC.
You can cross-verify using NIC counters. Read the transmit counter before and after the test; the difference divided by the duration is the actual NIC transmission rate. The unit of this counter is 4 bytes.
cat /sys/class/infiniband/mlx5_0/ports/1/counters/port_xmit_data
Recommended test parameters are as follows:
| Item | Recommended Setting | Description |
|---|---|---|
| Message size | 1MB to 1GB, doubling each time | Covers small and large messages |
| Warmup iterations | 5 | Eliminates initial connection overhead |
| Repetitions | At least 3 times per message size, take the median | Reduces the impact of jitter |
| Evaluation message | 256MB and above | Large messages better approximate stable bandwidth |
| busbw threshold | 70% to 80% of NIC nominal rate | Empirical value, refer to vendor benchmarks |
If results are low, investigate in the following order:
- Whether the NIC is operating in the expected mode, whether the port is Active, and whether the rate is correct.
- Whether the MTU is correct. In RoCE environments, the high-speed interface MTU should be set to 9000, and the switch side must also support it. In IB environments, the MTU is determined by the Subnet Manager; do not directly modify the IB NIC MTU.
ip link show <High_Speed_NIC_Name> | grep mtu
- Whether PFC and ECN are configured on both the switch and NIC sides simultaneously, and whether the settings on both sides are consistent.
2. Parallelism Splitting and Launch Parameters
A common 16-GPU splitting strategy is Tensor Parallelism (TP) within the node, Data Parallelism (DP) across nodes, and Pipeline Parallelism (PP) set to 1. The splitting formula is as follows:
T × P × D = 8 × 1 × 2 = 16
Rank mapping rules:
- Node ID equals the integer division of the global rank by 8.
- Intra-node card ID equals the global rank modulo 8.
- The TP group consists of the 8 cards within the same node.
- The DP group consists of two cards with the same card ID across the two nodes, totaling 8 groups.
Tensor parallelism is completed within the node using intra-node interconnects. The data parallel reduction of gradients crosses nodes via the high-speed network. If the intra-node interconnect is not fully connected, TP should be set to the number of cards that can achieve high-speed interconnects. If a single card cannot hold a model replica, adjust P or T. This article’s example does not make this assumption.
Launch the configuration on both machines, setting node_rank to 0 and 1 respectively:
export NCCL_SOCKET_IFNAME=<OOB_Control_NIC_Name>export NCCL_IB_HCA=<List_of_High_Speed_NICs_for_Communication, e.g., mlx5_0,mlx5_1>export NCCL_IB_GID_INDEX=3 # Used for RoCEv2, based on show_gids resultsexport NCCL_DEBUG=INFO # Enable only during verification; disable when stabletorchrun --nnodes=2 --nproc_per_node=8 --node_rank=<0_or_1> \--master_addr=<Node_A_High_Speed_IP> --master_port=29500 \train.py --tp-size 8 --pp-size 1 --global-batch-size 64
Here, --master_addr should use the high-speed network IP, not the management interface IP. The parameter names in the training script should be based on the actual code.
