CUDA WSL2 with pre-release Windows 10 21H2 (19044)

Hi Forum,

I’m interested in working with CUDA on WSL2, but don’t have a spare machine (or courage) to use Windows beta or dev releases. Reading about the pre-release version available, I’ve upgraded to the latest pre-release version of 21H2 (19044), which I read should support GPU usage in VMs, including WSL2.

However, even after doing this, upgrading to the latest linux kernel, and installing the proper nvidia packages in ubuntu, I’m still not seeing /dev/dxg and the libraries from lxss aren’t appearing in the ubuntu tree.

I’m guessing the (disappointing) issue is that the 19044 build of 21H2 doesn’t have the right juju built in to make this work. Can anyone confirm? Has anyone succeeded?

Steve,

Glad to know you are interested in CUDA on WSL2.

Our user guide can be found here CUDA on WSL :: CUDA Toolkit Documentation

You may find below section more useful. At present WSL2. is available only to Windows Insider Program users. The minimum OS build is 20145, although we recommend the latest WIP OS available for better performance and latest features.

2.1. WSL 2 System Requirements

  • Ensure you are registered on Windows Insider Program and subscribing to the Dev Channel and OS build is 20145 or later. We recommend at least OS 21390 or higher for latest features and performance updates.
  • Windows 11 is supported. Refer to Windows 11 system requirements.
  • Ensure the WSL Kernel installed is the latest version or at least 4.19.121+. Once again, we recommend 5.10.16.3 or later for better performance.
  • WSL2 GPU acceleration will be available on Pascal and later GPU architecture on both GeForce and Quadro product SKUs in WDDM mode. It will not be available on Quadro GPUs in TCC mode or Tesla GPUs yet.

Should be available since build 19044.1200 in the Release Preview channel.

Announcing Windows 10 Insider Preview Build 19044.1200 (21H2) | Windows Insider Blog

1 Like

just tried with no luck

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

@ManuInNZ Can you see the file /dev/dxg in bash?

$ ls -la /dev/dxg
crw-rw-rw- 1 root root 10, 63 Aug 13 13:16 /dev/dxg

yep

$ls -l /dev/dxg
crw-rw-rw- 1 root root 10, 63 Aug 20 11:47 /dev/dxg

FYI – as OP here. I did get the 19044.1200 build, and was able to build/run BlackSholes and a bunch of other things successfully! (thanks to whoever pinged the thread when the release was made).

Now I’m trying to figure out the right way to build something that wants “GL/gl.h”, but not stuck yet…

got it to work with the right driver I suppose. https://developer.nvidia.com/cuda/wsl/download
I ran the all-in-one install package too again as opposed to the steps by steps. https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0

$ sudo sh cuda_11.4.1_470.57.02_linux.run

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.4/
Samples:  Installed in /home/myhome/, but missing recommended libraries

Please make sure that
 -   PATH includes /usr/local/cuda-11.4/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.4/lib64, or, add /usr/local/cuda-11.4/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.4/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 470.00 is required for CUDA 11.4 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver

Logfile is /var/log/cuda-installer.log

Running deviceQuery also confirmed it was reading correctly my GPU.

yet same as @stevek I can’t build really other samples.

/usr/local/cuda-11.4/samples/5_Simulations/smokeParticles$ make
dpkg-query: no packages found matching nvidia-*
>>> WARNING - libGL.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - libGLU.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - gl.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> WARNING - glu.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
>>> GCC Version is greater or equal to 5.0.0 <<<
1 Like

4.7. Extra Libraries

If you wish to build all the samples, including those with graphical rather than
command-line interfaces, additional system libraries or headers may be required.
While every Linux distribution is slightly different with respect to package names and
package installation procedures, the libraries and headers most likely to be necessary are
OpenGL (e.g., Mesa), GLU, GLUT, and X11 (including Xi, Xmu, and GLX).
On Ubuntu, those can be installed as follows:

$ sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
 libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Read more in NVIDIA CUDA Getting Started Guide for Linux

Installation Guide Linux :: CUDA Toolkit Documentation (nvidia.com).

1 Like