GPU compute within Windows Subsystem for Linux 2 supports AI and ML workloads
Published Jul 16 2020 02:46 AM 4,354 Views


DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported hardware and drivers, including all DirectX 12-capable GPUs from vendors such as AMD, Intel, NVIDIA, and Qualcomm.


The preview of GPU compute is now available within WSL 2 to Windows Insiders (Build 20150 or higher)! This preview will initially support artificial intelligence (AI) and machine learning (ML) workflows, enabling professionals and students alike to run ML training workloads across the breadth of GPUs in the Windows ecosystem.



NVIDIA’s CUDA as the optimized path for GPU hardware acceleration is typically utilised to enable data scientists to use hardware-acceleration in their training scripts on NVIDIA GPUs.

NVIDIA CUDA support has been present on Windows for years. However, there is a variety of CUDA compute applications that only run in a native Linux environment. However there is now CUDA inside WSL 2. There is a  preview of CUDA for WSL 2. This preview includes support for existing ML tools, libraries, and popular frameworks, including PyTorch and TensorFlow. As well as all the Docker and NVIDIA Container Toolkit support available in a native Linux environment, allowing containerized GPU workloads built to run on Linux to run as-is inside WSL 2.


Empowering educators and students through DirectML

The DirectML API enables accelerated inference for machine learning models on any DirectX 12 based GPU, and we are extending its capabilities to support training.


In addition, we intend to integrate DirectML with popular machine learning tools, libraries, and frameworks so that they can automatically use it as a hardware-acceleration backend on Windows.


DirectML works well in Windows or Windows Subsystem for Linux WSL. By doing so, our intent is to fully empower students to learn in the Windows or Linux environment that works for them, on the hardware they already have.


For more information, see Get Started with Windows ML.


ONNX Runtime on DirectML

ONNX Runtime is a cross-platform inferencing and training accelerator compatible with many popular ML/DNN frameworks, including PyTorch, TensorFlow/Keras, scikit-learn, and more.

DirectML is available as an optional execution provider for ONNX Runtime that provides hardware acceleration when running on Windows 10.

For more information about getting started, see Using the DirectML execution provider.


Tensorflow with DirectML

We have a preview package of TensorFlow with a DirectML backend. Students and beginners can start with the TensorFlow tutorial models or our examples to start building the foundation for their future. In line with this, we are also engaging with the TensorFlow community through their RFC process. We plan to open source our extension of the TensorFlow code base that works with DirectML.


For WSL See 

For Windows See


DirectML on GitHub

When used standalone, the DirectML API is a low-level DirectX 12 library and is suitable for high-performance, low-latency applications such as frameworks, games, and other real-time applications. The seamless interoperability of DirectML with Direct3D 12 as well as its low overhead and conformance across hardware makes DirectML ideal for accelerating machine learning when both high performance is desired, and the reliability and predictability of results across hardware is critical.

More information about DirectML can be found in Introduction to DirectML.

Your feedback

If you have feedback on the NVIDIA CUDA path for WSL, please share it via the Community Forum for CUDA on WSL. For feedback on the TensorFlow with DirectML package, please use the DirectML GitHub repo.


Getting started using GPU with WSL

In order to get your system setup please use our getting started documentation.


Keep upto date with announcement on WSL

To stay in the loop on our latest news and future updates, stay tuned to the Windows Command Line blog and follow @crahrig on Twitter!


Version history
Last update:
‎Jul 16 2020 02:48 AM
Updated by: