Skip to content
Inference Academy

Lab: scale one model across 1, 2, 4 and 8 GPUs, with NUMA pinning and storage checked

A multi-GPU node lab. Map the node's topology (which GPUs, NICs and drives sit on which CPU socket), measure what NUMA placement does to host-to-GPU copies and to vLLM, measure how fast weights get from storage to GPU memory (including GPUDirect Storage with NVIDIA's tools), then serve one model with tensor parallelism 1, 2, 4 and 8 and with data-parallel layouts, predict each result from a bandwidth and all-reduce model, and explain where scaling efficiency goes.

By

Key takeaways

  • Before any multi-GPU benchmark, map the node: which GPUs share NVLink or a PCIe switch, and which CPU socket (NUMA node) each GPU, NIC and drive hangs off.
  • Host work for a GPU should run on its own NUMA node. Copies from memory on the other socket cross the inter-socket link; vLLM v0.34 binds workers to their GPU's NUMA node automatically when it can.
  • Tensor parallelism divides the weight reads but adds two all-reduces per layer. At batch 1 their fixed latency dominates, so efficiency falls as TP grows even on NVLink.
  • For throughput, several smaller replicas (data parallelism) often beat one wide tensor-parallel copy; for latency or for models that do not fit, tensor parallelism wins.
  • Startup and scale-out time is a storage problem: measure how fast weights reach GPU memory, from a warm and a cold page cache.
150 min · verified 2026-112 animated diagramsHands-on labPro
Share

Goal: know your multi-GPU node, from storage to NVLink, and explain with numbers how one model's latency and throughput change from 1 to 8 GPUs.

You need:

  • One node with 8 NVIDIA GPUs connected by NVLink (for example 8 × H100 SXM or 8 × A100 SXM), rented by the hour, and root access for the NUMA and storage steps. A PCIe-only node also works and makes the scaling steps more interesting.
  • vLLM v0.34.0, nccl-tests (all_reduce_perf), numactl, and optionally NVIDIA's GDS tools (gdscheck, gdsio).
  • The model Qwen/Qwen2.5-14B-Instruct (Apache 2.0, no sign-in): 48 layers, hidden size 5,120, 40 attention heads and 8 KV heads in its config.json, so tensor parallelism 1, 2, 4 and 8 all divide its heads. About 29.5 GB in bf16, so it also fits on one 80 GB GPU.
  • The helper benchmarking/scaling_report.py from the companion repository.
  • Background: multi-GPU interconnects, model parallelism and the two-GPU tensor versus data parallel lab.

Honest limits. We checked every vLLM flag, log line and result field against v0.34.0's source, and the model's shape against its published config.json. The prediction helper is tested, and its output below comes from running it. We have not run the lab on an 8-GPU node, so the measurements are yours to make, and the prediction's defaults (bandwidths, all-reduce latency, utilisation) are assumptions you replace with your own measurements. Eight-GPU nodes are expensive: script every step and test the scripts on one GPU first.

#Step 1: map the node

bash
nvidia-smi topo -m          # GPU-GPU links, plus CPU and NUMA affinity per GPU
numactl -H                  # NUMA nodes, their CPUs and memory
lscpu | grep -i numa
lsblk -o NAME,SIZE,MODEL,TRAN; cat /sys/block/nvme0n1/device/numa_node   # which socket each NVMe drive is on

Fill in a table:

GPU NUMA node CPU cores (from topo -m) Links to other GPUs Nearest NIC Nearest NVMe
0
...

In nvidia-smi topo -m, NV# means NVLink (with # links), PIX and PXB go through PCIe switches, NODE crosses PCIe host bridges within one socket, and SYS crosses the link between sockets. On a typical 8-GPU SXM node, all GPUs connect through NVSwitch, GPUs 0 to 3 sit on one socket and 4 to 7 on the other; check yours.

#Step 2: NUMA placement and CPU pinning

#Host-to-GPU copies

A minimal copy test from pinned host memory to GPU 0:

python
import torch, time
x = torch.empty(1 << 30, dtype=torch.uint8).pin_memory()     # 1 GiB, pinned
y = torch.empty_like(x, device="cuda:0")
for _ in range(3): y.copy_(x, non_blocking=True)
torch.cuda.synchronize(); t = time.perf_counter()
for _ in range(10): y.copy_(x, non_blocking=True)
torch.cuda.synchronize(); print(f"{10 * x.numel() / (time.perf_counter() - t) / 1e9:.1f} GB/s")

Run it twice, with the process and its memory on GPU 0's NUMA node and then on the other one:

bash
numactl --cpunodebind=0 --membind=0 python3 h2d.py
numactl --cpunodebind=1 --membind=1 python3 h2d.py

Predict first: the remote run crosses the inter-socket link. How much it loses depends on the platform; write down what you measured, and repeat with pageable memory (remove .pin_memory()) to see why engines pin their buffers.

#vLLM's NUMA binding

At v0.34.0, vLLM binds each GPU worker to its GPU's NUMA node automatically when the environment supports it (several NUMA nodes, numactl installed, unrestricted CPU affinity, and the spawn start method), preferring local memory. --numa-bind makes it strict, --no-numa-bind turns it off, and --numa-bind-nodes sets the mapping by hand. Containers often restrict CPU affinity, in which case the automatic mode starts unbound, so check the startup log.

Measure the effect where host work matters most, at small batches: serve the model with TP 1 on GPU 0, once with --no-numa-bind under numactl --cpunodebind=1 --membind=1 (the wrong socket) and once with the default, and compare TPOT at --max-concurrency 1. A small or zero difference is a valid result: say so.

The rest is Pro

Keep reading this full lab

Pro unlocks this full lab, including 2 animated diagrams, every advanced lesson, the hands-on labs and completion certificates.

One year

$25

365 days, no auto-renewal

Lifetime Best value

$75

pay once, keep it forever

7-day refund, no questions asked. One payment, no auto-renewal.Compare plansHave a licence key?

Sandip MaityBuilt by Sandip Maity, who runs self-hosted LLM inference in production.

Not ready? Keep learning free

Free lessons from Bottlenecks and Hardware, no sign-up. Or follow the free roadmap →

Not ready? Take the free 5-day email course

One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.

Still to come in this lab

  1. Step 3: from storage to GPU memory
  2. Step 4: predict the scaling curve
  3. Step 5: measure
  4. Step 6: explain
  5. Rubric
  6. Checklist
  7. Going deeper

You will be able to answer

  • nvidia-smi topo -m shows GPU 0 with NUMA affinity 0. A process feeding GPU 0 runs with numactl --cpunodebind=1 --membind=1. What happens to its host-to-GPU copies?
  • The model predicts a TP8 decode step at batch 1 spends about as long in all-reduces as in reading weights. What dominates those all-reduces?
  • On 8 GPUs, TP8 gives the lowest latency but DP8 (eight single-GPU replicas) gives more total throughput. Why?
  • Loading weights takes 9 s the second time but 95 s right after a reboot. What explains the difference?

Articles that build on this lesson