[GH-ISSUE #9818] Ollama Fails to Fully Utilize RTX 3060 VRAM with gemma3:27b (Only Uses 7GB out of 12GB #6427

Closed
opened 2026-04-12 17:59:11 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @msjsc001 on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9818

What is the issue?

When I use ollama run gemma3:27b, the GPU memory usage only reaches half, about 7GB, even though my RTX 3060 has 12GB of VRAM.

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @msjsc001 on GitHub (Mar 17, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9818 ### What is the issue? When I use ollama run gemma3:27b, the GPU memory usage only reaches half, about 7GB, even though my RTX 3060 has 12GB of VRAM. ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-12 17:59:11 -05:00
Author
Owner

@rick-github commented on GitHub (Mar 17, 2025):

Server logs may help in debugging.

<!-- gh-comment-id:2729039606 --> @rick-github commented on GitHub (Mar 17, 2025): [Server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) may help in debugging.
Author
Owner

@mswcap commented on GitHub (Mar 20, 2025):

I experience the same issue, changing certain variables doesn't help. See attached log file.
OS
Windows 11

GPU
NVIDIA GeForce RTX 3060

CPU
AMD Ryzen 5 7600 6-Core

Ollama version
0.6.2.

Parameters set:
OLLAMA_FLASH_ATTENTION 1
OLLAMA_GPU_OVERHEAD 1024
OLLAMA_KV_CACHE_TYPE q8_0

PS output
NAME ID SIZE PROCESSOR UNTIL
gemma3:27b 30ddded7fba6 22 GB 47%/53% CPU/GPU 2 minutes from now

server.log

<!-- gh-comment-id:2741313571 --> @mswcap commented on GitHub (Mar 20, 2025): I experience the same issue, changing certain variables doesn't help. See attached log file. OS Windows 11 GPU NVIDIA GeForce RTX 3060 CPU AMD Ryzen 5 7600 6-Core Ollama version 0.6.2. Parameters set: OLLAMA_FLASH_ATTENTION 1 OLLAMA_GPU_OVERHEAD 1024 OLLAMA_KV_CACHE_TYPE q8_0 PS output NAME ID SIZE PROCESSOR UNTIL gemma3:27b 30ddded7fba6 22 GB 47%/53% CPU/GPU 2 minutes from now [server.log](https://github.com/user-attachments/files/19373188/server.log)
Author
Owner

@rick-github commented on GitHub (Mar 20, 2025):

time=2025-03-20T19:17:26.191+01:00 level=INFO source=server.go:138 msg=offload library=cuda layers.requested=-1
 layers.model=63 layers.offload=28 layers.split="" memory.available="[11.0 GiB]" memory.gpu_overhead="1.0 KiB"
 memory.required.full="20.5 GiB" memory.required.partial="10.8 GiB" memory.required.kv="496.0 MiB"
 memory.required.allocations="[10.8 GiB]" memory.weights.total="14.3 GiB" memory.weights.repeating="14.3 GiB"
 memory.weights.nonrepeating="1.1 GiB" memory.graph.full="522.5 MiB" memory.graph.partial="1.6 GiB"
 projector.weights="795.9 MiB" projector.graph="1.0 GiB"

ollama estimates it can offload 28 of 63 layers, using 10.8G of the 11G available. However, it's up to the inference backend (llama.cpp in this case) to actually allocate the memory for hosting the model. Things like FA can make llama.cpp more efficient at this than ollama estimates, so that VRAM ends up underutilized. You can override this by manually telling llama.cpp how many layers to offload the the GPU by setting num_gpu as described here. Note that this can lead to OOMs or performance degradation.

<!-- gh-comment-id:2741331465 --> @rick-github commented on GitHub (Mar 20, 2025): ``` time=2025-03-20T19:17:26.191+01:00 level=INFO source=server.go:138 msg=offload library=cuda layers.requested=-1 layers.model=63 layers.offload=28 layers.split="" memory.available="[11.0 GiB]" memory.gpu_overhead="1.0 KiB" memory.required.full="20.5 GiB" memory.required.partial="10.8 GiB" memory.required.kv="496.0 MiB" memory.required.allocations="[10.8 GiB]" memory.weights.total="14.3 GiB" memory.weights.repeating="14.3 GiB" memory.weights.nonrepeating="1.1 GiB" memory.graph.full="522.5 MiB" memory.graph.partial="1.6 GiB" projector.weights="795.9 MiB" projector.graph="1.0 GiB" ``` ollama estimates it can offload 28 of 63 layers, using 10.8G of the 11G available. However, it's up to the inference backend (llama.cpp in this case) to actually allocate the memory for hosting the model. Things like FA can make llama.cpp more efficient at this than ollama estimates, so that VRAM ends up underutilized. You can override this by manually telling llama.cpp how many layers to offload the the GPU by setting `num_gpu` as described [here](https://github.com/ollama/ollama/issues/6950#issuecomment-2373663650). Note that this can lead to OOMs or performance degradation.
Author
Owner

@mswcap commented on GitHub (Mar 20, 2025):

Thanks @rick-github , I tried it and the CPU took all the load. So I am back to the original setting and now the load is divided between the GPU and CPU. It's okay and it performs not fast, but the output is seriously good.

<!-- gh-comment-id:2741430812 --> @mswcap commented on GitHub (Mar 20, 2025): Thanks @rick-github , I tried it and the CPU took all the load. So I am back to the original setting and now the load is divided between the GPU and CPU. It's okay and it performs not fast, but the output is seriously good.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6427