It seems that WSL2 finally supports CUDA. Not only can I run unix on Windows, but I'm very happy to be able to run heavy machine learning algorithms on CUDA. Your study is progressing. Right now, it seems that only users who participated in the Windows Insider Program and applied the Dev channel to their PCs, but I just hope that a stable version will come out later.
So, I would like to install Ubuntu with WSL2 and install an environment that can execute PyTorch and Tensorflow via CUDA. Confirmation of installation is done by GPU calculation of PyTorch.
This procedure is current as of July 18, 2020 and is likely to change with future Windows Updates. In addition, the operating environment may become unstable because the Preview version of Windows Update is implemented. ** We cannot guarantee the execution at all, so please do it at your own risk. ** It takes a lot of time and there are many steps.
--Create a Microsoft account --Create an Nvidia account --Windows Update and reboot
Step 1. Enable the following functions in "Turn Windows functions on or off".
Step 2. Restart your PC
Step 3. Run PowerShell as an administrator (cannot be run at the command prompt)
Step 4. Enable Windows Subsystem for Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Step 4. Enable the optional components of the virtual machine platform
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Step 5. Download the latest Linux kernel update package from the following site and update the kernel.
Step 6. Set the default version of WSL to 2.
wsl --set-default-version 2
Step 1. Open "Microsoft Store"
Step 2. Enter "Ubuntu" in the search window
Step 3. Install Ubuntu 18.04 (CUDA does not yet support 20.04)
Step 4. Start Ubuntu 18.04 with PowerShell and complete the initial settings (register user name and password).
wsl -d Ubuntu-18.04
Step 5. Do apt update & upgrade.
sudo apt update
sudo apt upgrade -y
Step 6. Log out of Ubuntu and check if the WSL version is 2.
wsl -l -v
Step 7. Check if the WSL version is 121 or higher
wsl -d Ubuntu-18.04 uname -r
#For example, 4.19.121-microsoft-standard,Is displayed
wsl -d Ubuntu-18.04 --update
** * Be careful as it takes a long time for the first time **
Step 1. Open Windows "Settings"
Step 2. Open "Update and Security"
Step 3. Open the "Windows Insider Program" and register for an account. At this time, select "Dev channel"
Step 4. Perform Windows Update and restart according to the instructions on the screen.
** * Install on Windows, not Ubuntu **
Step 1. Download the Preview version of the NVIDIA driver for your GPU
Step 2. Execute the downloaded file and install it ()
Step 1. Download the CUDA Toolkit
** * Install on Ubuntu, not Windows, and be careful about OS selection **
** * Install the version that matches PyTorch or Tensorflow that you want to execute later (here, v10.1) **
Step 2. Install CUDA according to the web page display procedure.
Step 1. Start Ubuntu with WSL2
wsl -d Ubuntu-18.04
Step 2. Install pyenv (or python3)
-Talk about installing pyenv on ubuntu 20.04 [Updated on 2020/07/18]
Step 3. Install PyTorch.
Step 4. Confirm execution in CUDA
-How to check if GPU is available in Pytorch
It was very helpful. Thank you very much. -Waiting for CUDA on WSL2 -[Use GPU with WSL 2 (Run CUDA, PyTorch and TensorFlow 2.2 GPU version on WSL 2 Ubuntu. Do not use Docker, use Windows 10 Insider Program, Ubuntu on WSL 2)](https: // www.kkaneko.jp/tools/wsl/wsl_tensorflow2.html) -Installation of WSL 2, installation and use of Ubuntu 20.04, 18.04
Recommended Posts