[GH-ISSUE #3038] Log says "Nvidia GPU detected" and then "no GPU detected" #1868

Closed
opened 2026-04-12 11:56:27 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jimstevens2001 on GitHub (Mar 10, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3038

I am running a fresh install of Ollama inside of an Ubuntu 22.04 VM running an Nvidia RTX 4090 via pci passthrough (installed with "curl -fsSL https://ollama.com/install.sh | sh"). I have verified that nvidia-smi works as expected and a pytorch program can detect the GPU, but when I run Ollama, it uses the CPU to execute. Note that I have an almost identical setup (except on the host rather than in a guest) running a version of Ollama from late December with "ollama run mixtral:8x7b-instruct-v0.1-q2_K" and it uses the GPU properly.

Here is the log output that shows the inconsistent messages "Nvidia GPU detected" and then "no GPU detected"...

Mar 10 07:14:14 hinton systemd[1]: Started Ollama Service.
Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=images.go:710 msg="total blobs: 0"
Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=images.go:717 msg="total unused blobs removed: 0"
Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=routes.go:1021 msg="Listening on 127.0.0.1:11434 (version 0.1>
Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=payload_common.go:107 msg="Extracting dynamic libraries..."
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=payload_common.go:146 msg="Dynamic LLM libraries [cpu_avx2 ro>
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=gpu.go:94 msg="Detecting GPU type"
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=gpu.go:265 msg="Searching for GPU management library libnvidi>
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.160Z level=INFO source=gpu.go:311 msg="Discovered GPU libraries: [/usr/lib/x86_64-li>
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=gpu.go:99 msg="Nvidia GPU detected"
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=cpu_common.go:18 msg="CPU does not have vector extensions"
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=WARN source=gpu.go:128 msg="CPU does not have AVX or AVX2, disabling GPU >
Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=routes.go:1044 msg="no GPU detected"

Originally created by @jimstevens2001 on GitHub (Mar 10, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3038 I am running a fresh install of Ollama inside of an Ubuntu 22.04 VM running an Nvidia RTX 4090 via pci passthrough (installed with "curl -fsSL https://ollama.com/install.sh | sh"). I have verified that nvidia-smi works as expected and a pytorch program can detect the GPU, but when I run Ollama, it uses the CPU to execute. Note that I have an almost identical setup (except on the host rather than in a guest) running a version of Ollama from late December with "ollama run mixtral:8x7b-instruct-v0.1-q2_K" and it uses the GPU properly. Here is the log output that shows the inconsistent messages "Nvidia GPU detected" and then "no GPU detected"... Mar 10 07:14:14 hinton systemd[1]: Started Ollama Service. Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=images.go:710 msg="total blobs: 0" Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=images.go:717 msg="total unused blobs removed: 0" Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=routes.go:1021 msg="Listening on 127.0.0.1:11434 (version 0.1> Mar 10 07:14:14 hinton ollama[998]: time=2024-03-10T07:14:14.622Z level=INFO source=payload_common.go:107 msg="Extracting dynamic libraries..." Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=payload_common.go:146 msg="Dynamic LLM libraries [cpu_avx2 ro> Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=gpu.go:94 msg="Detecting GPU type" Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.159Z level=INFO source=gpu.go:265 msg="Searching for GPU management library libnvidi> Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.160Z level=INFO source=gpu.go:311 msg="Discovered GPU libraries: [/usr/lib/x86_64-li> Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=gpu.go:99 msg="Nvidia GPU detected" Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=cpu_common.go:18 msg="CPU does not have vector extensions" Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=WARN source=gpu.go:128 msg="CPU does not have AVX or AVX2, disabling GPU > Mar 10 07:14:16 hinton ollama[998]: time=2024-03-10T07:14:16.165Z level=INFO source=routes.go:1044 msg="no GPU detected"
Author
Owner

@jimstevens2001 commented on GitHub (Mar 10, 2024):

Found related issues...

Looks like it is currently required that the guest has AVX support to use the GPU mode.

Adding this to my qemu command line fixed it...

-cpu Haswell,+avx,+avx2 \

Note that I originally tried "-cpu host" and that did not work. It just entered the qemu monitor for some reason.

<!-- gh-comment-id:1987212816 --> @jimstevens2001 commented on GitHub (Mar 10, 2024): Found related issues... - https://github.com/ollama/ollama/issues/2524 - https://github.com/ollama/ollama/issues/2903 - https://github.com/ollama/ollama/issues/2187 Looks like it is currently required that the guest has AVX support to use the GPU mode. Adding this to my qemu command line fixed it... -cpu Haswell,+avx,+avx2 \ Note that I originally tried "-cpu host" and that did not work. It just entered the qemu monitor for some reason.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1868