[GH-ISSUE #9472] GPU Memory not utilized well #68228

Closed
opened 2026-05-04 12:56:42 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @forReason on GitHub (Mar 3, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9472

What is the issue?

Ollama leaves over 30% of my GPU's Memory unallocated:

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120                Driver Version: 550.120        CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| 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 GeForce RTX 3060        On  |   00000000:01:00.0 Off |                  N/A |
|  0%   60C    P2             88W /  100W |    7400MiB /  12288MiB |     98%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA RTX A2000 12GB          On  |   00000000:05:00.0 Off |                  Off |
| 30%   34C    P2             22W /   70W |    8072MiB /  12282MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   2  NVIDIA GeForce RTX 3060        On  |   00000000:0A:00.0 Off |                  N/A |
|  0%   50C    P2             42W /  100W |    7784MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

Any Idea why that Is or what I can do to improve this?

Relevant log output


OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.5.4

Originally created by @forReason on GitHub (Mar 3, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9472 ### What is the issue? Ollama leaves over 30% of my GPU's Memory unallocated: ``` +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.120 Driver Version: 550.120 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | 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 GeForce RTX 3060 On | 00000000:01:00.0 Off | N/A | | 0% 60C P2 88W / 100W | 7400MiB / 12288MiB | 98% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 1 NVIDIA RTX A2000 12GB On | 00000000:05:00.0 Off | Off | | 30% 34C P2 22W / 70W | 8072MiB / 12282MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 2 NVIDIA GeForce RTX 3060 On | 00000000:0A:00.0 Off | N/A | | 0% 50C P2 42W / 100W | 7784MiB / 12288MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ ``` Any Idea why that Is or what I can do to improve this? ### Relevant log output ```shell ``` ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.5.4
GiteaMirror added the bug label 2026-05-04 12:56:42 -05:00
Author
Owner

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

The memory estimation is sometimes inaccurate. You can make ollama load more layers into VRAM by setting num_gpu either in an API call or in the Modelfile, see here. Note that if you set it too high, you may experience OOMs or performance degradation.

<!-- gh-comment-id:2693565629 --> @rick-github commented on GitHub (Mar 3, 2025): The memory estimation is sometimes inaccurate. You can make ollama load more layers into VRAM by setting `num_gpu` either in an API call or in the Modelfile, see [here](https://github.com/ollama/ollama/issues/6950#issuecomment-2373663650). Note that if you set it too high, you may experience OOMs or performance degradation.
Author
Owner

@forReason commented on GitHub (Mar 8, 2025):

this did not work:

Image

ollama ps
NAME                          ID              SIZE     PROCESSOR          UNTIL               
llama3.3:70b-instruct-q2_K    a6f03da15cbc    41 GB    12%/88% CPU/GPU    59 minutes from now

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120                Driver Version: 550.120        CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| 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 GeForce RTX 3060        On  |   00000000:01:00.0 Off |                  N/A |
| 61%   57C    P2             41W /  100W |   10416MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA RTX A2000 12GB          On  |   00000000:05:00.0 Off |                  Off |
| 30%   50C    P2             28W /   70W |   10810MiB /  12282MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   2  NVIDIA GeForce RTX 3060        On  |   00000000:0A:00.0 Off |                  N/A |
| 33%   52C    P2             42W /  100W |   10338MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
<!-- gh-comment-id:2708215988 --> @forReason commented on GitHub (Mar 8, 2025): this did not work: ![Image](https://github.com/user-attachments/assets/eb45958e-c04d-4d0f-a9c8-d36dedc781cf) ``` ollama ps NAME ID SIZE PROCESSOR UNTIL llama3.3:70b-instruct-q2_K a6f03da15cbc 41 GB 12%/88% CPU/GPU 59 minutes from now +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.120 Driver Version: 550.120 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | 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 GeForce RTX 3060 On | 00000000:01:00.0 Off | N/A | | 61% 57C P2 41W / 100W | 10416MiB / 12288MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 1 NVIDIA RTX A2000 12GB On | 00000000:05:00.0 Off | Off | | 30% 50C P2 28W / 70W | 10810MiB / 12282MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 2 NVIDIA GeForce RTX 3060 On | 00000000:0A:00.0 Off | N/A | | 33% 52C P2 42W / 100W | 10338MiB / 12288MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ ```
Author
Owner

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

The output of ollama ps will be incorrect because you have overridden num_gpu. Check the server log for the layer allocation.

<!-- gh-comment-id:2708219780 --> @rick-github commented on GitHub (Mar 8, 2025): The output of `ollama ps` will be incorrect because you have overridden `num_gpu`. Check the server log for the layer allocation.
Author
Owner

@forReason commented on GitHub (Mar 8, 2025):

YES!
Thank you. This may be a visual bug which could be looked into the future...

Mar 08 12:28:51 drg-ai001 ollama[4008342]: llm_load_tensors: offloaded 81/81 layers to GPU
<!-- gh-comment-id:2708222376 --> @forReason commented on GitHub (Mar 8, 2025): YES! Thank you. This may be a visual bug which could be looked into the future... ``` Mar 08 12:28:51 drg-ai001 ollama[4008342]: llm_load_tensors: offloaded 81/81 layers to GPU ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#68228