CUDA on WSL User Guide

The guide for using NVIDIA CUDA on Windows Subsystem for Linux.

NVIDIA ® V100 Tensor Core is the most advanced data center GPU ever built to accelerate AI, high performance computing (HPC), data science and graphics. It’s powered by NVIDIA Volta architecture, comes in 16 and 32GB configurations, and offers the performance of up to 32 CPUs in a single GPU. Data scientists, researchers, and engineers can. NVIDIA® Nsight™ Systems is a system-wide performance analysis tool designed to visualize an application’s algorithms, help you identify the largest opportunities to optimize, and tune to scale efficiently across any quantity or size of CPUs and GPUs; from large server to our smallest SoC. Download Now Overview NVIDIA Nsight Systems is a low overhead performance analysis tool designed to.


Now install the NVIDIA Container Toolkit (previously known as nvidia-docker2). WSL 2 support is available starting with nvidia-docker2 v2.3 and the underlying runtime library ( libnvidia-container = 1.2.0-rc.1).

Windows Subsystem for Linux (WSL) is a Windows 10 feature that enables users to run native Linux command-line tools directly on Windows. WSL is a containerized environment within which users can run Linux native applications from the command line of the Windows 10 shell without requiring the complexity of a dual boot environment. Internally, WSL is tightly integrated with the Microsoft Windows operating system, which allows it to run Linux applications alongside traditional Windows desktop and modern store apps.

Figure 1. CUDA on WSL Overview

With WSL 2 and GPU paravirtualization technology, Microsoft enables developers to run GPU accelerated applications on Windows.

The following document describes a workflow for getting started with running CUDA applications or containers in a WSL 2 environment.
Note: CUDA on WSL 2 is enabled on GPUs starting with the Kepler architecture; however, we recommend running CUDA on WSL 2 on Turing or newer architectures.

Getting Started

Getting started with running CUDA on WSL requires you to complete these steps in order:

Installing Microsoft Windows Insider Program Builds

Install the latest builds from the Microsoft Windows Insider Program

  • Register for the Microsoft Windows Insider Program.

  • Install the latest build from the Dev Channel.


    Ensure that you install Build version 20145 or higher. We recommend being on WIP OS 21332 and higher with Linux Kernel 5.4.91+ for the best performance.

    You can check your build version number by running winver via the Windows Run command.

Installing NVIDIA Drivers

  • Download the NVIDIA Driver from the download section on the CUDA on WSL page. Choose the appropriate driver depending on the type of NVIDIA GPU in your system - GeForce and Quadro.

  • Install the driver using the executable. This is the only driver you need to install.

  • The DirectX WSL driver is installed automatically along with other driver components so no additional action is needed for installation. This driver enables graphics on WSL2.0 by supporting DX12 APIs. TensorFlow with DirectML support on WSL will get NV GPU hardware acceleration for training and inference workloads. There are no present capabilities in WSL, hence the driver is oriented towards compute/machine learning tasks. For some helpful examples, see


Nvidia Localsystem Container Download

Do not install any Linux display driver in WSL. The Windows Display Driver will install both the regular driver components for native Windows and for WSL support.


NVIDIA is aware of a specific installation issue reported on mobile platforms with the WIP driver 465.12 posted on 11/16/2020. A known workaround will be to disable and reenable the GPU adapter from device manager at system start. We are working on a fix for this issue and will have an updated driver soon.

As an alternative, users may opt to roll back to an earlier driver from device manager driver updates.

Installing WSL 2

This section includes details about installing WSL 2, including setting up a Linux distribution of your choice from the Microsoft Store.

  1. Install WSL 2 by following the instructions in the Microsoft documentation available here.
  2. Ensure you have the latest kernel by clicking “Check for updates” in the “Windows Update” section of the Settings app. If the right update with the kernel 4.19.121+ is installed, you should be able to see it in the Windows Update history. Alternatively, you can check the version number by running the following command in PowerShell:

  3. If you don’t see this update, then in the Windows Update Advanced options, make sure to enable recommended Microsoft updates and run the check again:

  4. If you don’t have the last WSL kernel updated, you will see the following blocking warning upon trying to launch a Linux distribution within WSL 2.

  5. Launch the Linux distribution and make sure it runs in WSL 2 mode using the following command:

