Skip to content
,

Ollama Multi-GPU Guide (2026): Split Models, Pick GPUs, One Model per Card

8–12 minutes
Woman by a PC with two graphics cards holding a tablet with a MULTI GPU card, hook 2 GPUs one big model

Have two GPUs in your PC and wondering whether Ollama is using both? Maybe a 32B model barely fits on one card, or you want one model on each GPU.

Ollama handles multiple GPUs on its own, but it has rules about when it splits a model and when it doesn’t, and knowing them saves a lot of guessing.

This guide explains how Ollama places models on multiple GPUs. It shows how to pick which GPUs it uses, how to force a split across all cards, how to run one model per GPU, and how to check what is actually happening.

TL;DR

  • Automatic: if a model fits on one GPU, Ollama puts it on one GPU. If it doesn’t fit, Ollama spreads it across all of them.
  • Always split: set OLLAMA_SCHED_SPREAD=1.
  • Pick GPUs (NVIDIA): CUDA_VISIBLE_DEVICES with GPU UUIDs from nvidia-smi -L. AMD uses ROCR_VISIBLE_DEVICES.
  • One model per GPU: run two Ollama servers on different ports, each limited to one GPU.
  • Check: ollama ps, nvidia-smi and the “inference compute” lines in the server log.

New to Ollama? My Ollama guide covers install, models, commands and fixes in one place.

How Ollama Uses Multiple GPUs

When a model loads, Ollama compares the VRAM it needs with the free VRAM on each GPU. Ollama’s FAQ describes two cases:

  • The model fits on one GPU: Ollama loads it on that single GPU. This is usually fastest, because less data has to cross the PCIe bus while the model generates text.
  • The model does not fit on any single GPU: Ollama spreads the model across all available GPUs.

So with two cards, a small model often runs on only one of them, and the second one sits idle. That is normal, not a bug. The second GPU still helps: it can hold a second model at the same time, and Ollama’s default for OLLAMA_MAX_LOADED_MODELS is 3 times the number of GPUs.

The “VRAM it needs” includes the model weights and the context (KV cache). A bigger context can push a model that “should” fit on one card onto two cards, or partly onto the CPU. See my Ollama context length guide for how context size changes memory use.

Does a Second GPU Make Ollama Faster?

Usually not for a model that already fits on one card. Splitting a model across GPUs mainly lets you run bigger models fully in VRAM. When the layers sit on two cards, the GPUs mostly take turns rather than working on the same token together, and some data has to move between them.

Where a second GPU makes a big difference:

  • A model that is too big for one card. Without the second GPU, part of it would spill to system RAM and run on the CPU, which is many times slower. Two GPUs keep it 100% on the GPU.
  • Running two models at once, for example a chat model and an embedding model, or two different users’ models.
  • Longer context for a model that only just fits on one card.

If you need true parallel serving for many users, a server like vLLM with tensor parallelism is built for that. My vLLM vs llama.cpp vs Ollama comparison covers when to switch.

Check Which GPUs Ollama Sees

Start with what the hardware reports:

nvidia-smi -L
# GPU 0: NVIDIA GeForce RTX ... (UUID: GPU-1a2b3c4d-...)
# GPU 1: NVIDIA GeForce RTX ... (UUID: GPU-5e6f7a8b-...)

Then check Ollama’s own view. When the server starts, it logs the GPUs it found. Search the log for inference compute: you should see one line per GPU with its name and VRAM. My Ollama logs guide shows where the log is on each OS.

Load a model and look at the split:

ollama run qwen3:32b "hi"
ollama ps
nvidia-smi

ollama ps shows the PROCESSOR column: 100% GPU means all of the model is in VRAM. nvidia-smi shows how much memory the ollama process uses on each card, which tells you whether it was split.

Choose Which GPUs Ollama Uses

To limit Ollama to some of your GPUs, use the vendor’s visibility variable before the server starts.

