Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could not select device driver "" with capabilities: [[gpu]]

I am trying install Cuda on WSL 2. I am following instructions such as this.

After executing every step, I try to check if gpu is available in the Linux environment by executing docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark (as suggested by the aforementioned instructions).

But I get the following error: docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]. ERRO[0000] error waiting for container: context canceled.

Any ideas what might be the cause of this?

like image 618
Fariborz Ghavamian Avatar asked Jun 13 '26 00:06

Fariborz Ghavamian


2 Answers

I was having the same issue. Are you using Docker Desktop for Windows? Because I was, and I found out that WSL2 + CUDA does not work with Docker Desktop for Windows:

https://forums.developer.nvidia.com/t/hiccups-setting-up-wsl2-cuda/128641

Instead, install Docker manually in WSL2 (as is suggested in the tutorial you linked):

sudo apt update && sudo apt install -y nvidia-docker2

Then make sure you start the docker service:

sudo service docker start

After that, you can verify the CUDA/Docker/WSL2 setup with this:

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

Where you should see some output like this:

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

Windowed mode Simulation data stored in video memory Single precision floating point simulation 1 Devices used for simulation MapSMtoCores for SM 7.5 is undefined. Default to use 64 Cores/SM GPU Device 0: "GeForce RTX 2060" with compute capability 7.5

Compute 7.5 CUDA device: [GeForce RTX 2060] 30720 bodies, total time for 10 iterations: 52.181 ms = 180.854 billion interactions per second = 3617.077 single-precision GFLOP/s at 20 flops per interaction

like image 93
wlane Avatar answered Jun 15 '26 23:06

wlane


This issue of "could not select device driver with capabilities: [[gpu]] happened to me for a silly reason: NVIDIA driver keeps getting updated with new Insider builds.

I've gotten in the habit of running ./deviceQuery from the NVIDIA_CUDA-11.0_Samples to make sure all is well with CUDA on WSL and then checking my NVIDIA driver version if it returns that no devices are found (and then reinstalling the correct driver).

This may not be the best answer, but maybe it will save some time if you run into this.

like image 23
socasanta Avatar answered Jun 15 '26 22:06

socasanta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!