Setting up CUDA Toolkit

It is recommended to use the Linux package manager to install the CUDA for the Linux distributions supported under WSL 2. Follow these instructions to install the CUDA Toolkit.

First, set up the CUDA network repository. The instructions shown here are for Ubuntu 18.04. See the CUDA Linux Installation Guide for more information on other distributions.

Now install CUDA. Note that for WSL 2, you should use the cuda-toolkit-<version> meta-package to avoid installing the NVIDIA driver that is typically bundled with the toolkit. You can also install other components of the toolkit by choosing the right meta-package.

Do not choose the cuda, cuda-11-0, or cuda-drivers meta-packages under WSL 2 since these packages will result in an attempt to install the Linux NVIDIA driver under WSL 2.

Running CUDA Applications

Just run your CUDA app as you would run it under Linux! Once the driver is installed there is nothing more to do to run existing CUDA applications that were built on Linux.

A snippet of running the BlackScholes Linux application from the CUDA samples is shown below.

Build the CUDA samples available under /usr/local/cuda/samples from your installation of the CUDA Toolkit in the previous section. The BlackScholes application is located under /usr/local/cuda/samples/4_Finance/BlackScholes. Alternatively, you can transfer a binary built on Linux to WSL 2!

Setting up to Run Containers

This chapter describes the workflow for setting up the NVIDIA Container Toolkit in preparation for running GPU accelerated containers.

Install Docker

Use the Docker installation script to install Docker for your choice of WSL 2 Linux distribution. Note that NVIDIA Container Toolkit does not yet support Docker Desktop WSL 2 backend.

Note: For this release, install the standard Docker-CE for Linux distributions.

Install NVIDIA Container Toolkit

Now install the NVIDIA Container Toolkit (previously known as nvidia-docker2). WSL 2 support is available starting with nvidia-docker2 v2.3 and the underlying runtime library (libnvidia-container >= 1.2.0-rc.1).

For brevity, the installation instructions provided here are for Ubuntu 18.04 LTS.

Setup the stable and experimental repositories and the GPG key. The changes to the runtime to support WSL 2 are available in the experimental repository.

Install the NVIDIA runtime packages (and their dependencies) after updating the package listing.

Open a separate WSL 2 window and start the Docker daemon again using the following commands to complete the installation.

Running CUDA Containers

In this section, we will walk through some examples of running GPU containers in a WSL 2 environment.

Simple CUDA Containers

In this example, let’s run an N-body simulation CUDA sample. This example has already been containerized and available from NGC.

From the console, you should see an output as shown below.

Jupyter Notebooks

In this example, let’s run Jupyter notebook.

After the container starts, you can see the following output on the console.

After the URL is available from the console output, input the URL into your browser to start developing with the Jupyter notebook. Ensure that you replace with localhost in the URL when connecting to the Jupyter notebook from the browser.

If you navigate to the Cell menu and select the Run All item, then check the log within the Jupyter notebook WSL 2 container to see the work accelerated by the GPU of your Windows PC.

Deep Learning Framework Containers

Nvidia-container-toolkit Download

In this example, let’s run a TensorFlow container to do a ResNet-50 training run using GPUs using the 20.03 container from NGC. This is done by launching the container and then running the training script from the nvidia-examples directory.

Let's look at another example from Lesson 15 of the Learning TensorFlow tutorial. In this example, the code creates a random matrix with a given size as input and then does a element wise operation on the input tensor.

The example also allows you to observe the speedup when the code is run on the GPU. The source code is shown below.