GPU type Variable Find the IDs with
NVIDIA CUDA_VISIBLE_DEVICES nvidia-smi -L
AMD (ROCm) ROCR_VISIBLE_DEVICES (UUID or number), HIP_VISIBLE_DEVICES (number) rocminfo
Vulkan GGML_VK_VISIBLE_DEVICES (number) Server log at start-up

Examples:

# use only the second NVIDIA GPU
CUDA_VISIBLE_DEVICES=1

# safer: use the UUID, because numeric order can change
CUDA_VISIBLE_DEVICES=GPU-5e6f7a8b-...

# force CPU only (an invalid ID hides all GPUs)
CUDA_VISIBLE_DEVICES=-1

Ollama’s GPU docs point out that numeric IDs can be ordered differently from what you expect, so UUIDs are more reliable. This matters most when the two GPUs are different models, because the “first” GPU in Ollama may not be the one in the top PCIe slot.

A common reason to do this: keep one GPU free for gaming, ComfyUI or video editing while Ollama runs on the other. If you also run ComfyUI on a multi-GPU PC, my ComfyUI multi-GPU guide shows the matching setup there.

Force a Model Across All GPUs

To make Ollama always spread a model across every visible GPU, even when it would fit on one:

OLLAMA_SCHED_SPREAD=1

Ollama’s server describes this as “Always schedule model across all GPUs”. When is it worth it?

  • You want the most free VRAM for a large context, so the KV cache has room on both cards.
  • One GPU also drives your monitors and you want less load on it.
  • You’re testing whether a split is faster on your hardware. Measure it with ollama run model --verbose and compare the eval rate.

For most single-user setups, leave it off. Keeping a model on one card is usually as fast or faster.

Run One Model per GPU

Ollama has no setting that says “model A on GPU 0, model B on GPU 1”. The clean way to get that is to run two Ollama servers, each limited to one GPU and listening on its own port.

Linux or macOS terminal:

# server 1 on GPU 0, default port
CUDA_VISIBLE_DEVICES=0 OLLAMA_HOST=127.0.0.1:11434 ollama serve

# server 2 on GPU 1, port 11435 (second terminal)
CUDA_VISIBLE_DEVICES=1 OLLAMA_HOST=127.0.0.1:11435 ollama serve

Windows PowerShell (quit the tray app first so it doesn’t hold port 11434):

$env:CUDA_VISIBLE_DEVICES="0"; $env:OLLAMA_HOST="127.0.0.1:11434"; ollama serve
# in a second PowerShell window:
$env:CUDA_VISIBLE_DEVICES="1"; $env:OLLAMA_HOST="127.0.0.1:11435"; ollama serve

Both servers share the same model folder, so you don’t download anything twice. Point each app at its own server:

OLLAMA_HOST=127.0.0.1:11435 ollama run llama3.1
curl http://127.0.0.1:11435/api/tags

In Open WebUI you can add both URLs as separate Ollama connections. In code, create a client per host (see my Ollama Python and JavaScript guides).

How to Set the Variables (Windows, Linux, Docker)

These are server settings, so they must be set where the server starts, and Ollama must be fully restarted.

Windows app: quit Ollama from the tray. Open “Edit environment variables for your account”. Add CUDA_VISIBLE_DEVICES or OLLAMA_SCHED_SPREAD, then start Ollama again. In PowerShell:

setx OLLAMA_SCHED_SPREAD "1"

Linux (systemd):

sudo systemctl edit ollama.service

[Service]
Environment="CUDA_VISIBLE_DEVICES=GPU-5e6f7a8b-..."
Environment="OLLAMA_SCHED_SPREAD=1"

sudo systemctl daemon-reload
sudo systemctl restart ollama

Docker: choose GPUs with Docker’s own flag, and pass Ollama variables with -e:

# both GPUs, always split
docker run -d --gpus=all -e OLLAMA_SCHED_SPREAD=1 -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

# only GPU 1
docker run -d --gpus '"device=1"' -v ollama:/root/.ollama -p 11435:11434 --name ollama-gpu1 ollama/ollama

