3

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?

Fariborz Ghavamian
  • 809
  • 2
  • 11
  • 23
  • Does this answer your question? [Rapids / docker: could not select device driver "" with capabilities: \[\[gpu\]\]](https://stackoverflow.com/questions/61689954/rapids-docker-could-not-select-device-driver-with-capabilities-gpu) – craq Dec 07 '22 at 22:33
  • potential answers: https://stackoverflow.com/a/61760988/1295595 https://github.com/NVIDIA/nvidia-docker/issues/1034#issuecomment-999637742 – craq Dec 07 '22 at 22:34

2 Answers2

3

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

wlane
  • 86
  • 6
  • I am having a problem with your solution that I reference in [this post](https://stackoverflow.com/questions/62975223/gpu-acceleration-with-wsl-2). Do you think you could give me a hand? – BlackCoffee Jul 19 '20 at 02:53
  • To do the above steps I also needed to add the nvidia apt repository via the guide here: https://nvidia.github.io/nvidia-docker/ ``` curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \ sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update ``` – aaron-prindle Aug 28 '22 at 03:24
1

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.

socasanta
  • 1,532
  • 9
  • 15