[GH-ISSUE #1888] nvmlInit_v2 unable to detect Nvidia GPU in WSL #47594

Closed
opened 2026-04-28 04:26:17 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @taweili on GitHub (Jan 10, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/1888

Originally assigned to: @dhiltgen on GitHub.

Ollama has switched to using NVML to detect the Nvidia environment. However, this method failed on WSL. Here is a short C code to validate the behavior.

The nvmlReturn_t returns 9 NVML_ERROR_DRIVER_NOT_LOADED = 9. This may make sense according to the implementation of Nvidia in WSL as it use the driver from Windows host. I can't find any document on this, one way or another.

This issue prevents Ollama v0.1.18 and 0.1.19 from using Nvidia hardware in WSL.

#include <stdio.h>
#include "gpu_info_cuda.h"

cuda_init_resp_t resp;
mem_info_t mem_info;

void main(void)
{
    nvmlReturn_t ret;
    cuda_init(&resp);
    ret = resp.ch.initFn();
    printf("%d\n", ret);
}
Originally created by @taweili on GitHub (Jan 10, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/1888 Originally assigned to: @dhiltgen on GitHub. Ollama has switched to using [NVML](https://developer.nvidia.com/nvidia-management-library-nvml) to detect the Nvidia environment. However, this method failed on WSL. Here is a short C code to validate the behavior. The `nvmlReturn_t` returns 9 [NVML_ERROR_DRIVER_NOT_LOADED = 9](https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceEnumvs.html#group__nvmlDeviceEnumvs_1g06fa9b5de08c6cc716fbf565e93dd3d0). This may make sense according to the implementation of Nvidia in WSL as it use the driver from Windows host. I can't find any document on this, one way or another. This issue prevents Ollama v0.1.18 and 0.1.19 from using Nvidia hardware in WSL. ```c #include <stdio.h> #include "gpu_info_cuda.h" cuda_init_resp_t resp; mem_info_t mem_info; void main(void) { nvmlReturn_t ret; cuda_init(&resp); ret = resp.ch.initFn(); printf("%d\n", ret); } ```
GiteaMirror added the bug label 2026-04-28 04:26:17 -05:00
Author
Owner

@taweili commented on GitHub (Jan 10, 2024):

This is fixed with the pull request #1897 to set the collect dynamic library is used in WSL.

<!-- gh-comment-id:1884964637 --> @taweili commented on GitHub (Jan 10, 2024): This is fixed with the pull request #1897 to set the collect dynamic library is used in WSL.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47594