Wsl2 Ubuntu , docker is not running

Hi,
When I try to run :
docker run --gpus all --env NVIDIA_DISBALE_REQUIRE=1 nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: 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[0004] error waiting for container: context canceled

nvidia-smi in windows gives me the following

I have DockerDesktop 3.4 also installed on my windows 10.

If you want to use Docker Desktop the only version that works right now is 3.3.0. See Guide to run CUDA + WSL + Docker with latest versions (21382 Windows build + 470.14 Nvidia) - CUDA / CUDA on Windows Subsystem for Linux - NVIDIA Developer Forums

Since you have the driver 470.76 I recommend to uninstall/disable Docker Desktop and install the nvidia docker in your WSL2 distro following this :: (nvidia.com)

I uninstalled Docker desktop. The only distro now is Ubuntu.
I set up the cuda toolkit 11-0 and tried to run sample application, BlackScholes . But it gives the output-

[./BlackScholes] - Starting…
CUDA error at …/…/common/inc/helper_cuda.h:777 code=35(cudaErrorInsufficientDriver) “cudaGetDeviceCount(&device_count)”

What could be possibly wrong?

uname -a gives the following output in Ubuntu:

Linux nling-test9 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
r

Update your kernel with wsl.exe --update. The " *code=35(cudaErrorInsufficientDriver)" error normally means you have installed the nvidia driver inside WSL2. Remove it, or reinstall the WSl2 distro because the only thing you need is the Windows driver 470.76.

Does that need to be done inside distro or windows command prompt?

From inside the distro. What’s the output for sudo apt search nvidia | grep -i installed ?

@onomatopellan ,
When I tried

wsl.exe --update

, following is the output:
Checking for updates…
No updates are available.
Kernel version: 5.10.16

Following is the output for :

sudo apt search nvidia | grep -i installed

I did re-install Ubuntu, set up cuda toolkit 11-0
I again tried running ./BlackScholes , it gave the same error
now, the

sudo apt search nvidia | grep -i installed
gives the following output

Something I forgot to ask, what’s the Windows build you are running? (winver.exe)

Also from inside WSL2, after installing nvidia docker, can you post the output of sudo nvidia-container-cli -k -d /dev/tty info ?

Version Dev (OS build 21390.2025)
When I restarted the computer, it seems okay now. But I’m not sure how to use the VSCODE for development. Do you have any options other than VScode to use GPU with WSL.

Thanks
Mareeta

The windows version of VSCODE works great with the WSL Remote extension.

Ok, cool.It works with VScode. Thanks for all help!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.