How do I build a multi-GPU rig?

5 min readMarkdown

Plan the power first. Several graphics cards in one tower can draw more than a wall socket safely supplies. Then plan the lanes, the spacing and the airflow, in that order.

A second card gives you more VRAMVRAMMemory on a graphics card. On a PC with a GPU, it is your model budget.Read more. It does not make a model that already fits much faster for one user. Build a rig when the model you want does not fit on one card. How do several GPUs in one box work together? covers how runtimesRuntimeThe software that loads a model file and runs it.Read more split a model across cards.

Power supply and circuits

Add up the board power of every card, then add the rest of the system. Then add headroom, because GPUs spike above their rating for milliseconds at a time.

CardBoard power
RTX 3090350 W
RTX 4090450 W
RTX 5090575 W
PSU size = (sum of GPU board power + CPU power + about 100 W for the rest) × 1.25
 
Two RTX 3090s and a 150 W CPU:
(350 + 350 + 150 + 100) × 1.25 = about 1,190 W  → buy a 1,200 W or larger PSU
Rule of thumb

Size the power supply at about one and a quarter times the total board power. Then check that the wall circuit can carry it.

The circuit is the hard limit.

A standard North American 15 A circuit at 120 V carries 1,800 W, and continuous loads should stay under 80 % of that, about 1,440 W. A European 16 A circuit at 230 V carries about 3,680 W. Anything else on the same circuit, such as a monitor or a heater, comes out of the same budget.

Power-limit the cards. Inference is limited by memory bandwidthMemory bandwidthHow fast data moves out of memory, in GB per second. It sets decode speed.Read more more than clocks, so a card capped well below its rating loses little speed and runs much cooler.

shell
sudo nvidia-smi -pl 280

This caps every NVIDIA card at 280 W until the next reboot. Add -i 0 to pick one card. Run your own prompts before and after to see what it costs you.

The catch

Use one cable per power connector, never a split daisy-chain. High-power cards pull a lot of current through each plug. Seat every connector fully, especially the 16-pin connectors on recent cards.

PCIe lanes, risers and spacing

A consumer desktop CPU has about 20 to 24 lanes for slots and storage. That is enough for one card at x16 or two at x8. Workstation and server platforms such as Threadripper and EPYC have 64 to 128 lanes, enough for four or more cards at full width.

For inference, lane count matters less than you might expect. When the model is split by layers, only small activations cross between cards, and x4 is usually enough. Lanes matter more for tensor parallelismTensor parallelEvery device works on every token. Needs a very fast link.Read more, which exchanges data between cards on every layer, and for loading the model at startup.

Layer split

Each card holds a block of layers, with little traffic between cards. Works over x4 lanes and mixed cards. Speed for one user is about that of a single card.

Tensor parallel

Each layer is split across all cards, with heavy traffic between them. Wants x8 or x16 and matched cards. Faster for one user and for serving many.

Most consumer cards are three slots or thicker, and boards rarely space slots for two of them. Risers solve this by moving the card away from the board, into an open frame or a second mounting bracket.

Buy shielded risers rated for your PCIe generation. A cheap riser causes crashes that look like driver bugs.

If cards are unstable on a riser, set the slot to a lower PCIe generation in the BIOS. You lose little for inference.

Cooling and noise

Two open-air cards stacked next to each other blow hot air into each other. The top card runs hot and throttles. Leave at least one empty slot between them, or use risers to separate them.

Blower-style cards push air out the back of the case and stack better, at the cost of noise. Open frames cool best and look like a mining rig, because that is what they are.

Either way, this machine is loud under load. Put it in another room if you can, and reach it over the network as How do I share one model with my household or office? describes.

Power limits help here too. A card capped at about three quarters of its rating runs much cooler and quieter with a small loss of speed.

Mixed cards

Mixed cards work for layer splitPipeline parallelThe model is cut into consecutive slices across devices. Adds memory, not speed.Read more. llama.cpp and the apps built on it can spread a model over cards of different sizes and generations. You set how much goes on each.

shell
llama-server -m model.gguf -ngl 99 --tensor-split 24,12

This puts about two thirds of the layers on the first card and one third on the second, in proportion to a 24 GB and a 12 GB card. To hide a card from the runtime, set CUDA_VISIBLE_DEVICES to the card numbers you want.

The catch is speed. Each tokenTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more passes through every card in turn, so the slow card's share of layers costs more time than the fast card's.

Keep the fastest card for the largest share. Tensor parallel engines such as vLLM expect matched cards, and two identical cards is the simple path.

Mixing vendors in one process is possible with some backendsBackendThe hardware path an engine uses: Metal, CUDA, Vulkan, ROCm or CPU.Read more and fiddly with all of them. We would not plan a build around it.

Go deeperThat's enough

Why one big card can beat two small ones

Two 24 GB cards hold 48 GB. One 48 GB or 96 GB card holds it with no split, no extra power connectors and one slot. The single card costs more, but the build is simpler and uses less power. Which NVIDIA card should I get? covers the pro cards.

The RTX 3090 was the last consumer card with an NVLink connector. A bridge speeds up traffic between a pair of 3090s for tensor parallel work.

For layer split it makes little difference. Later consumer cards talk over PCIe only. Which cable do I need between machines? covers the options between machines.

Checking every card is used

Run nvidia-smi while the model is writing. Every card should show memory in use and some utilisation. If one sits idle, the runtime did not see it. Why is my GPU not being used? covers the fixes.

When to stop adding cards

Past four cards on a consumer platform, lanes, power and cooling all get hard at once. At that point a workstation board, a server chassis or a second machine is easier. When should I not cluster? and What are the ways to split work across machines? cover the alternatives.