WSL2 CUDA driver detected on Windows but not on Ubuntu subsystem

Hi, all!

I have enabled all Hyper-V features, Virtualization, and Linux subsystem on Windows feature. And installed Ubuntu 20.04 from Windows Store.
In Windows Shell, when input:

C:\Users\*****>nvidia-smi

The output is:

Sun Feb 20 22:29:03 2022 
+-----------------------------------------------------------------------------+ 
| NVIDIA-SMI 511.79       Driver Version: 511.79       CUDA Version: 11.6     | 
|-------------------------------+----------------------+----------------------+ 
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC | 
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. | 
|                               |                      |               MIG M. | 
|===============================+======================+======================| 
|   0  NVIDIA GeForce ... WDDM  | 00000000:08:00.0 Off |                  N/A |
| 29%   16C    P8     9W / 250W |      0MiB / 11264MiB |      0%      Default | 
|                               |                      |                  N/A | 
+-------------------------------+----------------------+----------------------+ 
|   1  NVIDIA GeForce ... WDDM  | 00000000:09:00.0 Off |                  N/A | 
| 29%   17C    P8    10W / 250W |      0MiB / 11264MiB |      0%      Default | \
|                               |                      |                  N/A | 
+-------------------------------+----------------------+----------------------+ 
|   2  NVIDIA GeForce ... WDDM  | 00000000:41:00.0 Off |                  N/A | 
| 29%   23C    P8     9W / 250W |      0MiB / 11264MiB |      0%      Default | 
|                               |                      |                  N/A | 
+-------------------------------+----------------------+----------------------+ 
|   3  NVIDIA GeForce ... WDDM  | 00000000:42:00.0  On |                  N/A | 
| 41%   28C    P8    24W / 225W |    810MiB /  8192MiB |     16%      Default | 
|                               |                      |                  N/A | 
+-------------------------------+----------------------+----------------------+ 

+-----------------------------------------------------------------------------+ 
| Processes:                                                                  | 
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory | 
|        ID   ID                                                   Usage      | 
|=============================================================================| 
|    ...............................................................................................................................
+-----------------------------------------------------------------------------+ 

But in the Ubuntu 20.04 subsystem, when input:

*****@DESKTOP-L5VP5OD:~$ nvidia-smi 

The console shows:

Failed to initialize NVML: GPU access blocked by the operating system 
Failed to properly shut down NVML: GPU access blocked by the operating system 

When input:

*****@DESKTOP-L5VP5OD:~$ sudo nvidia-smi 

It responds:

sudo: nvidia-smi: command not found 

But all the drivers are there in this subsystem, when type:

*****@DESKTOP-L5VP5OD:~$ ls /usr/lib/wsl/lib 

It gives the output:

libcuda.so      libd3d12.so      libnvcuvid.so        libnvidia-encode.so    libnvidia-opticalflow.so    nvidia-smi 
libcuda.so.1    libd3d12core.so  libnvcuvid.so.1      libnvidia-encode.so.1  libnvidia-opticalflow.so.1 
libcuda.so.1.1  libdxcore.so     libnvdxdlkernels.so  libnvidia-ml.so.1      libnvwgf2umx.so 

What could be the cause?

1 Like