llama.cppThe GPU is not being used
ggml_cuda_init: failed to initialize CUDA
The message
ggml_cuda_init: failed to initialize CUDA: <reason>
Parts in <angle brackets> change from run to run.
What it means
A CUDA build of llama.cpp started but could not talk to any NVIDIA GPU, so it falls back to the CPU. The text after the colon is CUDA's own reason.
Why it happens
- Inside Docker: the container was started without GPU access (
--gpus all), or the NVIDIA Container Toolkit is missing. - The installed driver is older than the CUDA version the binary was built with.
- In WSL2: a Linux NVIDIA driver was installed inside WSL over the Windows passthrough driver.
How to fix it
- Run
nvidia-smiwhere llama.cpp runs (host, container or WSL). If it fails there too, fix the driver first. - Update the NVIDIA driver; prebuilt CUDA binaries name the CUDA version they need.
- In WSL2 install only the CUDA toolkit inside Linux (
cuda-toolkit-12-x), never thecudaorcuda-driverspackages.
Guides that cover this
Related errors
Checked against
Message text read from source on 2026-10-26.