If your PC has more than one graphics card, or an integrated GPU alongside a discrete one, Ollama may not pick the one you want. Ollama lets you choose with an environment variable, and the right variable depends on whether the card runs on NVIDIA's CUDA, AMD's ROCm or Vulkan. This guide follows Ollama's hardware support documentation.
Before you start: is the card supported?
Ollama's documentation says it supports NVIDIA GPUs with compute capability 5.0 or newer and driver version 550 or newer. It also supports AMD cards through ROCm, and further GPUs on Windows and Linux through its Vulkan backend. If you're not sure your card qualifies, see our guide to checking a GPU works with Ollama.
NVIDIA: CUDA_VISIBLE_DEVICES
Open a terminal and run
nvidia-smi -L. NVIDIA's documentation says this lists each NVIDIA GPU in the system along with its UUID.Set
CUDA_VISIBLE_DEVICESto a comma-separated list of the GPUs Ollama should use.Ollama says numeric IDs work, but their order can vary, so UUIDs are more reliable. For example, set it to the UUID string
nvidia-smi -Lshows for your preferred card.
AMD: ROCR_VISIBLE_DEVICES
On AMD cards that use ROCm, set ROCR_VISIBLE_DEVICES to a comma-separated list instead. Ollama's documentation says you can list devices with rocminfo, and recommends using the device's Uuid rather than a number where available.
Vulkan: GGML_VK_VISIBLE_DEVICES
For GPUs running on the Vulkan backend, set GGML_VK_VISIBLE_DEVICES to one or more numeric IDs. Ollama gives a specific tip for PCs with an unstable integrated GPU: keep Vulkan enabled and set the variable to the discrete card's index, for example GGML_VK_VISIBLE_DEVICES=1 when Vulkan1 is the discrete GPU. To turn off all Vulkan GPUs, set OLLAMA_VULKAN=0 or GGML_VK_VISIBLE_DEVICES=-1.




