On Windows WSL2, with Cuda Toolkit Installed and Cuda-Container-Toolkit installed, I'm facing this issue running the official Docker image :
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:292: 3676 MB VRAM available, loading up to 21 GPU layers
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:421: starting llama runner
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:479: waiting for llama runner to start responding
ollama-ollama-1 | ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no
ollama-ollama-1 | ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes
ollama-ollama-1 | ggml_init_cublas: found 1 CUDA devices:
ollama-ollama-1 | Device 0: NVIDIA RTX A1000 Laptop GPU, compute capability 8.6
ollama-ollama-1 |
ollama-ollama-1 | CUDA error 222 at /go/src/github.com/jmorganca/ollama/llm/llama.cpp/gguf/ggml-cuda.cu:5965: the provided PTX was compiled with an unsupported toolchain.
ollama-ollama-1 | current device: 0
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:436: 222 at /go/src/github.com/jmorganca/ollama/llm/llama.cpp/gguf/ggml-cuda.cu:5965: the provided PTX was compiled with an unsupported toolchain.
ollama-ollama-1 | current device: 0
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:444: error starting llama runner: llama runner process has terminated
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:510: llama runner stopped successfully
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:421: starting llama runner
ollama-ollama-1 | 2023/11/29 00:36:04 llama.go:479: waiting for llama runner to start responding
ollama-ollama-1 | {"timestamp":1701218164,"level":"WARNING","function":"server_params_parse","line":2035,"message":"Not compiled with GPU offload support, --n-gpu-layers option will be ignored. See main README.md for information on enabling GPU BLAS support","n_gpu_layers":-1}
ollama-ollama-1 | {"timestamp":1701218164,"level":"INFO","function":"main","line":2534,"message":"build info","build":375,"commit":"9656026"}
ollama-ollama-1 | {"timestamp":1701218164,"level":"INFO","function":"main","line":2537,"message":"system info","n_threads":12,"n_threads_batch":-1,"total_threads":24,"system_info":"AVX = 1 | AVX2 = 0 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 0 | NEON = 0 | ARM_FMA = 0 | F16C = 0 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | "}
ollama-ollama-1 | llama_model_loader: loaded meta data with 18 key-value pairs and 196 tensors from /root/.ollama/models/blobs/sha256:305c4103a989d3f8ac457f912af30f32693f20dcffe1495e18c2ed7b5596b2d1 (version GGUF V2)
So Ollama is not using my GPU.
When I check if Docker can use my GPU, it seems OK :
Tue Nov 28 23:56:24 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.91 Driver Version: 517.89 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA RTX A100... On | 00000000:01:00.0 On | N/A |
| N/A 38C P8 3W / N/A | 323MiB / 4096MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 22 G /Xwayland N/A |
+-----------------------------------------------------------------------------+
On Ollama startup, no warning about not accessing GPU :
ollama-ollama-1 | 2023/11/29 00:07:32 images.go:784: total blobs: 15
ollama-ollama-1 | 2023/11/29 00:07:32 images.go:791: total unused blobs removed: 0
ollama-ollama-1 | 2023/11/29 00:07:32 routes.go:777: Listening on [::]:11434 (version 0.1.12)
Here is my distribution :
$ uname -a
Linux FRLFK0635009890 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
Models :
root@de433da63a97:/# ollama list
NAME ID SIZE MODIFIED
codellama:latest 8fdf8f752f6e 3.8 GB 51 minutes ago
codeup:latest 54289661f7a9 7.4 GB 39 minutes ago
falcon:latest 4280f7257e73 4.2 GB 34 minutes ago
When I have a look at the source code of ggml-cuda.cu :
for (int id = 0; id < g_device_count; ++id) {
CUDA_CHECK(ggml_cuda_set_device(id));
// create cuda streams
for (int is = 0; is < MAX_STREAMS; ++is) {
CUDA_CHECK(cudaStreamCreateWithFlags(&g_cudaStreams[id][is], cudaStreamNonBlocking));
}
// create cublas handle
CUBLAS_CHECK(cublasCreate(&g_cublas_handles[id]));
CUBLAS_CHECK(cublasSetMathMode(g_cublas_handles[id], CUBLAS_TF32_TENSOR_OP_MATH));
}
The error is raised by CUDA_CHECK(cudaStreamCreateWithFlags(&g_cudaStreams[id][is], cudaStreamNonBlocking)); in the for loop.
On Windows WSL2, with Cuda Toolkit Installed and Cuda-Container-Toolkit installed, I'm facing this issue running the official Docker image :
So Ollama is not using my GPU.
When I check if Docker can use my GPU, it seems OK :
On Ollama startup, no warning about not accessing GPU :
Here is my distribution :
Models :
When I have a look at the source code of
ggml-cuda.cu:The error is raised by
CUDA_CHECK(cudaStreamCreateWithFlags(&g_cudaStreams[id][is], cudaStreamNonBlocking));in the for loop.