deviceQuery sample fails to run

I’ve tried to install CUDA in WSL2 by following the instructions at https://docs.nvidia.com/cuda/wsl-user-guide/index.html but I can’t get it to work. I’m using Ubuntu 20.04

Output of ver.exe (Windows):

Microsoft Windows [Version 10.0.20279.1]

Output of nvidia-smi.exe (Windows):

Wed Dec 16 18:00:47 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.12       Driver Version: 465.12       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 GTX 970    WDDM  | 00000000:01:00.0  On |                  N/A |
| 47%   28C    P8    17W / 250W |    435MiB /  4096MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       944    C+G   ...zilla Firefox\firefox.exe    N/A      |
|    0   N/A  N/A      1204    C+G   Insufficient Permissions        N/A      |
|    0   N/A  N/A      1944    C+G   ...lPanel\SystemSettings.exe    N/A      |
|    0   N/A  N/A      5136    C+G   ...8wekyb3d8bbwe\Cortana.exe    N/A      |
|    0   N/A  N/A      5824    C+G   C:\Windows\explorer.exe         N/A      |
|    0   N/A  N/A      6196    C+G   ...artMenuExperienceHost.exe    N/A      |
|    0   N/A  N/A      7128    C+G   ...5n1h2txyewy\SearchApp.exe    N/A      |
|    0   N/A  N/A      7380    C+G   ...y\ShellExperienceHost.exe    N/A      |
|    0   N/A  N/A      7392    C+G   ...2txyewy\TextInputHost.exe    N/A      |
|    0   N/A  N/A      7396    C+G   ...ekyb3d8bbwe\YourPhone.exe    N/A      |
|    0   N/A  N/A      8108    C+G   ...zilla Firefox\firefox.exe    N/A      |
|    0   N/A  N/A      8564    C+G   ...8bbwe\WindowsTerminal.exe    N/A      |
|    0   N/A  N/A      9972    C+G   ...in7x64\steamwebhelper.exe    N/A      |
|    0   N/A  N/A     11656    C+G   ...b3d8bbwe\WinStore.App.exe    N/A      |
+-----------------------------------------------------------------------------+

Output of cat /proc/version (WSL):

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

Output of apt list --installed | grep cuda (WSL):

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

cuda-command-line-tools-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-compiler-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-cudart-11-2/unknown,unknown,now 11.2.72-1 amd64 [installed,automatic]
cuda-cudart-dev-11-2/unknown,unknown,now 11.2.72-1 amd64 [installed,automatic]
cuda-cuobjdump-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-cupti-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-cupti-dev-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-cuxxfilt-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-documentation-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-driver-dev-11-2/unknown,unknown,now 11.2.72-1 amd64 [installed,automatic]
cuda-gdb-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-libraries-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-libraries-dev-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-memcheck-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nsight-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nsight-compute-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-nsight-systems-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-nvcc-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvdisasm-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvml-dev-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvprof-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvprune-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvrtc-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvrtc-dev-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvtx-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-nvvp-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-samples-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-sanitizer-11-2/unknown,unknown,now 11.2.67-1 amd64 [installed,automatic]
cuda-toolkit-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed]
cuda-tools-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]
cuda-visual-tools-11-2/unknown,unknown,now 11.2.0-1 amd64 [installed,automatic]

I installed cuda-toolkit-11-2, so there should be no driver installed in WSL to mess things up.
I can confirm that /dev/dxg exists.

The output of ls /usr/lib/wsl/lib/ is

libcuda.so    libcuda.so.1.1  libd3d12core.so  libdxcore.so       libnvwgf2umx.so
libcuda.so.1  libd3d12.so     libdirectml.so   libnvidia-ml.so.1

I compiled the deviceQuery sample. Its output is as follows:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 1
-> invalid argument
Result = FAIL

Using strace ./deviceQuery, I have confirmed it is loading /usr/lib/wsl/lib/libcuda.so.1. I’ve uploaded the full strace to https://pastebin.com/jcxVQyRh. I also tried a couple of other samples but they didn’t work either.

Looking at this, can anyone tell where I’ve gone wrong? I’ve tried the process twice, including deleting my WSL install and doing a clean-install of the driver.

1 Like

Tried other versions of CUDA toolkit, e.g. 11.1 or 11.0?

I’m in the same exact boat right now, sorry to say I don’t have any answers right now. It’s quite frustrating.

Hi,

Sorry for the inconvenience. Could you please try CUDA toolkit 11.1 ?

Works with 11.1.0 (not the 11.1 Update 1).

It seems that 465.21 and CUDA 11.2 are not compatible.

1 Like

I can confirm it works with the 11.1.1 runfile, just not the 11.2.0 runfile.

1 Like

Yep, can confirm as well - I’m using a WSL2/Debian setup and had gone with cuda-toolkit-11-2 initially. The DeviceQueryDrv sample reports the card, but DeviceQuery fails with the same output (cudaGetDeviceCount returned 1)

  • winver 21286.1000
  • nvidia driver is 465.12
  • 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

Things work more as expected if I install cuda-toolikit-11-1 and compile with nvcc from 11-1, instead of 11-2.