Save the code as on the host's C drive, which is mapped as /mnt/c in WSL 2. Run the code using the same 20.03 TensorFlow container in the previous example. The results of running this script, launched from the mounted drive C, on a GPU and a CPU are shown below. For simplicity the output is reduced.

The same example is now run on the CPU.

Get started quickly with AI training using pre-trained models available from NVIDIA and the NGC catalog. Follow the instructions in this post for more details.


  • 3/23/2021: Resolved issues with nvidia-smi crashing on some systems.
    • NVIDIA Driver for Windows 10: 470.14
    • WIP build: 21332, WSL Linux kernel 5.4.91
  • 3/9/2021
    • WIP OS 21313+ and Linux kernel 5.4.91
    • Do not use WIP OS 21327
  • 1/28/2021: CUDA Toolkit 11.2 support, nvidia-smi, NVML support and critical performance improvements.
    The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 465.42
    • Recommended WIP build: 21292
  • 12/16/2020: Support for 3060Ti. Fix for installation problems observed in notebooks.
    The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 465.21
  • 11/16/2020: The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 465.12
  • 9/23/2020: The following software versions are supported with this preview release for WSL 2:
  • 9/2/2020:
    The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 460.15
  • 6/19/2020: Updated driver release to address cache coherency issues on some CPU systems, including AMD Ryzen.

    The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 455.41
  • 6/17/2020: Initial Version.

    The following software versions are supported with this preview release for WSL 2:
    • NVIDIA Driver for Windows 10: 455.38
    • NVIDIA Container Toolkit: nvidia-docker2 (2.3) and libnvidia-container (>= 1.2.0-rc.1)

7.1. New Features

The following new features are included in this release:

  • CUDA Toolkit 11.2 support
  • Critical performance improvements
  • nvidia-smi packaged
  • Full NVML support
  • IPC support

7.2. Resolved Issues

The following issues are resolved in this release:
  • Fixed nvidia-smi issues on some systems.

7.3. Known Limitations

The following features are not supported in this release:

  1. Note that NVIDIA Container Toolkit does not yet support Docker Desktop WSL 2 backend. Use Docker-CE for Linux instead inside your WSL 2 Linux distribution.
  2. nvidia-smi is now supported but in order to use it, please copy it to /usr/bin and set appropriate permissions with the below commands: We will soon provide a better user experience when there is OS support.
  3. CUDA debugging or profiling tools are not supported in WSL 2. This capability will be added in a future release.
  4. cumemmap IPC with fd is now supported. Other Legacy IPC APIs are not yet supported.
  5. Unified Memory is limited to the same feature set as on native Windows systems.
  6. With the NVIDIA Container Toolkit for Docker 19.03, only --gpus all is supported. This means that on multi-GPU systems it is not possible to filter for specific GPU devices by using specific index numbers to enumerate GPUs.
  7. When installing CUDA using the package manager, do not use the cuda, cuda-11-0, or cuda-drivers meta-packages under WSL 2. These packages have dependencies on the NVIDIA driver and the package manager will attempt to install the NVIDIA Linux driver which may result in issues. The NVIDIA Windows 10 driver should be the only driver present in the system.
  8. When running the NGC Deep Learning (DL) Framework GPU containers in WSL 2, you may encounter a message: Note that this message is an incorrect warning for WSL 2 and will be fixed in future releases of the DL Framework containers to correctly detect the NVIDIA GPUs. The DL Framework containers will still continue to be accelerated using CUDA on WSL 2.

7.4. Known Issues

The following are known issues in this release:

  • CUDA on WSL2 is not to be used with the latest Microsoft Windows 10 Insider Preview Build 20226 due to known issues. Please use newer builds >= 20236 or revert to the older build 20221 to use CUDA on WSL2.
  • Warning: Please do not update to WIP OS 21327 if you would like to use WSL with GPU support.


