[Article] About GPU support for Windows Subsystem for Linux 2 (WSL2) [3/3]

[Please check] This is the following articleSequel articleWill be

About GPU support of Windows Subsystem for Linux 2 (WSL2) [1/3]
About GPU support of Windows Subsystem for Linux 2 (WSL2) [2/3]

In the previous articles, we verified the performance of GPGPU on Windows Subsystem for Linux 2 (WSL2), but in this final installment, we will verify how to use WSL2 more practically. ..


WSL2 support status

At the time of the first article publication (August 1), WSL2020 was a function that could not be used without participating in the Window Insider Program, but after thatOperating systemWith expanded support, you can now use WSL2 without participating in the Windows Insider Program.

You can choose between joining the Windows Insider Program and building an environment on WSL2 with simple steps, or building a WSL2 environment by manual installation (not participating in the Windows Insider Program).Refer to the installation guide for the construction procedure.

Installation Guide for Windows Subsystem for Linux for Windows 10

Now let's take a look at the platforms that support WSL2 (as of May 2021).

When WSL2 was officially released, it was supported by Windows 10 version 2004 or later, but now it is backported and WSL1903 can be used if it is version 2 or later.

Participation in the Windows Insider Program is no longer required, and it can be said that WSL2 can be used in a more general environment.If you want to use GPGPU on WSL2, you still need to participate in the Windows Insider Program.


About using GPGPU on WSL2

The use of GPGPU on WSL2 is expected to be officially supported in the next release of Windows 10 (development code name: 21H1) or later. 21H1 is available on beta channel as of May 2021 and is a Windows Update "seeker" experienceYou can download "Version 19043.844" through. * You can check the latest Windows updates and features on the beta channel.

Releasing Windows 10 Build 19043.899 (21H1) to Beta Channel


About WSL preview build

GUI apps are now available in Windows 10 Insider Preview Build 21364. A Microsoft blog published on April 2021, 4 US time introduces running Linux GPU applications on Windows.

Announcing Windows 10 Insider Preview Build 21364


Docker support on Windows

Of course, there are advantages to using GPGPU directly (not strictly directly) in the Linux environment on WSL2, but using GPGPU has always been possible to run on Windows environment. For those interested in GPGPU, one of the strong motivations for choosing Linux has been Docker I think that it is a response to.

There has been a Docker implementation for Windows for a long time, but due to the development process, information is distributed in many directions and it was difficult to introduce it.The situation changed with the advent of WSL2 under these circumstances.

WSL2-based container startup is supported, Docker installation on Windows has become extremely smooth, and Docker containers can be operated and managed from the familiar Windows environment.Also, although it is only experimental support, GPU support has been added in the latest version, and it may be said that the biggest advantage is that GPGPU can be executed from the Docker container.


What is Docker

Docker is open source software based on container-based virtualization technology. It is a development environment container (source code and environment container) that runs on Linux, macOS, and Windows, and it is easy to move the container to another OS.In addition, since the processes separated by the container can be executed on the host OS, neither virtualization software nor guest OS is required.

It is very convenient for image creation, container startup, application development, and building services by combining multiple containers.It is also good at reducing weight, building and sharing development environments, managing files, etc., and is a useful tool for improving work efficiency.


Install Docker Desktop for Windows

In this section, we will briefly explain the installation of Docker Desktop for Windows, which is positioned as the Windows version of Docker (* It is assumed that the environment that can execute WSL2 GPU has already been built).

No particularly difficult settings are required to install Docker Desktop for Windows.The execution environment of the Docker container is built by executing the installer obtained from the official website and proceeding step by step.If WSL2 is enabled at this time, the WSL2-based container execution environment will also be automatically enabled (you can enable / disable it in the dialog during installation).

Docker Desktop for Windows

Once the installation is complete, you can run the Docker container from Windows commands.If WSL2 support is enabled at this time, the distribution set as the default on the WSL2 side and the Docker execution environment will be integrated, and Docker can be operated from the Linux distribution on WSL2.


Operation verification of Docker container

 We started the Docker container published by NVIDIA and confirmed that NBody (N-body simulation) provided as a sample program * of NVIDIA CUDA Toolkit works as in Part 2.

* Click the image to enlarge

As mentioned above, GPU support in Docker for Windows is currently in the experimental stage.Even in the verification test conducted by our company, there were cases where it did not work if the procedure for publishing the official website was used.It is expected that such an event will be resolved by future development, but please be aware that you are responsible for the trial.

For setup of CUDA Toolkit and execution of sample program,Here (first article) Please refer to.


Future outlook, summary

In Part 3, I explained the outline of Windows Subsystem for Linux 2 (WSL2).Even in cases where two computer OS environments had to be prepared up to now, it has become realistic to process seamlessly and efficiently by using WSL2.

WSL2 does not support launching GUI applications, but according to Microsoft's roadmap, future updates will also support running GUI applications for Linux. It is expected that specialized applications developed for the Linux environment can be (virtually) executed on Windows.

GPU support for WSL2 is still under development.It seems that GPU support will finally be released to the general public as the functions become more stable and expand in the future.As a preliminary step, we hope that it will be helpful to you as a brief report on the current situation.

Person who wrote this article : Engineering Department Wada
The date this article was written : 2021.4.30