This article is contributed. See the original author and article here.
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 CUDA support
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.
- Windows Machine Learning Overview (docs.microsoft.com)
- Windows Machine Learning GitHub
- WinMLRunner, a tool for executing ONNX models using WinML with DirectML
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.
- TensorFlow on DirectML homepage
- tensorflow-directml PyPI project
- TensorFlow GitHub | RFC: TensorFlow on DirectML
- TensorFlow homepage
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.
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
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.