GPU not showing up on WSL2 (build 19042.985)

user@host:~$ uname -a
Linux host 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

user@host:~$ ls /dev/dxg
ls: cannot access ‘/dev/dxg’: No such file or directory

I followed the instructions linked below, except for changing my Windows update channel to development. I’m on build 19042.985, but I don’t think that should be a problem given my kernel version.

That’s normal. CUDA in WSL2 uses a new technology called GPU ParaVirtualization and in WSL2 is available since build 20145. For now is only in the Dev channel but it should be available for everyone in October-November in the upcoming Windows 10 version 21H2.

Does this mean something else is causing issues with my CUDA install? I get an error when trying to run the nbody benchmark.

user@host:~$ sudo service docker start
[sudo] password for user:
 * Starting Docker: docker                                                                                       [ OK ]
user@host:~$ sudo docker run --gpus all nbody -gpu -benchmark
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request: unknown.
ERRO[0000] error waiting for container: context canceled

Post the output of nvidia-container-cli -k -d /dev/tty info

user@host:~$ sudo nvidia-container-cli -k -d /dev/tty info

-- WARNING, the following logs are for debugging purposes only --

I0517 10:50:02.275642 254 nvc.c:372] initializing library context (version=1.4.0, build=704a698b7a0ceec07a48e56c37365c741718c2df)
I0517 10:50:02.275700 254 nvc.c:346] using root /
I0517 10:50:02.275766 254 nvc.c:347] using ldcache /etc/
I0517 10:50:02.275775 254 nvc.c:348] using unprivileged user 65534:65534
I0517 10:50:02.275797 254 nvc.c:389] attempting to load dxcore to see if we are running under Windows Subsystem for Linux (WSL)
I0517 10:50:02.275926 254 nvc.c:391] dxcore initialization failed, continuing assuming a non-WSL environment
W0517 10:50:02.276012 254 nvc.c:254] failed to detect NVIDIA devices
I0517 10:50:02.276237 255 nvc.c:274] loading kernel module nvidia
E0517 10:50:02.276381 255 nvc.c:276] could not load kernel module nvidia
I0517 10:50:02.276423 255 nvc.c:292] loading kernel module nvidia_uvm
E0517 10:50:02.276519 255 nvc.c:294] could not load kernel module nvidia_uvm
I0517 10:50:02.276555 255 nvc.c:301] loading kernel module nvidia_modeset
E0517 10:50:02.276583 255 nvc.c:303] could not load kernel module nvidia_modeset
I0517 10:50:02.276883 256 driver.c:101] starting driver service
E0517 10:50:02.277106 256 driver.c:168] could not start driver service: load library failed: cannot open shared object file: no such file or directory
I0517 10:50:02.277269 254 driver.c:203] driver service terminated successfully
nvidia-container-cli: initialization error: driver error: failed to process request

Since it can’t see /dev/dxg it errors failing to detect any NVIDIA device inside WSL2. In build 19042 CUDA only works in Windows and not inside WSL2.

Thank you very much for helping me troubleshoot this and for teaching me about the system. I suppose I need to either resign myself to being on the development branch of Windows 10 builds or wait for CUDA acceleration in WSL2 until the feature hits the stable ring.

1 Like