- Install WSL 2 (with separate linux kernel) and Linux distribution
# run the following command in PowerShell
$ wsl --install -d Ubuntu-18.04
# Ubuntu-18.04 is my preferred Linux distribution. You can find all the supported distributions by running
# wsl --list --online
- Caveat: you may not launch wsl or Ubuntu without restarting my PC to launch the Ubuntu
- Install the CUDA driver by running the exexcutable on Windows
- Install CUDA toolkits for creating CUDA applications (e.g., build deep learning models in PyTorch)
- Although the official guideline recommends using the WSL-specific package, I recommend the regular package for ubuntu. So you can select the specific version of OS and cuda. Therefore, the script suitable for you could be provided from https://developer.nvidia.com/. But REPLACE the last command to install only the toolkit, e.g.,
apt-get install -y cuda-toolkit-11-1
. The following scirpt is just copied for my OS (Ubuntu 18.04 ) and required version of CUDA (11.1). You can change these versions according to your system.
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.0-455.23.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.0-455.23.05-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install -y cuda-toolkit-11-1
- it should be downloaded at
/usr/local/cuda
. so you could check intalled cuda version
$ sudo /usr/local/cuda/bin/nvcc --version