Install WSL2 on Windows 11 with NVIDIA CUDA 11.8

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
to install wso2 search for Turn Windows features on or off scroll down to a virtual machine platform and tick the Box select the windows subsystem for Linux check the box and click ok Windows features will prompt you to restart your computer click restart now after the computer has rebooted open command prompt with administrator privileges and type in WSL dash dash set Dash default-version 2 to set default version of WSL to wsl2 this must be done before installing any Linux distribution type WSL dash dash list dash dash online to see the distributions type wslash install Dash D Ubuntu to install Ubuntu this will open another command prompt controlling Ubuntu type in a new username and confirm the password you entered you can change the directory to slash amount C if you want to access the Windows File system displaying the contents of the directory will show all the windows files at C I'll just show you how to shut down the machine with the Ubuntu prompt and enter WSL Dash list dash dash where both at the Windows command prompt to shut down Ubuntu with wsl-t Ubuntu if you display the distributions again Ubuntu will have the state stopped if you have multiple machines you can start a specific one with WSL dash dash distribution and the name of the distribution in this case Ubuntu The Prompt will change to the prompt that controls Ubuntu note that exiting the prompt does not shut down the machine to explicitly shut down the machine used to terminate command if you want to start Ubuntu you can simply search for Ubuntu on your device and start it in order for a Cuda to work properly check for GCC on the wsl2 machine if it is not detected type sudo apt install gcc-fix missing to install it to install Cuda search the web for NVIDIA coder toolkit 11.8 click on the Nvidia link can select Linux x86 WSL and local this will show you the commands simply copy and paste them into the WSL to command prompt the fourth command has to be run twice otherwise the keys are not set properly go ahead copy them one by one as you can see from the output the dpkg-i command does not run successfully to fix this run the copy command first and then run the dpkg-i command again for NVIDIA Cuda to work it needs the path variable search the web for NVIDIA Cuda installation guide Linux and click on the Nvidia link select 13 post installation actions under 13.1.1 environment setup copy the export command change the Cuda version of this command I'll just copy it to a new tab and change the number to the 11.8 switch to the Ubuntu command prompt to go to the current user home directory type CD tilde type Nano Dot bashrc and scroll down to the last line of the file and copy the path there press Ctrl and X together confirm with Y and press enter to exit the file Source tilde slash dot bash RC will execute the commands in the dot bash RC file in the current shell context changes will take effect immediately type Echo dollar sign path to see if the path is set correctly as you can see the path is set now leave the command prompt and check to see if it's actually consistent across sessions as you can see it is Cuda wand work if the path is not set install the Nvidia Cuda toolkit using sudo apt install the Nvidia system management interface works you can check the Nvidia Cuda compiler version with nvcc-v to install pytorch check that python is installed if it is not installed check the available file conversions with apt list Dash a python 3. you can install it by running sudo apt-get install Python 3 equals and selecting one of the available versions from the list above it is not necessary in this case because python 3.10 is already installed you need pip to install pytorch you so use sudo apt-getinstall python 3-pip to install it if you enter pip 3 you will be able to see if it has been installed to download pytorch search for pytorch and go to the website select Linux pip and is your Nvidia Cuda version in the downloads section the command is shown copy it to the wsl2 prompt if you have previously installed another version of Pi torch use the dash dash upgrade parameter to update pytorch to check that pie torch is set up correctly open the Python 3 interpreter import torch and check whether torch is available using torch.cooter that is underscore available it shows true so that's perfect you can see the torch version with torch dot underscore underscore version underscore underscore to compile a program with akuda I will create a file called test.cu put some Cuda code in it run the Nvidia Cuda compiler on it you can see that it is working to profile the application use the Nvidia profiler it will throw an error to fix this go into windows and open the Nvidia control panel click on desktop and then click on enable developer settings look for manage GPU performance count on the left select allow access go back to the command prompt run the Nvidia profiler again profiling will work although it will give you a warning that unified memory profiling is not supported this is just because of wsl2 if you want to uninstall any Cuda version and delete the dbn package you downloaded from the Nvidia website to do this use the RM command and type the file name and remove the path from The Bash RC file
Info
Channel: Archive
Views: 13,262
Rating: undefined out of 5
Keywords: cuda on wsl2, windows 11 wsl2, ubuntu, cuda 11.8 on wsl2, wsl2 cuda 11.8, nvidia cuda 11.8, nvidia cuda course, NVIDIA CUDA, wsl2, install pytorch wsl2, install pytorch with cuda, install pytorch with cuda on wsl2, install pytorch pip, install pytorch linux, install cuda pytorch, install cuda ubuntu, install cuda ubuntu 22.04, install cuda toolkit, cuda toolkit, nvidia cuda wsl, pytorch wsl, wsl2 pytorch, ubuntu cuda, install cuda on ubuntu, install cuda on linux, cuda, linux
Id: 1HzYU2_t3yc
Channel Id: undefined
Length: 10min 40sec (640 seconds)
Published: Mon Mar 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.