Curriculum / Part 5 · The GPU data path: RDMA and GPUDirect
Lesson 25

NUMA and PCIe topology

NUMA nodes and PCIe topology: reading nvidia-smi topo -m, finding where NVMe and NICs sit, and pinning work so data doesn't cross sockets.

⏱ 35 min5-question quizLab 5.2

The simple version

A big office has two buildings joined by a bridge. If your printer is in the other building, every page walks across the bridge. NUMA is the two buildings; keeping GPUs, NICs and drives on the same side keeps traffic off the bridge.

NUMA and PCIe

On a two-socket server, each CPU has its own memory and its own PCIe root ports. A device on socket 0 reaching memory or a device on socket 1 must cross the inter-socket link (UPI, Infinity Fabric, …). PCIe switches inside the server can connect GPUs, NICs and drives under the same switch so peer-to-peer traffic never touches a CPU.

Reading nvidia-smi topo -m

CodeMeaning (from the nvidia-smi legend)Good for P2P?
NV#A bonded set of # NVLinksBest (GPU↔GPU)
PIXAt most a single PCIe bridgeBest PCIe case
PXBMultiple PCIe bridges, not via the host bridgeGood
PHBThrough a PCIe host bridge (typically the CPU)Fair
NODEBetween PCIe host bridges within one NUMA nodeFair
SYSAcross the SMP interconnect between NUMA nodesWorst

The matrix also shows each GPU's CPU and NUMA affinity. NVMe drives aren't in the default matrix; find their node in sysfs.

Finding and fixing placement

$ cat /sys/class/nvme/nvme0/device/numa_node
$ cat /sys/class/infiniband/mlx5_8/device/numa_node
$ lstopo                          # hwloc: draw the whole topology
$ numactl --hardware
$ numactl --cpunodebind=1 --membind=1 python serve.py   # keep a process on node 1

Put a GPU's data on a drive (and use a NIC) on the same NUMA node, and pin its loader processes to that node's CPUs and memory.

Tools

nvidia-smi topo -m
GPU/NIC connectivity matrix with CPU and NUMA affinity.
cat /sys/class/nvme/nvmeX/device/numa_node
Which NUMA node a drive hangs off.
lstopo / numactl --hardware
Whole-system topology and NUMA layout.
numactl --cpunodebind=N --membind=N
Run a process on one NUMA node.

Quiz

Lab

Lab 5.2 · The far-socket GPU

An inference worker pinned to GPU 4 loads its model with GPUDirect Storage from /scratch at about 3.6 GiB/s, while the same load on GPU 0 does about 6.5 GiB/s.

Start lab 5.2 →

Try it now in the simulator (opens with the command ready; press Enter):

$ nvidia-smi topo -m$ cat /sys/class/nvme/nvme0/device/numa_node$ cat /sys/class/nvme/nvme2/device/numa_node