CUDA error when running ./BlackScholes and nvidia-smi failure on WSL2

I am following the steps as described in CUDA on WSL User Guide.
Here are my current setup:

  • Machine: Dell Inspiron 7590
    • CPU: Intel(R) Core™ i5-9300H CPU @ 2.40GHz
    • GPU 0: Intel(R) UHD Graphics 630
    • GPU 1: NVIDIA GeForce GTX 1050
  • >ver: Microsoft Windows [Version 10.0.21390.1] (Home: Windows Insider Preview > Dev Channel)
  • >wsl -l -v: Ubuntu-20.04 Running 2
  • >wsl cat /proc/version: Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020
  • Driver: 470.14_gameready_win10-dch_64bit_international.exe

However when I try to run CUDA Application by executing the following commands on wsl …

cd /usr/local/cuda/samples/4_Finance/BlackScholes
sudo make

execution of the last line produces the following error:

CUDA error at …/…/common/inc/helper_cuda.h:779 code=35(cudaErrorInsufficientDriver) "cudaGetDeviceCount(&device_count)

Furthermore, executing the following …


produces these errors:

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

Failed to properly shut down NVML: Driver Not Loaded

How should I proceed from here to debug what is going on. Should I execute …

dpkg -l | grep nvidia

I did read the following but unfortunately to no avail.

Linux version 5.4.72

I recommend to update to the latest kernel with wsl.exe --update


Update your Nvidia windows drivers to at least 470.76 from CUDA on WSL | NVIDIA Developer

1 Like

@onomatopellan Thank you for pointing out that there are new versions. I downloaded and installed CUDA Driver on June 01, 2021 but I did not realize it was updated on June 04 (CUDA on WSL User Guide: Changelog). So I have upgraded WSL and NVIDIA Drivers for CUDA on WSL as you have suggested. I also upgraded my Windows too. Now my new setup is the following:

  • > ver: Microsoft Windows [Version 10.0.21390.1000] (Home: Windows Insider Preview > Dev Channel)
  • > wsl cat /proc/version: Linux version (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) #1 SMP Fri Apr 2 22:23:49 UTC 2021
  • > Driver: 470.76_gameready_win10-dch_64bit_international.exe

I then executed the ./BlackScholes and nvidia-smi command and they both worked. I am very excited. Thank you again. Hope your suggestion will help others in need.

1 Like