microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.31k stars 814 forks source link

Error: only 0 Devices available, 1 requested. Exiting. #10253

Open minwim opened 1 year ago

minwim commented 1 year ago

Windows Version

Microsoft Windows [version 10.0.22621.1848]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90

Distro Version

Ubuntu 22.04

Other Software

Docker version 24.0.2, build cb74dfc

Repro Steps

when I run docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

Expected Behavior

GPU can be used

Actual Behavior

root@DESKTOP-UOKSUTD:~# sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark Run "nbody -benchmark [-numbodies=]" to measure performance. -fullscreen (run n-body simulation in fullscreen mode) -fp64 (use double precision floating point values for simulation) -hostmem (stores simulation data in host memory) -benchmark (run benchmark to measure performance) -numbodies= (number of bodies (>= 1) to run in simulation) -device= (where d=0,1,2.... for the CUDA device to use) -numdevices= (where i=(number of CUDA devices > 0) to use for simulation) -compare (compares simulation results running once on the default GPU and once on the CPU) -cpu (run n-body simulation on the CPU) -tipsy= (load a tipsy model file for simulation)

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

Error: only 0 Devices available, 1 requested. Exiting.

Diagnostic Logs

root@DESKTOP-UOKSUTD:~# sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark Run "nbody -benchmark [-numbodies=]" to measure performance. -fullscreen (run n-body simulation in fullscreen mode) -fp64 (use double precision floating point values for simulation) -hostmem (stores simulation data in host memory) -benchmark (run benchmark to measure performance) -numbodies= (number of bodies (>= 1) to run in simulation) -device= (where d=0,1,2.... for the CUDA device to use) -numdevices= (where i=(number of CUDA devices > 0) to use for simulation) -compare (compares simulation results running once on the default GPU and once on the CPU) -cpu (run n-body simulation on the CPU) -tipsy= (load a tipsy model file for simulation)

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

Error: only 0 Devices available, 1 requested. Exiting.

rayondemiel commented 1 year ago

I've same problem here :( . Did you found a solution to fix it?

alexhegit commented 11 months ago

I've same problem with WSL2

rayondemiel commented 11 months ago

I've found an explanation and how to get around the problem. First you need to install Nvidia Container Kit, if you haven't already. The problem is that it doesn't work with docker desktop. If you use it, you need to create a new context in order to use docker engine only (issue #1717).

Hoping to help.

JasonHe-WQ commented 4 months ago

I've found an explanation and how to get around the problem. First you need to install Nvidia Container Kit, if you haven't already. The problem is that it doesn't work with docker desktop. If you use it, you need to create a new context in order to use docker engine only (issue #1717).

Hoping to help.

It occurs to me too, cloud you plz explain how to create a new context with detail?

santonymous commented 4 months ago

I also experienced the same problem docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark docker: error during connect: in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect: Head "http://%2F%2F.%2Fpipe%2Fdocker_engine/_ping": open //./pipe/docker_engine: The system cannot find the file specified. See 'docker run --help'. PS C:\Users\Indo Online> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark Run "nbody -benchmark [-numbodies=]" to measure performance. -fullscreen (run n-body simulation in fullscreen mode) -fp64 (use double precision floating point values for simulation) -hostmem (stores simulation data in host memory) -benchmark (run benchmark to measure performance) -numbodies= (number of bodies (>= 1) to run in simulation) -device= (where d=0,1,2.... for the CUDA device to use) -numdevices= (where i=(number of CUDA devices > 0) to use for simulation) -compare (compares simulation results running once on the default GPU and once on the CPU) -cpu (run n-body simulation on the CPU) -tipsy= (load a tipsy model file for simulation)

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

Error: only 0 Devices available, 1 requested. Exiting.

rayondemiel commented 4 months ago

I've found an explanation and how to get around the problem. First you need to install Nvidia Container Kit, if you haven't already. The problem is that it doesn't work with docker desktop. If you use it, you need to create a new context in order to use docker engine only (issue #1717). Hoping to help.

It occurs to me too, cloud you plz explain how to create a new context with detail?

So I don't know if the problem is still the same, because it seems to me that maj docker has changed its behavior with WSL (https://docs.docker.com/desktop/gpu/). Normally, it's taken care of now.

Before, Docker desktop didn't support GPU support. So you had to change the execution context to dockerd docker context use default.

rayondemiel commented 4 months ago

I also experienced the same problem docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark docker: error during connect: in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect: Head "http://%2F%2F.%2Fpipe%2Fdocker_engine/_ping": open //./pipe/docker_engine: The system cannot find the file specified. See 'docker run --help'. PS C:\Users\Indo Online> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark Run "nbody -benchmark [-numbodies=]" to measure performance. -fullscreen (run n-body simulation in fullscreen mode) -fp64 (use double precision floating point values for simulation) -hostmem (stores simulation data in host memory) -benchmark (run benchmark to measure performance) -numbodies= (number of bodies (>= 1) to run in simulation) -device= (where d=0,1,2.... for the CUDA device to use) -numdevices= (where i=(number of CUDA devices > 0) to use for simulation) -compare (compares simulation results running once on the default GPU and once on the CPU) -cpu (run n-body simulation on the CPU) -tipsy= (load a tipsy model file for simulation)

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

