Skip to content
Inference Academy

Lab: tensor parallel versus data parallel on two GPUs

Serve one model on two GPUs two ways (one tensor-parallel copy across both, or two independent replicas), predict the result from the communication cost model, then measure latency and goodput under load and explain the crossover. Includes a topology check, the exact sweep, a results table and how to read it.

By

90 min · verified 2026-11Hands-on labPro
Share

Goal: decide, with measurements, how to use two GPUs for one model that fits on one: as one tensor-parallel copy (TP=2) or as two data-parallel replicas (DP=2). You will predict first, then measure, then explain the gap.

You need: a machine (or rented instance) with two identical NVIDIA GPUs, vLLM or SGLang, a 7 to 8B model in BF16, Python 3.10+, and the loadgen.py open-loop load generator from the baseline-to-3x lab. About 90 minutes.

Honest limits. Engine flag names change between versions; check your engine's documentation. Results depend on your GPUs, interconnect and workload: the point of the lab is the method and the explanation, not a specific number.

#Step 0: check the topology

bash
nvidia-smi topo -m
nvidia-smi nvlink --status    # if the GPUs have NVLink

Write down the link between GPU 0 and GPU 1: NV# (NVLink), PIX/PXB (PCIe switch), PHB (host bridge) or SYS (across CPU sockets). Everything else in this lab depends on it (interconnects).

Pro content

Keep reading with Inference Academy Pro

Unlock this full lab, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.

Still to come in this lab

  1. Step 1: predict
  2. Step 2: run the TP=2 layout
  3. Step 3: run the DP=2 layout
  4. Step 4: fill the table
  5. Step 5: explain
  6. Self-check
  7. Stretch goals

You will be able to answer

  • Before measuring, what does the course predict for an 8B model on two NVLink-connected GPUs?
  • Your two GPUs show SYS in nvidia-smi topo -m. What changes?
  • Why compare goodput rather than peak tokens per second?

Articles that build on this lesson

Preparing for an interview?