While WSL’s default setup allows you to develop cross-platform applications without leaving Windows, enabling GPU acceleration inside WSL provides users with direct access to the hardware. This provides support for GPU-accelerated AI/ML training and the ability to develop and test applications built on top of technologies, such as OpenVINO, OpenGL, and CUDA that target Ubuntu while staying on Windows.
What you will learn:
- How to install a Windows graphical device driver compatible with WSL2
- How to install the NVIDIA CUDA toolkit for WSL 2 on Ubuntu
- How to compile and run a sample CUDA application on Ubuntu on WSL2
What you will need:
- A Windows 10 version 21H2 or newer physical machine equipped with an NVIDIA graphics card and administrative permission to be able to install device drivers
- Ubuntu on WSL2 previously installed
- Familiarity with Linux command line utilities and interacting with Ubuntu on WSL2
Note: If you need more introductory topics, such as how to install Ubuntu on WSL, refer to previous tutorials that can be found here for Windows 11 and here for Windows 10.
Prerequisites
The following steps assume a specific hardware configuration. Although the concepts are essentially the same for other architectures, different hardware configurations will require the appropriate graphics drivers and CUDA toolkit.
Make sure the following prerequisites are met before moving forward:
- A physical machine with Windows 10 version 21H2 or higher
- NVIDIA’s graphic card
- Ubuntu 20.04 or higher installed on WSL 2
- Broadband internet connection able to download a few GB of data