Skip to content

Linking GPUs

Note

In one minute

  • When a model does not fit in one GPU, it is split over several, and the GPUs exchange data constantly.
  • Inside a server, GPUs talk over PCIe or, much faster, NVLink. Between servers, over a fast network with RDMA (InfiniBand or RoCE).
  • Serving a model that fits in one server rarely needs the network. Training across servers depends on it.

Before you start. How much memory a model needs. This page is background, except the figures marked DOC.

Splitting a model

Way to split What each GPU holds Traffic between GPUs
Tensor parallelism A slice of every layer At every layer of every token: heavy, needs the fastest links
Pipeline parallelism Whole layers, a group each Between groups only: lighter, adds waiting
Data parallelism (training) A full copy of the model, different data At every training step, to combine results

Serving a 70B model on two or four GPUs of one server usually uses tensor parallelism, which is why those GPUs should be linked by the fastest path available.

  • PCIe is the general bus of the server: GPUs, network cards and disks all hang on it. On an H100, PCIe Gen5 is given at 128 GB/s DOC (NVIDIA H100).
  • NVLink is NVIDIA's direct link between GPUs, much faster: 900 GB/s for an H100 SXM, 600 GB/s for an H100 NVL DOC (NVIDIA H100). Servers built for training connect their eight GPUs through NVLink switches so that every GPU reaches every other at full speed.

For a virtual machine this matters: giving a VM two GPUs that are linked by NVLink is not the same as giving it two GPUs that only share PCIe. Which GPUs a VM gets is a scheduling question (step 3).

Between servers: RDMA networks

Training across servers moves large amounts of data between GPUs of different machines. Two technologies are common:

  • InfiniBand: a dedicated network with its own switches, built for low latency and RDMA.
  • RoCE (RDMA over Converged Ethernet): RDMA over an Ethernet network, which then needs careful configuration to avoid losing packets.

RDMA (remote direct memory access) lets a network card read or write the memory of another machine without going through either CPU. With GPUDirect RDMA, the network card reads and writes GPU memory directly. For a VM, the network card must then be given to the VM itself, usually as an SR-IOV virtual function (step 4).

When the network matters

Workload Network between servers
Serving a model that fits in one server Ordinary network for user requests
Serving a model larger than one server Fast RDMA network between the servers that hold it
Fine-tuning with LoRA Usually none
Training or full fine-tuning across servers Critical: often as many fast network ports as GPUs

Common mistakes

  • "Four GPUs in a VM give four times the speed." Only if the model is split well and the GPUs are linked fast. Over a slow path, adding GPUs can make serving slower.
  • "A 100 Gb/s network is fast." 100 Gb/s is 12.5 GB/s, about a tenth of one PCIe Gen5 GPU link. Training clusters use several 400 Gb/s ports per server.
  • "RDMA works through any virtual network." RDMA needs the network card in the guest (passthrough or SR-IOV); an overlay network built in software does not carry it.

Check yourself

Which way of splitting a model needs the fastest links, and why?

Tensor parallelism: every layer is split across GPUs, so they exchange data at every layer of every token.

A 70B model fits in the four GPUs of one server. Do you need InfiniBand to serve it?

No. The traffic stays inside the server. A fast link between those four GPUs (NVLink) matters; the network between servers does not.

What must a VM have to use RDMA?

The network card itself, usually an SR-IOV virtual function given to the VM, not a port of a software virtual network.

Go further