Here is a collection of potential errors that you may encounter when using CUDA on WSL 2:

Nvidia telemetry container download

Container Runtime Initialization Errors

  • In some cases, when running a Docker container, you may encounter nvidia-container-cli : initialization error:
  • This usually indicates that the right Microsoft Windows Insider Preview Builds, WSL 2, NVIDIA drivers and NVIDIA Container Toolkit may not be installed correctly. Use the dxdiag tools from the Run dialog and provide the diagnostic logs to NVIDIA. You can also use the CUDA on WSL 2 Forums to get in touch with NVIDIA product and engineering teams for help.



This document is provided for information purposes only and shall not be regarded as a warranty of a certain functionality, condition, or quality of a product. NVIDIA Corporation (“NVIDIA”) makes no representations or warranties, expressed or implied, as to the accuracy or completeness of the information contained in this document and assumes no responsibility for any errors contained herein. NVIDIA shall have no liability for the consequences or use of such information or for any infringement of patents or other rights of third parties that may result from its use. This document is not a commitment to develop, release, or deliver any Material (defined below), code, or functionality.

NVIDIA reserves the right to make corrections, modifications, enhancements, improvements, and any other changes to this document, at any time without notice.

Customer should obtain the latest relevant information before placing orders and should verify that such information is current and complete.

NVIDIA products are sold subject to the NVIDIA standard terms and conditions of sale supplied at the time of order acknowledgement, unless otherwise agreed in an individual sales agreement signed by authorized representatives of NVIDIA and customer (“Terms of Sale”). NVIDIA hereby expressly objects to applying any customer general terms and conditions with regards to the purchase of the NVIDIA product referenced in this document. No contractual obligations are formed either directly or indirectly by this document.

NVIDIA products are not designed, authorized, or warranted to be suitable for use in medical, military, aircraft, space, or life support equipment, nor in applications where failure or malfunction of the NVIDIA product can reasonably be expected to result in personal injury, death, or property or environmental damage. NVIDIA accepts no liability for inclusion and/or use of NVIDIA products in such equipment or applications and therefore such inclusion and/or use is at customer’s own risk.

NVIDIA makes no representation or warranty that products based on this document will be suitable for any specified use. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to evaluate and determine the applicability of any information contained in this document, ensure the product is suitable and fit for the application planned by customer, and perform the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this document. NVIDIA accepts no liability related to any default, damage, costs, or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this document or (ii) customer product designs.

No license, either expressed or implied, is granted under any NVIDIA patent right, copyright, or other NVIDIA intellectual property right under this document. Information published by NVIDIA regarding third-party products or services does not constitute a license from NVIDIA to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property rights of the third party, or a license from NVIDIA under the patents or other intellectual property rights of NVIDIA.

Reproduction of information in this document is permissible only if approved in advance by NVIDIA in writing, reproduced without alteration and in full compliance with all applicable export laws and regulations, and accompanied by all associated conditions, limitations, and notices.



VESA DisplayPort

DisplayPort and DisplayPort Compliance Logo, DisplayPort Compliance Logo for Dual-mode Sources, and DisplayPort Compliance Logo for Active Cables are trademarks owned by the Video Electronics Standards Association in the United States and other countries.


HDMI, the HDMI logo, and High-Definition Multimedia Interface are trademarks or registered trademarks of HDMI Licensing LLC.


OpenCL is a trademark of Apple Inc. used under license to the Khronos Group Inc.


NVIDIA and the NVIDIA logo are trademarks or registered trademarks of NVIDIA Corporation in the U.S. and other countries. Other company and product names may be trademarks of the respective companies with which they are associated.


© 2007-2021 NVIDIA Corporation. All rights reserved.

