New Tool Radar

Local AI

How to Choose Which GPU Ollama Uses When You Have More Than One

Limit Ollama to one of your NVIDIA GPUs with CUDA_VISIBLE_DEVICES, using the card's UUID from nvidia-smi -L so the choice survives reordering.

Schematic diagram with three steps: list GPUs with nvidia-smi -L, pick one card by UUID with CUDA_VISIBLE_DEVICES before ollama serve, then confirm ollama ps shows 100 percent GPU.

If your computer has two graphics cards, Ollama does not ask which one to use: it picks for you. The Ollama FAQ says that when a model fits entirely on one GPU, Ollama loads the model on that GPU, and only spreads it across all the available GPUs when it does not fit on one. So if one card is busy with your display or another program, or one card is simply the faster one, you need to hide the others from Ollama first. The Ollama hardware page gives you the tool for that: the CUDA_VISIBLE_DEVICES environment variable, set before you start the Ollama server.

List your GPUs and copy the UUID

The hardware page says you can set CUDA_VISIBLE_DEVICES to a comma separated list of GPUs, that numeric IDs may be used but their ordering may vary, and that UUIDs are more reliable. You can discover the UUID of your GPUs by running nvidia-smi -L. Run that first and write down the UUID of the card you want Ollama to use. The two cards in the practice table below are fictional, with made-up UUIDs, to show what the list looks like and which value to copy.

Card in the practice machine What nvidia-smi -L shows Copy this for CUDA_VISIBLE_DEVICES
GPU 0: GeForce RTX 3060 (fictional) GPU 0: NVIDIA GeForce RTX 3060 (UUID: GPU-11111111-2222-3333-4444-555555555555) GPU-11111111-2222-3333-4444-555555555555
GPU 1: GeForce RTX 3070 (fictional) GPU 1: NVIDIA GeForce RTX 3070 (UUID: GPU-66666666-7777-8888-9999-000000000000) GPU-66666666-7777-8888-9999-000000000000

Both cards appear in the hardware page’s own table of supported cards, under compute capability 8.6, so either one can run Ollama; the choice here is about which card does the work, not whether Ollama runs at all.

Start Ollama with only that GPU visible

Set the variable in front of the server command, so it applies to that run of the server only:

CUDA_VISIBLE_DEVICES=GPU-66666666-7777-8888-9999-000000000000 ollama serve

That line uses the fictional RTX 3070 UUID from the table above, so Ollama can see only the second card. To use two cards instead of one, give a comma separated list, for example CUDA_VISIBLE_DEVICES=0,1. The hardware page also says that to ignore the GPUs and force CPU usage, use an invalid GPU ID such as -1. If Ollama runs as a Linux systemd service, a one-off command in your shell changes nothing, because the service runs as another user: the FAQ says to set environment variables with systemctl edit ollama.service, adding an Environment line under [Service], then reloading systemd and restarting Ollama.

Try it: three checks that the right card is working

With the server started on the fictional RTX 3070 only, run a model and work through the checks below.

Check What you should see What it means
List the cards nvidia-smi -L lists GPU 0 and GPU 1 with their UUIDs You know the exact UUID to hand to Ollama
Start the server CUDA_VISIBLE_DEVICES=GPU-66666666-7777-8888-9999-000000000000 ollama serve starts without error Ollama can see only the card you chose
Confirm where the model loaded ollama ps shows the Processor column as 100% GPU The model loaded on a GPU, not on the CPU

Expected result. We checked the Ollama hardware page and the Ollama FAQ. We did not run nvidia-smi, start the Ollama server, or load a model on this machine, and the two cards and UUIDs above are fictional.

Limits

Choosing a GPU only limits which cards Ollama can see; it does not split one model across cards by hand, and the FAQ says Ollama itself decides whether a model that does not fit on one GPU is spread across the visible ones. Numeric IDs can change order between boots, which is why the hardware page recommends UUIDs, and a UUID copied with a typo will not match any card. This guide covers NVIDIA cards only: for AMD cards the hardware page gives ROCR_VISIBLE_DEVICES and the rocminfo command instead, and for Vulkan GPUs it gives GGML_VK_VISIBLE_DEVICES. We did not test any of this ourselves.

Sources

See all