GPU Cluster: InfiniBand Architecture
Lessons (7, study in order)
GPU Cluster: InfiniBand
Beginner · about 6 min
Goal: What the cluster network is made of
In a GPU training cluster, servers exchange data at high speed
One large training run uses tens to thousands of GPU servers. After every step the GPUs on different servers synchronize results: a lot of data, no packet loss, low latency.
The network connecting the GPUs is the compute fabric, also called the backend network. Two technologies are common for it: InfiniBand and RoCE (Ethernet). This module covers InfiniBand.
A GPU server connects to four networks
Take NVIDIA's public DGX SuperPOD reference architecture. Each server connects to four separate networks:
· Compute fabric: InfiniBand, 400G, one port per GPU, used when GPUs synchronize data
· Storage fabric: reading training data, writing checkpoints
· In-band management: Ethernet, for job dispatch, logins and image pulls
· Out-of-band management: Ethernet, to the server's BMC port, so a hung server can still be rebooted remotely
The compute fabric is leaf-spine, with uplinks as wide as downlinks
The compute fabric has two switch tiers, leaf and spine. Half of each leaf's ports go to servers and half to spines, so uplink bandwidth equals downlink bandwidth (1:1, also called non-blocking). The uplinks are enough even when every GPU sends at full rate.
In an ordinary data center the leaf uplinks are usually narrower than the downlinks (3:1, say) because servers rarely peak together. GPUs in a training run do.
Rail wiring: port n of every server goes to leaf n
Each server has 8 compute ports, one per GPU. Port 1 of every server goes to leaf 1, port 2 to leaf 2, and so on. One such set of links is a rail.
GPUs on the same rail reach each other through a single leaf. Traffic between rails crosses a spine.
An InfiniBand link does not drop packets because a queue is full
RDMA resends a long run of packets after one loss, so the compute fabric must not drop packets. Every InfiniBand link has built-in credit flow control: the receiver tells the sender how much it can still accept, and the sender transmits only while it has credit and waits when it runs out. A queue is never overrun, so congestion never causes loss.
Ethernet has no such mechanism by default and drops when a queue is full. RoCE needs PFC and ECN configured to become lossless.
Addresses and forwarding tables come from the subnet manager
InfiniBand switches run no routing protocol of their own. The subnet manager (SM) discovers every device and link, assigns an address (LID) to each port, computes each switch's forwarding table and pushes it down.
In SuperPOD the subnet manager runs on UFM appliances. Deployments normally run one master and one standby.
NVIDIA DGX SuperPOD (DGX H100): compute fabric component counts
· Units: 1; Servers: 31; GPU: 248; leaf: 8; spine: 4; Server-leaf cables: 252; Leaf-spine cables: 256
· Units: 2; Servers: 63; GPU: 504; leaf: 16; spine: 8; Server-leaf cables: 508; Leaf-spine cables: 512
· Units: 3; Servers: 95; GPU: 760; leaf: 24; spine: 16; Server-leaf cables: 764; Leaf-spine cables: 768
· Units: 4; Servers: 127; GPU: 1016; leaf: 32; spine: 16; Server-leaf cables: 1020; Leaf-spine cables: 1024
A unit is designed for 32 servers. Each row has one fewer because the ports are given to UFM; the server-leaf cable count includes 4 cables for UFM. The switches are 64-port 400G InfiniBand switches: 32 ports down, 32 up.
Sources
· NVIDIA DGX SuperPOD Reference Architecture (DGX H100): Network Fabrics https://docs.nvidia.com/dgx-superpod/reference-architecture-scalable-infrastructure-h100/latest/network-fabrics.html
· NVIDIA Developer Blog: PXN in NCCL 2.12 https://developer.nvidia.com/blog/doubling-all2all-performance-with-nvidia-collective-communication-library-2-12/
① The four networks of a GPU server
Beginner · about 5 min
Goal: Which network carries this
Which network carries this: GPUs exchange data
Compute fabric (InfiniBand): During training, data between GPUs uses the compute fabric. Each of the 8 GPUs has its own InfiniBand port, and the 8 ports go to 8 different leaves.
This network carries only GPU-to-GPU RDMA traffic and has the most bandwidth.
· Technology: InfiniBand, 400G (NDR)
· Per server: 8 ports, one per GPU
· Switches: two tiers, leaf-spine, uplinks as wide as downlinks
Which network carries this: Read training data, write checkpoints
Storage fabric: Training data is read from storage and model state (checkpoints) is written back over the storage fabric.
In SuperPOD the storage fabric is also InfiniBand, separate from the compute fabric, with its own switches.
· Technology: InfiniBand (in SuperPOD; some clusters use Ethernet)
· Per server: one pair of ports
· Switch model: MQM9700
Which network carries this: Submit jobs, log in, pull images
In-band management (Ethernet): The scheduler dispatching jobs, engineers logging in over SSH and servers pulling container images all use the in-band management network. It is ordinary Ethernet.
· Technology: Ethernet
· Per server: one pair of ports
· Connects to: cluster management, the scheduler, external registries
· Switch model: SN4600C
Which network carries this: A server hangs; reboot it remotely
Out-of-band management (Ethernet): Every server has a BMC port on the out-of-band management network. The BMC is a small independent controller inside the server; it stays up when the operating system hangs, so you can power-cycle the server and read hardware logs remotely.
The management ports of switches, storage and rack power units (PDUs) are on this network too.
· Technology: Ethernet
· Per server: 1 BMC port
· Connects to: the management port of every device
· Switch model: SN2201
Look at a compute port
The 8 compute ports are InfiniBand adapters. ibstat shows a port's state, rate and address (LID). Output is trimmed.
$ ibstat mlx5_0 CA 'mlx5_0' CA type: MT4129 Number of ports: 1 Port 1: State: Active Physical state: LinkUp Rate: 400 Base lid: 35 SM lid: 1 Link layer: InfiniBand
Look at the in-band management ports
In-band management uses Ethernet ports; the ordinary ip command shows them.
$ ip -br addr show lo UNKNOWN 127.0.0.1/8 enp170s0f0np0 UP 10.10.1.21/24 enp170s0f1np1 UP 10.10.2.21/24
Look at the BMC address
The BMC has its own IP address on the out-of-band network.
$ sudo ipmitool lan print 1 IP Address Source : Static Address IP Address : 10.20.1.21 Subnet Mask : 255.255.255.0 MAC Address : 5c:25:73:1a:20:1f Default Gateway IP : 10.20.1.1
② Rail wiring
Beginner · about 5 min
Goal: Which two GPUs talk
Which two GPUs talk: GPU3 on S1 → GPU3 on S4 (same rail)
Same rail: one leaf: Port 3 of both S1 and S4 is on L3. Data leaves GPU3 on S1, crosses L3 and reaches GPU3 on S4 without touching a spine.
Port 3 of all 32 servers in the unit is on L3, so all of them reach each other this way.
· Switches crossed: 1 (L3)
· Via a spine: No
Which two GPUs talk: GPU3 on S1 → GPU6 on S4 (different rails)
Different rails: leaf → spine → leaf: GPU3 on S1 is on L3 and GPU6 on S4 is on L6. Leaves are not connected to each other, so the data crosses a spine: L3 → SP2 → L6.
Which spine is used is set by the forwarding tables the subnet manager computed.
· Switches crossed: 3 (L3, SP2, L6)
· Via a spine: Yes
Which two GPUs talk: GPU3 on S1 → GPU6 on S4 (switch ports inside the server first)
1. Inside the server: GPU3 hands the data to GPU6: The 8 GPUs inside one server are directly connected by NVLink. GPU3 first passes the data to GPU6 in the same server over NVLink.
2. Out through port 6: one leaf: The data leaves through port 6 of S1, crosses L6 and reaches GPU6 on S4: one switch, no spine.
The training communication library NCCL added this in version 2.12 and calls it PXN.
· Switches crossed: 1 (L6)
· Inside the server: NVLink: GPU3 → GPU6
· Via a spine: No
Cabling plan (the 4 servers drawn)
Port n of each server goes to leaf n; server Sm lands on port m of each leaf.
server port(adapter) switch port S1 1 (mlx5_0) -> L1 1 S1 2 (mlx5_1) -> L2 1 S1 3 (mlx5_2) -> L3 1 S1 4 (mlx5_3) -> L4 1 S1 5 (mlx5_4) -> L5 1 S1 6 (mlx5_5) -> L6 1 S1 7 (mlx5_6) -> L7 1 S1 8 (mlx5_7) -> L8 1 S2 1 (mlx5_0) -> L1 2 S2 2 (mlx5_1) -> L2 2 S2 3 (mlx5_2) -> L3 2 S2 4 (mlx5_3) -> L4 2 S2 5 (mlx5_4) -> L5 2 S2 6 (mlx5_5) -> L6 2 S2 7 (mlx5_6) -> L7 2 S2 8 (mlx5_7) -> L8 2 S3 1 (mlx5_0) -> L1 3 S3 2 (mlx5_1) -> L2 3 S3 3 (mlx5_2) -> L3 3 S3 4 (mlx5_3) -> L4 3 S3 5 (mlx5_4) -> L5 3 S3 6 (mlx5_5) -> L6 3 S3 7 (mlx5_6) -> L7 3 S3 8 (mlx5_7) -> L8 3 S4 1 (mlx5_0) -> L1 4 S4 2 (mlx5_1) -> L2 4 S4 3 (mlx5_2) -> L3 4 S4 4 (mlx5_3) -> L4 4 S4 5 (mlx5_4) -> L5 4 S4 6 (mlx5_5) -> L6 4 S4 7 (mlx5_6) -> L7 4 S4 8 (mlx5_7) -> L8 4
Check from the switch side
ibnetdiscover lists what is at the far end of every switch port. Every port of L3 should hold adapter 3 (mlx5_2, counting from 0) of some server. Output is trimmed.
$ ibnetdiscover Switch 65 "S-b83fd20300a1c2e3" # "MF0;L3:MQM9700/U1" enhanced port 0 lid 23 lmc 0 [1] "H-b8cef60300fa0103"[1](b8cef60300fa0103) # "s1 mlx5_2" lid 35 4xNDR [2] "H-b8cef60300fa0203"[1](b8cef60300fa0203) # "s2 mlx5_2" lid 43 4xNDR [3] "H-b8cef60300fa0303"[1](b8cef60300fa0303) # "s3 mlx5_2" lid 51 4xNDR [4] "H-b8cef60300fa0403"[1](b8cef60300fa0403) # "s4 mlx5_2" lid 59 4xNDR
Advanced ① Fail a device
Advanced · about 5 min
Goal: What fails
What fails: All healthy
All healthy: All 32 ports of the 4 servers are up. Each leaf connects to 4 spines with 8 links each: 32 uplinks.
· Ports up: 8 / 8 per server
· Uplinks per leaf: 32
What fails: Leaf L3
L3 fails: rail 3 goes down: When L3 fails, every port connected to it goes down: port 3 of all 32 servers in the unit.
Training jobs using those ports fail. Until L3 is repaired, each server in the unit has only 7 GPUs available for multi-node training.
· Ports down: 1 per server (port 3), 32 in the unit
· The other 7 rails: Unaffected
· Compared with per-rack wiring: One leaf takes all 32 ports of 4 servers. Losing a leaf cuts those 4 servers off completely and leaves the others untouched.
What fails: Spine SP2
SP2 fails: a quarter of the uplinks are gone: With SP2 down, each leaf loses 8 of its 32 uplinks and keeps 24.
Traffic inside one rail never crosses a spine and is unaffected. Traffic between rails and between units moves to the other 3 spines once the subnet manager recomputes the forwarding tables.
· Ports down: 0
· Uplinks per leaf: 32 → 24 (75% left)
· Traffic inside a rail: Unaffected
What fails: The cable on port 5 of S2
One cable fails: one port is affected: The cable from port 5 of S2 to L5 fails. Only GPU5 on S2 loses the network; the other 7 ports of S2 and all other servers are fine.
· Ports down: 1
· How to spot it: Run ibstat on S2; the port shows State: Down
What a server shows when its leaf is down
With L3 down, adapter 3 (mlx5_2) of every server looks like this.
$ ibstat mlx5_2 CA 'mlx5_2' Port 1: State: Down Physical state: Polling Rate: 10 Base lid: 0 SM lid: 0 Link layer: InfiniBand
List the switches still present
ibswitches lists the switches the subnet manager can see. The missing one is the one that is gone. Output is trimmed.
$ ibswitches Switch : 0xb83fd20300a1c2e1 ports 65 "MF0;L1:MQM9700/U1" enhanced port 0 lid 21 lmc 0 Switch : 0xb83fd20300a1c2e2 ports 65 "MF0;L2:MQM9700/U1" enhanced port 0 lid 22 lmc 0 Switch : 0xb83fd20300a1c2e4 ports 65 "MF0;L4:MQM9700/U1" enhanced port 0 lid 24 lmc 0 ...
Advanced ② The subnet manager stops
Advanced · about 5 min
Goal: Subnet manager state
Subnet manager state: Master and standby both up
One master, one standby: Two subnet managers are online. The one with the higher priority is the master and the other the standby. The master discovers devices, assigns addresses (LIDs) and pushes forwarding tables; the standby only listens.
· Master: UFM-1 (priority 15)
· Standby: UFM-2 (priority 14)
· Check with: sminfo
Subnet manager state: The master stops
1. UFM-1 stops: The master subnet manager stops. The forwarding tables already in the switches stay as they are and traffic keeps flowing.
2. UFM-2 becomes master: The standby notices the master no longer answers and promotes itself. It takes over discovery, LID assignment and forwarding-table updates. Existing connections are not interrupted.
· Traffic: Not interrupted
· New master: UFM-2
· Next: Repair UFM-1 and let it rejoin as standby
Subnet manager state: Both stop
1. Existing traffic keeps running: Both subnet managers are down. Switches keep forwarding with the tables they already have, and established connections are unaffected.
2. A new server cannot join: S4 comes online with all cables connected. No subnet manager assigns LIDs to its ports, so they stay in the Initializing state and cannot send or receive.
3. Nobody handles link changes: If a switch fails now, nobody recomputes the forwarding tables, and traffic that went through it stays broken.
· Existing connections: Keep running
· New ports: Stuck in Initializing, no LID
· Link failures: Not routed around
OpenSM master / standby configuration
SuperPOD runs the subnet manager on UFM appliances. Self-built clusters often use the open-source OpenSM, configured in /etc/opensm/opensm.conf. The higher sm_priority becomes master; routing_engine selects the routing algorithm, ftree for fat trees.
# master sm_priority 15 routing_engine ftree,updn # standby sm_priority 14 routing_engine ftree,updn
See who is master
Run it again after the master stops and it shows the standby's LID and priority with state SMINFO_MASTER.
$ sminfo sminfo: sm lid 1 sm guid 0xb8cef60300a10001, activity count 1845210 priority 15 state 3 SMINFO_MASTER
A newly connected port when no subnet manager is running
The physical link is up, but there is no LID and the state stays Initializing.
$ ibstat mlx5_0 CA 'mlx5_0' Port 1: State: Initializing Physical state: LinkUp Rate: 400 Base lid: 0 SM lid: 0 Link layer: InfiniBand
Advanced ③ A miswired cable
Advanced · about 5 min
Goal: Ports 3 and 4 of S2
Ports 3 and 4 of S2: Wired as planned
Wired correctly: Port 3 of S2 goes to L3 and port 4 to L4. GPU3 on S1 reaches GPU3 on S2 through L3 only.
· GPU3 on S1 → GPU3 on S2: 1 switch
Ports 3 and 4 of S2: The two cables are swapped
1. The two cables are swapped: Port 3 of S2 is plugged into L4 and port 4 into L3. Both ports come up normally; the subnet manager assigns addresses and computes routes from the actual cabling and reports no error.
2. Same-rail traffic detours through a spine: GPU3 on S1 sends to GPU3 on S2: the S1 side is on L3 but the S2 side is really on L4, so the path is L3 → SP1 → L4.
One switch became three, and spine bandwidth is used. Training still runs, only slower, and the cause is hard to see.
3. How to find it: Export the actual cabling with ibnetdiscover and compare it line by line with the cabling plan: every port of L3 should hold adapter 3 of some server, so an adapter 4 there is a swap. Swap the two cables back.
Every link is checked this way before a new cluster goes into service.
· Connectivity: Works
· GPU3 on S1 → GPU3 on S2: 3 switches (should be 1)
· How to check: Compare ibnetdiscover output with the cabling plan; UFM and ibdiagnet can do the comparison too
Export the actual cabling
Port 2 of L3 should face s2 mlx5_2 but shows s2 mlx5_3: ports 3 and 4 of S2 are swapped. Output is trimmed.
$ ibnetdiscover Switch 65 "S-b83fd20300a1c2e3" # "MF0;L3:MQM9700/U1" enhanced port 0 lid 23 lmc 0 [1] "H-b8cef60300fa0103"[1](b8cef60300fa0103) # "s1 mlx5_2" lid 35 4xNDR [2] "H-b8cef60300fa0204"[1](b8cef60300fa0204) # "s2 mlx5_3" lid 44 4xNDR [3] "H-b8cef60300fa0303"[1](b8cef60300fa0303) # "s3 mlx5_2" lid 51 4xNDR
What the cabling plan says for L3
Compare against this, line by line.
L3 1 <- S1 mlx5_2 L3 2 <- S2 mlx5_2 L3 3 <- S3 mlx5_2 L3 4 <- S4 mlx5_2
Sizing the fabric
Advanced · about 5 min
Goal: From a server count to leaf, spine, core and cable counts
Assumptions
· 8 GPUs and 8 compute ports per server
· 64-port switches
· Uplinks as wide as downlinks (1:1)
32 servers
· Compute ports: 32 servers × 8 = 256
· Leaves: 64 ports each, 32 to servers and 32 upward. 256 ÷ 32 = 8
· Spines: the leaves have 8 × 32 = 256 uplinks and one spine takes 64. 256 ÷ 64 = 4
· Cables: 256 server-leaf, 256 leaf-spine
64 servers
· Compute ports: 64 servers × 8 = 512
· Leaves: 64 ports each, 32 to servers and 32 upward. 512 ÷ 32 = 16
· Spines: the leaves have 16 × 32 = 512 uplinks and one spine takes 64. 512 ÷ 64 = 8
· Cables: 512 server-leaf, 512 leaf-spine
128 servers
· Compute ports: 128 servers × 8 = 1024
· Leaves: 64 ports each, 32 to servers and 32 upward. 1024 ÷ 32 = 32
· Spines: the leaves have 32 × 32 = 1024 uplinks and one spine takes 64. 1024 ÷ 64 = 16
· Cables: 1024 server-leaf, 1024 leaf-spine
256 servers
· Compute ports: 256 servers × 8 = 2048
· Leaves: 64 ports each, 32 to servers and 32 upward. 2048 ÷ 32 = 64
· Spines: the leaves have 64 × 32 = 2048 uplinks and one spine takes 64. 2048 ÷ 64 = 32
· Cables: 2048 server-leaf, 2048 leaf-spine
512 servers
· Compute ports: 512 servers × 8 = 4096
· Leaves: 64 ports each, 32 to servers and 32 upward. 4096 ÷ 32 = 128
· More than 64 leaves do not fit in two tiers: a spine has only 64 ports and can reach at most 64 leaves. A core tier is added.
· Spines: half the ports to leaves and half to cores, 32 leaf uplinks each. 4096 ÷ 32 = 128
· Cores: the spines have 128 × 32 = 4096 uplinks and one core takes 64. 4096 ÷ 64 = 64
· Cables: 4096 each for server-leaf, leaf-spine and spine-core
1024 servers
· Compute ports: 1024 servers × 8 = 8192
· Leaves: 64 ports each, 32 to servers and 32 upward. 8192 ÷ 32 = 256
· More than 64 leaves do not fit in two tiers: a spine has only 64 ports and can reach at most 64 leaves. A core tier is added.
· Spines: half the ports to leaves and half to cores, 32 leaf uplinks each. 8192 ÷ 32 = 256
· Cores: the spines have 256 × 32 = 8192 uplinks and one core takes 64. 8192 ÷ 64 = 128
· Cables: 8192 each for server-leaf, leaf-spine and spine-core
Checked against published numbers
The results for these 6 sizes match the counts published in the NVIDIA DGX SuperPOD reference architecture (1, 2, 4, 8, 16 and 32 units).