Windows10 WSL2 get error “cudaErrorInsufficientDriver”

System info:
Window10 1909(OS internal version 18363.1139)
NVIDIA GeForce RTX 2080

First, I install cuda driver with 460.20_gameready_win10-dch_64bit_international and get info as blow:

PS C:\Users\Neo> nvidia-smi.exe
±----------------------------------------------------------------------------+
| NVIDIA-SMI 460.20 Driver Version: 460.20 CUDA Version: 11.2 |
|-------------------------------±---------------------±---------------------+
| 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 GeForce RTX 2080 WDDM | 00000000:01:00.0 On | N/A |
| N/A 35C P8 5W / N/A | 919MiB / 8192MiB | 15% Default |
| | | N/A |
±------------------------------±---------------------±---------------------

Then I Install Linux subsystem

PS C:\Users\Neo> wsl --list --verbose
NAME STATE VERSION

  • Ubuntu-18.04 Running 2

PS C:\Users\Neo> wsl cat /proc/version
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020

Third, I Install cuda on linux subsystem, but get error when I run the BlackScholes

wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run
sudo sh cuda_11.1.1_455.32.00_linux.run

root@DESKTOP-QRJOSER:/usr/local/cuda# ./bin/nvcc --version
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

root@DESKTOP-QRJOSER:/usr/local/cuda/samples/4_Finance/BlackScholes# ./BlackScholes
[./BlackScholes] - Starting…
CUDA error at …/…/common/inc/helper_cuda.h:779 code=35(cudaErrorInsufficientDriver) “cudaGetDeviceCount(&device_count)”

1 Like

For CUDA in WSL2 you need a Windows Insider build version 20145 or superior.

CUDA on WSL :: CUDA Toolkit Documentation (nvidia.com)

my win10 is 20246,but have the same problem

In that case you need to uninstall the CUDA driver inside WSL2. This can be tricky so I recommend to uninstall your distro and install again.
In a brand new distro install you only need the Windows driver installed. You will know the GPU is detected if the file /dev/dxg exists.