This product includes software developed by the Syncro Soft SRL (

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video.

A Comprehensive Suite of Compilers, Libraries and Tools for HPC

The NVIDIA HPC Software Development Kit (SDK) includes the proven compilers, libraries and software tools essential to maximizing developer productivity and the performance and portability of HPC applications.

The NVIDIA HPC SDK C, C++, and Fortran compilers support GPU acceleration of HPC modeling and simulation applications with standard C++ and Fortran, OpenACC® directives, and CUDA®. GPU-accelerated math libraries maximize performance on common HPC algorithms, and optimized communications libraries enable standards-based multi-GPU and scalable systems programming. Performance profiling and debugging tools simplify porting and optimization of HPC applications, and containerization tools enable easy deployment on-premises or in the cloud. With support for NVIDIA GPUs and Arm, OpenPOWER, or x86-64 CPUs running Linux, the HPC SDK provides the tools you need to build NVIDIA GPU-accelerated HPC applications.



Widely used HPC applications, including VASP, Gaussian, ANSYS Fluent, GROMACS, and NAMD, use CUDA, OpenACC, and GPU-accelerated math libraries to deliver breakthrough performance to their users. You can use these same software tools to GPU-accelerate your applications and achieve dramatic speedups and power efficiency using NVIDIA GPUs.


Build and optimize applications for over 99 percent of today’s Top500 systems, including those based on NVIDIA GPUs or x86-64, Arm or OpenPOWER CPUs. You can use drop-in libraries, C++17 parallel algorithms and OpenACC directives to GPU accelerate your code and ensure your applications are fully portable to other compilers and systems.


Maximize science and engineering throughput and minimize coding time with a single integrated suite that allows you to quickly port, parallelize and optimize for GPU acceleration, including industry-standard communication libraries for multi-GPU and scalable computing, and profiling and debugging tools for analysis.

Support for Your Favorite Programming Languages

C++17 Parallel Algorithms

C++17 parallel algorithms enable portable parallel programming using the Standard Template Library (STL). The NVIDIA HPC SDK C++ compiler supports full C++17 on CPUs and offloading of parallel algorithms to NVIDIA GPUs, enabling GPU programming with no directives, pragmas, or annotations. Programs that use C++17 parallel algorithms are readily portable to most C++ implementations for Linux, Windows, and macOS.

Fortran 2003 Compiler

The NVIDIA Fortran compiler supports Fortran 2003 and many features of Fortran 2008. With support for OpenACC and CUDA Fortran on NVIDIA GPUs, and SIMD vectorization, OpenACC and OpenMP for multicore x86-64, Arm, and OpenPOWER CPUs, it has the features you need to port and optimize your Fortran applications on today’s heterogeneous GPU-accelerated HPC systems.

OpenACC Directives

NVIDIA Fortran, C, and, C++ compilers support OpenACC directive-based parallel programming for NVIDIA GPUs and multicore CPUs. Over 200 HPC application ports have been initiated or enabled using OpenACC, including production applications like VASP, Gaussian, ANSYS Fluent, WRF, and MPAS. OpenACC is the proven performance-portable directives solution for GPUs and multicore CPUs.

Key Features

Nvidia Network Service Container Download

GPU Math Libraries

Nvidia Container Download

The NVIDIA HPC SDK includes a suite of GPU-accelerated math libraries for compute-intensive applications. The cuBLAS and cuSOLVER libraries provide GPU-optimized and multi-GPU implementations of all BLAS routines and core routines from LAPACK, automatically using NVIDIA GPU Tensor Cores where possible. cuFFT includes GPU-accelerated 1D, 2D, and 3D FFT routines for real and complex data, and cuSPARSE provides basic linear algebra subroutines for sparse matrices. These libraries are callable from CUDA and OpenACC programs written in C, C++ and Fortran.

Optimized for Tensor Cores

NVIDIA GPU Tensor Cores enable scientists and engineers to dramatically accelerate suitable algorithms using mixed precision or double precision. The NVIDIA HPC SDK math libraries are optimized for Tensor Cores and multi-GPU nodes to deliver the full performance potential of your system with minimal coding effort. Using the NVIDIA Fortran compiler, you can leverage Tensor Cores through automatic mapping of transformational array intrinsics to the cuTENSOR library.

Developer Blog: Bringing Tensor Cores to Standard Fortran

Optimized for Your CPU

Heterogeneous HPC servers use GPUs for accelerated computing and multicore CPUs based on the x86-64, OpenPOWER or Arm instruction set architectures. NVIDIA HPC compilers and tools are supported on all of these CPUs, and all compiler optimizations are fully enabled on any CPU that supports them. With uniform features, command-line options, language implementations, programming models, and tool and library user interfaces across all supported systems, the NVIDIA HPC SDK simplifies the developer experience in diverse HPC environments.

Nvidia Localsystem Container Download

Multi-GPU Programming

Download macos mojave iso file download. The NVIDIA Collective Communications Library (NCCL) implements highly optimized multi-GPU and multi-node collective communication primitives using MPI-compatible all-gather, all-reduce, broadcast, reduce, and reduce-scatter routines to take advantage of all available GPUs within and across your HPC server nodes. NVSHMEM implements the OpenSHMEM standard for GPU memory and provides multi-GPU and multi-node communication primitives that can be initiated from a host CPU or GPU and called from within a CUDA kernel.

Scalable Systems Programming

MPI is the standard for programming distributed-memory scalable systems. The NVIDIA HPC SDK includes a CUDA-aware MPI library based on Open MPI with support for GPUDirect™ so you can send and receive GPU buffers directly using remote direct memory access (RDMA), including buffers allocated in CUDA Unified Memory. CUDA-aware Open MPI is fully compatible with CUDA C/C++, CUDA Fortran and the NVIDIA OpenACC compilers.

Nsight Performance Profiling

Nsight™ Systems provides system-wide visualization of application performance on HPC servers and enables you to optimize away bottlenecks and scale parallel applications across multicore CPUs and GPUs. Nsight Compute allows you to deep dive into GPU kernels in an interactive profiler for GPU-accelerated applications via a graphical or command-line user interface, and allows you to pinpoint performance bottlenecks using the NVTX API to directly instrument regions of your source code.

Deploy Anywhere

Containers simplify software deployment by bundling applications and their dependencies into portable virtual environments. The NVIDIA HPC SDK includes instructions for developing, profiling, and deploying software using the HPC Container Maker to simplify the creation of container images. The NVIDIA Container Runtime enables seamless GPU support in virtually all container frameworks, including Docker and Singularity.

Developer blog: Building and Deploying HPC Applications using NVIDIA HPC SDK from the NVIDIA NGC Catalog.

What Users are Saying

“On Perlmutter, we need Fortran, C and C++ compilers that support all the programming models our users need and expect on NVIDIA GPUs and AMD EPYC CPUs — MPI, OpenMP, OpenACC, CUDA and optimized math libraries. The NVIDIA HPC SDK checks all of those boxes.”

– Nicholas Wright, NERSC Chief Architect

HPC Compilers Support Services

HPC Compiler Support Services provide access to NVIDIA technical experts, including:

  • Paid technical support for the NVFORTRAN, NVC++ and NVC compilers.
  • Help with installation and usage of NVFORTRAN, NVC++ and NVC compilers.
  • Confirmation of bug reports, prioritization of bug fixes above those from non-paid users.
  • Help with temporary workarounds for confirmed compiler bugs.
  • Access to release archives.
  • More details in the End Customer Terms & Conditions.

Get Started

  • Already have an active support contract? Login to the support portal.
  • Interested in purchasing these support services? Contact us.
  • Existing customers: want to renew your contract? Contact us.
  • Questions? Contact [email protected]


  • GTC Digital Webinar: Introducing the NVIDIA HPC SDK
  • Developer Blogs:
  • Related libraries and software:

Get Started

Coments are closed
Scroll to top