Ollama GPU Not Detected: Fix CUDA and ROCm Errors
In this article
Yes, Ollama can use your GPU for faster local LLM inference, but only if CUDA (for NVIDIA) or ROCm (for AMD) is correctly installed and detected. If Ollama isn’t recognizing your GPU, it’s usually due to missing, outdated, or misconfigured GPU drivers and compute platforms. Fixing this means verifying your GPU is supported, installing the correct driver, setting up CUDA or ROCm, and ensuring Ollama can access it. This guide walks you through diagnosing and fixing GPU detection issues in Ollama on Linux and Windows.
What You'll Need
- An NVIDIA or AMD GPU compatible with CUDA or ROCm
- Administrator access to your system
- Latest GPU driver installed
- CUDA Toolkit (for NVIDIA) or ROCm (for AMD)
- Ollama installed and running
- Terminal or command-line access
Step-by-Step
- Confirm GPU compatibility. NVIDIA GPUs require compute capability 5.0 or higher (most GTX 10xx and newer). AMD GPUs must be RDNA2 or newer (e.g., RX 6000 series or Radeon Pro). Check official CUDA and ROCm documentation to verify support.
- Update your GPU driver. On Windows, use Device Manager or the manufacturer’s installer (NVIDIA GeForce Experience or AMD Adrenalin). On Linux, use your package manager or the official driver installer. Ensure the driver version supports the CUDA or ROCm version you plan to install.
- Install CUDA Toolkit if using an NVIDIA GPU. Download the latest stable version from NVIDIA’s website. On Linux, use the runfile or package manager (e.g., apt for Ubuntu). On Windows, run the installer and accept default options. Ensure the PATH includes CUDA binaries.
- Install ROCm if using an AMD GPU. On Ubuntu, add the ROCm repository and install via apt. For other Linux distros, consult AMD’s documentation. ROCm is not officially supported on Windows; use Linux for AMD GPU acceleration with Ollama.
- Verify installation. Open a terminal and run
nvidia-smifor NVIDIA orrocminfofor AMD. If these commands return GPU details, the driver and platform are working. - Test CUDA or HIP runtime. For CUDA, compile and run a simple test program or use
nvcc --version. For ROCm, ensurehipconfigruns and displays settings. - Restart Ollama. Stop the Ollama service with
sudo systemctl stop ollama(Linux) or via Task Manager (Windows), then restart it. On Linux, you may need to reload environment variables. - Check Ollama logs. Run
ollama servein a terminal and look for messages like "CUDA device found" or "ROCm device detected". If no GPU is listed, the issue persists. - Set environment variables if needed. For CUDA, ensure
CUDA_VISIBLE_DEVICESis not restricting access. For ROCm, setROCR_VISIBLE_DEVICESif multiple GPUs are present. Useexport(Linux) or System Properties (Windows) to configure. - Run a model with GPU offload. Pull and run a model using
ollama run llama3. Monitor GPU usage vianvidia-smiorrocm-smito confirm Ollama is using VRAM.
Common Mistakes
- Assuming GPU support without checking compute capability.
- Using outdated or mismatched driver and CUDA/ROCm versions.
- Skipping environment variable setup, especially on Linux.
- Trying to use ROCm on Windows, which is not supported.
- Not restarting Ollama after installing drivers or tools.
Tips
- Use
ollama listto see available models and their GPU compatibility. - Monitor VRAM usage to ensure offloading is active.
- On Linux, add your user to the
videogroup to avoid permission issues with ROCm. - Keep Ollama updated—new versions often improve GPU support.
- Use
export OLLAMA_DEBUG=1before runningollama servefor detailed logs.
Troubleshooting
If Ollama still doesn’t detect your GPU, start with the basics: restart your system and verify the GPU is detected in the OS. Re-run nvidia-smi or rocminfo. If those fail, reinstall the GPU driver completely. On Linux, ensure kernel headers are installed for DKMS modules. If CUDA fails, reinstall the toolkit and check symbolic links in /usr/local/cuda. For ROCm, confirm your kernel version is supported and that amdgpu modules are loaded. If Ollama logs show "no compatible GPU found", double-check that the model you’re using supports GPU offloading—some smaller models may not utilize it. Try a larger model like llama3:13b. If using Docker, ensure the container has GPU access enabled via --gpus all. As a last resort, reinstall Ollama and clear its configuration in ~/.ollama (Linux) or %USERPROFILE%\.ollama (Windows), but back up custom models first.
Frequently Asked Questions
Does Ollama support Intel GPUs?
No, Ollama does not currently support Intel GPUs via oneAPI or Level Zero. Only NVIDIA (CUDA) and AMD (ROCm) are supported.
Why does Ollama say "CUDA runtime not found"?
This means the CUDA libraries are not installed or not in the system PATH. Reinstall CUDA Toolkit and verify nvcc --version works.
Can I use Ollama with GPU on Windows with AMD?
No, ROCm is not supported on Windows. AMD GPU acceleration in Ollama only works on Linux.
Do I need a high-end GPU for Ollama?
For larger models (13B+ parameters), a GPU with at least 8GB VRAM is recommended. Smaller models can run on integrated or lower-end GPUs, but performance may be limited.
How do I know if Ollama is using my GPU?
Run nvidia-smi or rocm-smi while Ollama is running a model. If VRAM usage increases and compute utilization is above 0%, the GPU is active.
Does Ollama work without a GPU?
Yes, Ollama runs on CPU only, but performance is significantly slower, especially for larger models. GPU offloading improves speed and responsiveness.