Docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

I have been trying for several days to get CUDA on Windows Subsystem for Linux 2 working and I think this is my last roadblock.

When I test this:
sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

I get this output:
docker: Error response from daemon: could not select device driver “” with capabilities: [[gpu]].

In Ubuntu
nvidia-smi
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

In powershell nvidia-smi
±----------------------------------------------------------------------------+
| NVIDIA-SMI 455.41 Driver Version: 455.41 CUDA Version: 11.1 |
|-------------------------------±---------------------±---------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce RTX 2080 WDDM | 00000000:01:00.0 On | N/A |
| N/A 36C P8 8W / N/A | 850MiB / 8192MiB | 3% Default |
±------------------------------±---------------------±---------------------+

I am running
6/17/2020: Initial Version.
(This driver is 3 days old)
The following software versions are supported with this preview release for WSL 2:

  • NVIDIA Driver for Windows 10: 455.38
  • NVIDIA Container Toolkit: nvidia-docker2 (2.3) and libnvidia-container (1.2.0-rc.1)
    Install the driver using the executable. This is the only driver you need to install.
    Note: Do not install any Linux display driver in WSL. The Windows Display Driver will install both the regular driver components for native Windows and for WSL support.

Windows 10, Version 2004 (OS Build 20150.1000)
WSL2
Ubuntu-18.04
Linux version 4.19.121-microsoft-WSL2-standard
Docker 19.03.6

I have tried basically everything I could find to fix this with no luck. I have even started over from scratch with Ubuntu and end up at the same place.

This probably the best reference I have found and it is also only 3 days old.

sudo sh NVIDIA-Linux-x86_64-440.82.run
sudo apt install nvidia-settings
sudo apt install cuda-drivers
sudo sh cuda_11.0.1_450.36.06_linux.run
sudo apt install nvidia-cuda-toolkit
sudo apt-get install nvidia-driver-440
sudo apt-get install cuda
and many more…
In addition to DirectX and CUDA support, NVIDIA is also adding support for the NVIDIA Container Toolkit (previously nvidia-docker2) within WSL 2

1 Like

The Linux cuda driver (libcuda.so) is provided by the Windows driver
https://developer.nvidia.com/cuda/wsl/download
So you mustn’t install any driver in Linux since this would break it. Since have nvidia-smi installed in Linux, you’ve already lost. Start with a clean slate, install the WSL preview driver.
You could then install the cuda-toolkit by
following the install instructions on the download page but not doing the last step, installing cuda using
sudo apt install cuda
since this would also install the nvidia driver. Instead, use
sudo apt install cuda-toolkit-11-0
to install just the toolkit. You could then use the included queryDevice sample to check if cuda is running.
Or install the nvidia docker container.

First of all, thank you for your reply.

I did a clean slate of UBUNTU and started over documenting as I went.

The forum won’t let me reply with more than 3 URL’s so I put the steps here:

https://www.dropbox.com/s/e6dssghvn3cd0ul/nvidia-response-forum.txt?dl=1

(test again - same error)
sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
docker: Error response from daemon: could not select device driver “” with capabilities: [[gpu]].
ERRO[0000] error waiting for container: context canceled

1 Like

I finally got it to work and wanted to post a follow up.

From this page:

I ran the code below this section:
Install the NVIDIA Container Toolkit. WSL 2 support is available starting with nvidia-docker2 v2.3 and the underlying runtime library libnvidia-container 1.2.0-rc.1.

Now receiving this error:
docker: Error response from daemon: cgroups: cannot find cgroup mount destination: unknown.

I found this post from mylesagray:
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

and now it works! Thank you.


MapSMtoCores for SM 7.5 is undefined. Default to use 64 Cores/SM
GPU Device 0: “GeForce RTX 2080” with compute capability 7.5

Compute 7.5 CUDA device: [GeForce RTX 2080]
47104 bodies, total time for 10 iterations: 69.063 ms
= 321.269 billion interactions per second
= 6425.381 single-precision GFLOP/s at 20 flops per interaction

3 Likes

Thank you! I tried one thousand things. This was the only one working

you are the goat