-
Visit the page to get and install the WSL compatible NVIDIA driver:
NOTE: mindless updates to the driver may cause trouble
-
Check the official blog first:
-
Open Windows Terminal as Administrator (Win + X) and run in PowerShell:
wsl --install -d Ubuntu-22.04
Reboot may be required. A pop-up installation of Ubuntu will show up after Windows restarts.
Follow the guide and this will automatically install the dependencies as well as Ubuntu-22.04 LTS.
-
OPTIONAL: config the WSL config file such that it could use all the CPU and Memory
wsl --shutdown # shutdown wsl first notepad "$env:USERPROFILE/.wslconfig" # edit or create the config with notepad
In the Notepad window, inject these lines:
[wsl2] memory=128GB # Limits VM memory in WSL2 up to 128GB processors=32 # Makes the WSL2 VM use 32 virtual processors
Save the notepad file and exit
-
Get an Ubuntu shell window by the dropdown menu of Windows Terminal (non-administrator)
-
Do a system update:
sudo apt update sudo apt upgrade # why not also do this since you just installed a new Ubuntu
-
Reboot Windows (which will reboot the WSL-Ubuntu too), get back to an Ubuntu shell window with Windows Terminal after restart
-
Check if WSL is working well with your NVIDIA graphics card(s):
nvidia-smi
If not, try installing compatible drivers in Windows
-
cd
to the folder where the.sh
files of this repo are at. You may have to clone the repo first or copy the files. -
Install
dos2unix
in case of any trouble:sudo apt install dos2unix # we need this just in case the sh files are downloaded in the Windows encoding
-
Then convert the
.sh
files to unix encoding:sudo dos2unix *.sh # or maybe sudo isn't necessary
-
Get CUDA, CuDNN and python-3.11 configured by:
sudo bash WSL2_init.sh
Key-in your password. This would install Cuda 12.1 (latest CUDA version compatible with both PyTorch and WSL), python 3.11 and gh. Modify to suit your needs.
When in your Python, after you installed CUDA-12.1 compatible version of PyTorch:
```python
import torch
torch.zeros(1).cuda()
```
Check for errors. If none, enjoy!