More on the Docker setup: Ollama in Docker. All server variables are listed in my Ollama environment variables guide.

Mixed GPUs and VRAM Sizes

Two different cards from the same vendor, for example a 24 GB card and a 12 GB card, can share a model. Ollama places layers based on the free memory on each card. Things to know:

  • The slower card sets the pace for its share of the layers, so an old card can drag a split model down.
  • Reserve headroom if a card also runs your desktop or other apps. OLLAMA_GPU_OVERHEAD reserves VRAM per GPU, in bytes. For example, OLLAMA_GPU_OVERHEAD=1073741824 keeps about 1 GB free on each card.
  • Mixing vendors (NVIDIA plus AMD) in one model is not something to count on. Run them as two separate servers instead.
  • Integrated GPUs can be allowed or blocked with OLLAMA_IGPU_ENABLE (1 or 0). On a PC with a dedicated card, keep the iGPU out of the split, because it shares slow system RAM.

Example: Two 16 GB GPUs

Here is what to expect on a PC with two 16 GB cards (32 GB VRAM in total). Sizes are rough and depend on the quantization and context you use:

Model (Q4) Rough size What Ollama does
7B-9B 5-6 GB One GPU. The other is free for a second model.
14B 9-10 GB One GPU with default context; may split with a long context.
27B-32B 17-20 GB Too big for one card, so it splits across both, all in VRAM.
70B 40+ GB Does not fit in 32 GB. Part runs on CPU and RAM, much slower.

The sweet spot for two 16 GB cards is the 24B-32B class, which would not fit on one 16 GB card at all. For model picks by VRAM, see best Ollama models and how much VRAM you need for AI.

Troubleshooting

Ollama only uses one GPU

If the model fits on one card, that is the intended behaviour. To use both, run a bigger model, set OLLAMA_SCHED_SPREAD=1, or load a second model.

If even a large model stays on one GPU and spills to the CPU, check that CUDA_VISIBLE_DEVICES isn’t set to a single card somewhere you forgot about, such as the system variables, the Docker command or the systemd override.

The second GPU is not detected

Look for both GPUs in the inference compute log lines. If one is missing, update the GPU driver, make sure the card shows up in nvidia-smi, and restart Ollama.

On Linux after sleep, Ollama’s docs suggest reloading the driver with sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm. More fixes: Ollama not using GPU.

Out of memory when the model is split

The context also needs room on both cards. Lower num_ctx, use OLLAMA_KV_CACHE_TYPE=q8_0 to halve the KV cache size, or reserve less with OLLAMA_GPU_OVERHEAD. Close other apps that hold VRAM.

“address already in use” when starting a second server

Each server needs its own port. Set a different OLLAMA_HOST port for the second one, and quit the desktop app if it already holds 11434.

FAQ

Can Ollama use NVLink?

You don’t need NVLink. Ollama splits models over normal PCIe. NVLink may help with the data passed between cards, but most consumer GPUs no longer have it.

Can I use an NVIDIA GPU and my CPU together?

Yes. When a model doesn’t fit in VRAM, Ollama puts the rest in system RAM automatically. ollama ps then shows a split like 48%/52% CPU/GPU. It works, but it is much slower than all-GPU.

Does the PCIe slot speed matter?

A little. For text generation with a layer split, a slower x4 or x8 slot has a smaller effect than you might fear, but loading models from disk to VRAM takes longer. Keep the main GPU in the fastest slot.

How many models can I keep loaded with two GPUs?

By default up to 6 (3 per GPU), as long as they fit in memory. Change it with OLLAMA_MAX_LOADED_MODELS.

Is this different on a Mac?

Yes. Apple Silicon has one GPU with unified memory, so there is nothing to split. The settings in this guide matter on Windows and Linux PCs with more than one graphics card.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman by a PC with two graphics cards holding a tablet with a MULTI GPU card, hook 2 GPUs one big model