Ladies and gentlemen, this person right here is the textbook definition of a true Chad. After hours and hours of following the Nvidia documentation and going through Stack Overflow, I was starting to lose hope. Once I saw your video, I was able to get everything working perfectly. Wish I had come across this sooner. Thanks for the clear and concise video!
1:05 As of 2023-08-05, after installing Ubuntu from powershell, it doesn't launch because wsl 2 "requires an update to its lethal component." You need to do a `wsl --update` after you reboot.
THANK YOU! After thrashing through several install docs, repos and youtube videios...was about to give up... then saw your detailed step by step video that was the trick. All the other instructions never came close to succes or this detail of steps. Would never get my AI models GPU acceleration without this!!
little question here: im having issues that docker on windows does not allow me to only send infos of my second gpu into the container. i wanna make sure that it just only runs at the second one.
hello I have a question. this instruction doesn't explicitly install cudnn which is required by a lot deep learning packages according to their official documents. So I wonder if it's necessary to do so to prevent any potential problems
After going through nvidia documentation many times and watching and following one other video, I was about to give up. And even after seeing this video, I still found finding cuda toolkit for wsl very difficult. I was expecting to see wsl ubuntu as operating system but it showed up only after selecting linux and architecture as x86_64. @archive you could have also explained your choice of cuda version 11.8. It was only when i reached pytorch installation, i understood I should have stuck with 12.1 instead of choosing the latest 12.5. pytorch worked even with the version mismatch.
Hey there! First of all thanks for uploading this video. I'd like to know if I can install the latest version of Tensorflow (instead of pytorch) using this method. I believe it is the same. And also, once it is installed, is it available on Virtual Studio directly or do I have to do arrangements first? Thanks in advance, regards from Argentina.
why is this happening? NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
Hi, this is probably because there are Nvidia Drivers installed on the ubuntu machine. This must not be the case for nvidia cuda to work properly on the wsl2 platform. WSL2 uses the Nvidia Drivers on Windows. Update your Nvidia Drivers on Windows first. Reboot your PC afterwards. Although the commands will most likely not work, you might try following commands in order: WSL2 Prompt: #sudo apt-get purge nvidia-* Windows CMD Prompt: #wsl -t Ubuntu wait for at least 10 seconds #wsl WSL2 Prompt: #sudo apt install nvidia-cuda-toolkit Windows CMD Prompt: #wsl -t Ubuntu wait for at least 10 seconds #wsl WSL2 Prompt: #nvidia-smi Be sure you're WSL machine is on version 2: C:\Users imda>wsl -l -v NAME STATE VERSION * Ubuntu Running 2 If it is on version 1 use this command: Windows CMD Prompt #wsl --set-default-version 2 I suggest you to reinstall Ubuntu WSL2 with these commands (be sure to backup your files beforehand): Windows CMD Prompt: #wsl --unregister Ubuntu #wsl --install --distribution Ubuntu The command "nvidia-smi" works on a fresh installation.
@@Archive-pg2zn I apologize for any inconvenience caused. I found the issue preventing the update of my WSL to WSL2. By enabling the "Receive updates for other Windows products" option in the advanced settings of Windows Update and performing a quick update, I was able to reinstall Ubuntu successfully. Thank you for your understanding.
I am getting this error when I do nvidia-smi Failed to initialize NVML: GPU access blocked by the operating system Failed to properly shut down NVML: GPU access blocked by the operating system
Thank you for watching the video! Of course, here is the CUDA code I have used: #include __global__ void hello() { printf("Hello, world from GPU! "); } int main() { printf("Hello, world from CPU! "); hello(); cudaDeviceSynchronize(); return(0); } Commands: nano test.cu #create file nvcc test.cu -o test #compile file ./test #run file nvprof ./test #profile performance
Thank you for your comment. This question is indeed interesting and I wondered the same. To give some general context: The version that "nvidia-smi" reports (namely 12.1) refers to a different CUDA version than the 'nvcc -V' command. "nvidia-smi" reports the CUDA version that comes with the NVIDIA driver, which is installed on the Windows operating system. "nvcc -V" shows the version installed with the "sudo apt install nvidia-cuda-toolkit" command. At 5:55, you can see that it updates nothing because the CUDA version "11.5" is already installed. Here is some further reading on the topic: stackoverflow.com/questions/53422407/different-cuda-versions-shown-by-nvcc-and-nvidia-smi This is a Stack Overflow post that provides more information about the different CUDA versions shown by the commands "nvcc -V" and "nvidia-smi". The CUDA version 11.5 seems to be the default version that was installed. I had previously installed CUDA on this machine, and this version was probably a remnant that I didn't cleanse from the machine. Though the "CUDA version 11.8" is detected correctly by Torch, which means that the environment variable is recognized. You can see that at 8:12.
@@Archive-pg2zn YEah, I also tried nvcc -V and met the same case. My WSL2 also gives me cuda version 11.5, whatever I do. And I also met another problem or probably a bug, that is, if I use num_worker>0 of dataloader in pytorch, in windows it would not report error, but it cannot load the data correctly (all elements of tensor are zero. Weird! ). On the other hand, if I use num_worker>0 in its WSL2, then it would throw me a notorious error, "CUDA UNKNOWN ERROR", which brought me to your video. I thought it could be an error caused by some incorrect operations during my installation, but acoording to your reply, it seems not so easy.
danke für das video, keine zeit mit nebensächlichkeiten verschwendet. anmerkung: wie man immer merkt das ein landsmann englisch spricht, es klingt immer so hart im gegensatz zu nativen sprechern. :D
In my case I needed to use Ubuntu version 22.04.5 LTS from the microsoft store, since with version 24 LTS i experienced some problems. hope this comment can help someone :)
I followed your step and using Torch and its ok. But when I used Tensorflow, I got the following error 2023-10-16 11:50:10.910187: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-10-16 11:50:10.947232: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2023-10-16 11:50:10.947285: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2023-10-16 11:50:10.947314: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2023-10-16 11:50:10.954375: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-10-16 11:50:10.954639: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-10-16 11:50:11.865881: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-10-16 11:50:13.064698: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:880] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node Your kernel may have been built without NUMA support. 2023-10-16 11:50:13.106098: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2211] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
thank you for this tutorial. I have followed the following instructions though I don't know why I'm getting " segmentation fault ' while executing nvidia-smi: +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.54.10 Driver Version: 551.61 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| Segmentation fault
Hi Eya. I had the same issues. Downgrade your NVIDIA Host drivers, with the lower version of CUDA(12.1 in my case). It perfectly works for me, the problem has been solved and i;m able to rich my GPU from the PyTorch and tensorflow now.
Ladies and gentlemen, this person right here is the textbook definition of a true Chad.
After hours and hours of following the Nvidia documentation and going through Stack Overflow, I was starting to lose hope. Once I saw your video, I was able to get everything working perfectly. Wish I had come across this sooner. Thanks for the clear and concise video!
Thanks a lot! Glad it helped you!
Man, the nvidia documentation is TRASH.
1:05 As of 2023-08-05, after installing Ubuntu from powershell, it doesn't launch because wsl 2 "requires an update to its lethal component." You need to do a `wsl --update` after you reboot.
THANK YOU! After thrashing through several install docs, repos and youtube videios...was about to give up... then saw your detailed step by step video that was the trick. All the other instructions never came close to succes or this detail of steps. Would never get my AI models GPU acceleration without this!!
Thank you so much!! Worked over 6hrs on searching for solution until I saw your video. That's really helpful!
Great! I'm glad it worked.
appreciate your time to create this!
managed to set up my dev environment for ML, thanks!
Your video made the process much easier, and I genuinely appreciate your time and expertise.
amazing tutorial - this still works in 2024. thank you kindly, good sir!
did u install with cuda 11.8 or the newer versions?
same question: did you use cuda toolkit 11.8 or a newer one? (e.g. 12.5)
@@CarlWells-b4s 11.8 just like the video suggested
@@playboicarti_vamp 11.8 just like the video suggested
Perfect. That worked like a charm. Thank you so much bro... Glad to watch your video. Keep going.
After hours and hours trying, this saves my day, thanks
That's awesome!
After watching a ton of videos i found the way to put my GPU on work!!🤯
Thank you for the video, it was super helpful!
Thanks! It really helped a lot, I really liked the compilation example. Knowing nothing about CUDA, is nice to see how it works.
Brother you are the hero we never deserved but always needed.
Amazing. So clear and straight forward.
This is an excellent tutorial. It helped me a lot. Thank you.
I am crying been at for 2 days i'll just look up geniuses like you from now
I'm glad it helped you!
@@Archive-pg2zn chad
5:34 what if it is not showing in consistent sessions and my .bashrc file was also empty
The only guide that works flawlesly. Thank you for tinkering on our behalf.
Thank you too!
This video is very well made, thank you!
Thank you, too!
I thank you from the bottom of my heart sir
little question here: im having issues that docker on windows does not allow me to only send infos of my second gpu into the container. i wanna make sure that it just only runs at the second one.
Great video. Would this work with a newer cuda toolkit e.g. 12.5?
Hi, How to resolve if it is not consistent across different sessions?
hello I have a question. this instruction doesn't explicitly install cudnn which is required by a lot deep learning packages according to their official documents. So I wonder if it's necessary to do so to prevent any potential problems
A little question, this works without a nvidia gpu?. For example machines with intel core?,
Thank you!The video is very helpful!
Thanks!
After going through nvidia documentation many times and watching and following one other video, I was about to give up. And even after seeing this video, I still found finding cuda toolkit for wsl very difficult. I was expecting to see wsl ubuntu as operating system but it showed up only after selecting linux and architecture as x86_64. @archive you could have also explained your choice of cuda version 11.8. It was only when i reached pytorch installation, i understood I should have stuck with 12.1 instead of choosing the latest 12.5. pytorch worked even with the version mismatch.
würde mich sehr über weitere Videos zu wsl2 + AI anwendung/training freuen
Hey there! First of all thanks for uploading this video.
I'd like to know if I can install the latest version of Tensorflow (instead of pytorch) using this method. I believe it is the same.
And also, once it is installed, is it available on Virtual Studio directly or do I have to do arrangements first?
Thanks in advance, regards from Argentina.
Same question here :D
after running the "sudo apt-get -y install cuda" I get a Blue screen of death with code "page fault in nonpaged area" what could be the error?
why is this happening?
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
Hi, this is probably because there are Nvidia Drivers installed on the ubuntu machine. This must not be the case for nvidia cuda to work properly on the wsl2 platform. WSL2 uses the Nvidia Drivers on Windows. Update your Nvidia Drivers on Windows first. Reboot your PC afterwards. Although the commands will most likely not work, you might try following commands in order:
WSL2 Prompt:
#sudo apt-get purge nvidia-*
Windows CMD Prompt:
#wsl -t Ubuntu
wait for at least 10 seconds
#wsl
WSL2 Prompt:
#sudo apt install nvidia-cuda-toolkit
Windows CMD Prompt:
#wsl -t Ubuntu
wait for at least 10 seconds
#wsl
WSL2 Prompt:
#nvidia-smi
Be sure you're WSL machine is on version 2:
C:\Users
imda>wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
If it is on version 1 use this command:
Windows CMD Prompt
#wsl --set-default-version 2
I suggest you to reinstall Ubuntu WSL2 with these commands (be sure to backup your files beforehand):
Windows CMD Prompt:
#wsl --unregister Ubuntu
#wsl --install --distribution Ubuntu
The command "nvidia-smi" works on a fresh installation.
@@Archive-pg2zn I apologize for any inconvenience caused. I found the issue preventing the update of my WSL to WSL2. By enabling the "Receive updates for other Windows products" option in the advanced settings of Windows Update and performing a quick update, I was able to reinstall Ubuntu successfully. Thank you for your understanding.
@@aronldmanki2035 Awesome! No worries!
Say thank you from Vietnam !!!!
Thanks for watching!
I am getting this error when I do nvidia-smi
Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system
Thank you!!! 💪💪💪
thanks a lot, can you share cuda code you have used?
Thank you for watching the video! Of course, here is the CUDA code I have used:
#include
__global__ void hello() {
printf("Hello, world from GPU!
");
}
int main() {
printf("Hello, world from CPU!
");
hello();
cudaDeviceSynchronize();
return(0);
}
Commands:
nano test.cu #create file
nvcc test.cu -o test #compile file
./test #run file
nvprof ./test #profile performance
Cool video, thanks ❤
Thanky you!
You are a god amount men
great work 🙌🙌
Thank you!
Why nvcc -V print 11.5? You should install 12.1 or something that matches your cuda?
Thank you for your comment. This question is indeed interesting and I wondered the same. To give some general context: The version that "nvidia-smi" reports (namely 12.1) refers to a different CUDA version than the 'nvcc -V' command. "nvidia-smi" reports the CUDA version that comes with the NVIDIA driver, which is installed on the Windows operating system. "nvcc -V" shows the version installed with the "sudo apt install nvidia-cuda-toolkit" command. At 5:55, you can see that it updates nothing because the CUDA version "11.5" is already installed. Here is some further reading on the topic: stackoverflow.com/questions/53422407/different-cuda-versions-shown-by-nvcc-and-nvidia-smi This is a Stack Overflow post that provides more information about the different CUDA versions shown by the commands "nvcc -V" and "nvidia-smi".
The CUDA version 11.5 seems to be the default version that was installed. I had previously installed CUDA on this machine, and this version was probably a remnant that I didn't cleanse from the machine. Though the "CUDA version 11.8" is detected correctly by Torch, which means that the environment variable is recognized. You can see that at 8:12.
@@Archive-pg2zn YEah, I also tried nvcc -V and met the same case. My WSL2 also gives me cuda version 11.5, whatever I do. And I also met another problem or probably a bug, that is, if I use num_worker>0 of dataloader in pytorch, in windows it would not report error, but it cannot load the data correctly (all elements of tensor are zero. Weird! ). On the other hand, if I use num_worker>0 in its WSL2, then it would throw me a notorious error, "CUDA UNKNOWN ERROR", which brought me to your video. I thought it could be an error caused by some incorrect operations during my installation, but acoording to your reply, it seems not so easy.
THANK YOU! I LOVE U 🇧🇷🇧🇷🇧🇷🇧🇷🇧🇷
Thank you so much!!!!
does it work with CUDA kit 12.2?
Yes, it works exactly the same way. You need to choose 12.2 of course and specify the path with 12.2.
danke für das video, keine zeit mit nebensächlichkeiten verschwendet.
anmerkung: wie man immer merkt das ein landsmann englisch spricht, es klingt immer so hart im gegensatz zu nativen sprechern. :D
Hi, danke dir vielmals!
What a man
In my case I needed to use Ubuntu version 22.04.5 LTS from the microsoft store, since with version 24 LTS i experienced some problems. hope this comment can help someone :)
goated
ABSOLUTE FUCKING GIGACHAD
*promosm*
I followed your step and using Torch and its ok. But when I used Tensorflow, I got the following error
2023-10-16 11:50:10.910187: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-10-16 11:50:10.947232: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2023-10-16 11:50:10.947285: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2023-10-16 11:50:10.947314: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-10-16 11:50:10.954375: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-10-16 11:50:10.954639: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-10-16 11:50:11.865881: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2023-10-16 11:50:13.064698: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:880] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2023-10-16 11:50:13.106098: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2211] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
I did everything right, nvcc -V good work, but nvidia-smi:
Command 'nvidia-smi' not found, but can be installed with:
sudo apt install nvidia-340 # version 340.108-0ubuntu5.20.04.2, or
sudo apt install nvidia-utils-390 # version 390.157-0ubuntu0.20.04.1
sudo apt install nvidia-utils-450-server # version 450.248.02-0ubuntu0.20.04.1
sudo apt install nvidia-utils-470 # version 470.199.02-0ubuntu0.20.04.1
sudo apt install nvidia-utils-470-server # version 470.199.02-0ubuntu0.20.04.1
sudo apt install nvidia-utils-525 # version 525.125.06-0ubuntu0.20.04.3
sudo apt install nvidia-utils-525-server # version 525.125.06-0ubuntu0.20.04.2
sudo apt install nvidia-utils-535 # version 535.54.03-0ubuntu0.20.04.4
sudo apt install nvidia-utils-535-server # version 535.54.03-0ubuntu0.20.04.1
sudo apt install nvidia-utils-435 # version 435.21-0ubuntu7
sudo apt install nvidia-utils-440 # version 440.82+really.440.64-0ubuntu6
sudo apt install nvidia-utils-418-server # version 418.226.00-0ubuntu0.20.04.2
user1@k6:~$ echo $PATH
/home/user1/.local/bin:/usr/local/cuda-11.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_2004.2020.424.0_x64__79rhkp1fndgsc:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/libnvvp:/mnt/c/Python311/Scripts/:/mnt/c/Python311/:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2022.2.0/:/mnt/c/Program Files/dotnet/:/mnt/c/Users/user/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/user/.dotnet/tools:/mnt/d/my_program_files/Microsoft VS Code/bin:/snap/bin
user1@k6:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_18:49:52_PDT_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0
thank you for this tutorial. I have followed the following instructions though I don't know why I'm getting " segmentation fault ' while executing nvidia-smi:
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.10 Driver Version: 551.61 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
Segmentation fault
Hi Eya. I had the same issues. Downgrade your NVIDIA Host drivers, with the lower version of CUDA(12.1 in my case). It perfectly works for me, the problem has been solved and i;m able to rich my GPU from the PyTorch and tensorflow now.