Error: only 0 Devices available, 1 requested. Exiting.

I had the same problem, I updated the packages on wsl as well as docker-desktop. Then I had a problem initializing NVML. I followed this solution and it works: https://forums.developer.nvidia.com/t/nvida-container-toolkit-failed-to-initialize-nvml-unknown-error/286219/2

wirytiox commented 4 months ago

running on the same issue, if anybody needs a log or something please ask!

shahriyardx commented 3 months ago

No matter what I do, it does not work. Tried every single solution available

kand7dev commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

shahriyardx commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible.

I'm stuck for 2 days on this.

kand7dev commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible.

I'm stuck for 2 days on this.

Driver Version: 555.99

CUDA Version: 12.5

WSL Version: 2.2.4.0

Docker Desktop Version: 4.31.0

After running docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Ampere" with compute capability 8.6

> Compute 8.6 CUDA device: [NVIDIA GeForce RTX 3060]
28672 bodies, total time for 10 iterations: 22.861 ms
= 359.604 billion interactions per second
= 7192.081 single-precision GFLOP/s at 20 flops per interaction
shahriyardx commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible. I'm stuck for 2 days on this.

Driver Version: 555.99

CUDA Version: 12.5

WSL Version: 2.2.4.0

Docker Desktop Version: 4.31.0

After running docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Ampere" with compute capability 8.6

> Compute 8.6 CUDA device: [NVIDIA GeForce RTX 3060]
28672 bodies, total time for 10 iterations: 22.861 ms
= 359.604 billion interactions per second
= 7192.081 single-precision GFLOP/s at 20 flops per interaction

Can you also say what you installed on both inside ubuntu and in your windows for the cuda to work

Also what is the ubuntu version on your WSL, what is the default distro of wsl and anything else that might be important to have a look at

kand7dev commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible. I'm stuck for 2 days on this.

Driver Version: 555.99 CUDA Version: 12.5 WSL Version: 2.2.4.0 Docker Desktop Version: 4.31.0 After running docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Ampere" with compute capability 8.6

> Compute 8.6 CUDA device: [NVIDIA GeForce RTX 3060]
28672 bodies, total time for 10 iterations: 22.861 ms
= 359.604 billion interactions per second
= 7192.081 single-precision GFLOP/s at 20 flops per interaction

Can you also say what you installed on both inside ubuntu and in your windows for the cuda to work

Also what is the ubuntu version on your WSL, what is the default distro of wsl and anything else that might be important to have a look at

I haven't installed the CUDA Toolkit inside of Ubuntu. Just the NVIDIA Studio Driver on my Windows machine. I am using the default WSL distro Ubuntu 22.04.

santonymous commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible. I'm stuck for 2 days on this.

Driver Version: 555.99

CUDA Version: 12.5

WSL Version: 2.2.4.0

Docker Desktop Version: 4.31.0

After running docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Ampere" with compute capability 8.6

> Compute 8.6 CUDA device: [NVIDIA GeForce RTX 3060]
28672 bodies, total time for 10 iterations: 22.861 ms
= 359.604 billion interactions per second
= 7192.081 single-precision GFLOP/s at 20 flops per interaction

Problem Solved!!! Thanks Bro

ErgEnn commented 3 months ago

I had Docker Desktop Version: 4.30.0 and got the: Error: only 0 Devices available, 1 requested. Exiting.

Updated to 4.31.1 and got the:

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Pascal" with compute capability 6.1

> Compute 6.1 CUDA device: [NVIDIA GeForce GTX 1080 Ti]
28672 bodies, total time for 10 iterations: 24.321 ms
= 338.013 billion interactions per second
= 6760.262 single-precision GFLOP/s at 20 flops per interaction
akash-siv commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

thank you solved my issue.

akash-siv commented 3 months ago

Running latest WSL, Docker Desktop and NVIDIA driver fixes the issue on my end. I can provide versions if someone’s interested.

Yeah also provide what things you are following if possible. I'm stuck for 2 days on this.

Driver Version: 555.99

CUDA Version: 12.5

WSL Version: 2.2.4.0

Docker Desktop Version: 4.31.0

After running docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Ampere" with compute capability 8.6

> Compute 8.6 CUDA device: [NVIDIA GeForce RTX 3060]
28672 bodies, total time for 10 iterations: 22.861 ms
= 359.604 billion interactions per second
= 7192.081 single-precision GFLOP/s at 20 flops per interaction

did exactly the same and worked for me

l2aelba commented 3 months ago

Yes! just updated Docker Desktop Version to 4.31.1

alexkranias commented 1 month ago

Worked for me as well!