Assuming installation of CUDA Toolkit is necessary, there seems to be 2 ways for WSL as shown in bullet points below. However the execution command seems to be different. So is it really 2 ways or do I need to install both in succession?
Hello and thanks for your questions,
This is indeed a point that is often confusing and could use some clarification.
First let’s talk about the CUDA Driver (you need it to run CUDA programs):
Our classic Windows Display Driver always includes the CUDA Driver for native Windows.
When it comes to WSL, the CUDA Driver for WSL is also included in the same Windows Display Driver.
This means that the Windows Display Driver Comes with both the Native and the WSL CUDA Driver.
That said because WSL2 GPU support is still in preview, we only include the WSL Drivers as part of the Windows Display Driver in some of our builds. Namely, the drivers you get automatically if you are on the Windows Insider Program via Windows Update and the driver you can download manually on the CUDA Developer portal here.
When WSL2 GPU support will no longer be in preview, we plan to make WSL Drivers part of the Windows Display Driver all the time. At that point, yes, the driver you will get from the NVIDIA Driver Download webpage for instance, will come built in with WSL Drivers. Until then, only the specific drivers mentioned above have the WSL CUDA Driver built-in.
Now let’s talk about the CUDA Toolkit (you need it to develop CUDA Program):
Usually the toolkit is needed for you to develop CUDA Programs, not to run them. Most program developed with CUDA will redistribute themselves the components from the toolkit they need to run. The reason why we have separate packages for WSL is to safeguard users that might accidentally install not just the toolkit but the full package “install cuda” which by default will also install the native linux CUDA driver. The WSL variant is exactly the same as the regular one, just without the driver dependency :).
An other easy way to avoid any issues would be to download the .run file for the CUDA toolkit. Those will be able to check for WSL and skip the native driver install. We are constantly trying to find ways to avoid this, as we realize this is one of the biggest source of confusion and setup issues right now.
I hope this could answer your questions, and thanks a lot for trying WSL GPU support,
@rboissel Thank you for your response. I understand more now. After reading your response, here is my understanding towards my questions. Also parts in italic below are my own assumptions.
Answer to Question 1: Documentation
Since you did not mention a different site and needed to clarify, I assume there isn’t a better documentation on CUDA architecture than CUDA on WSL User Guide.
The reason why we have separate packages for WSL is to safeguard users that might accidentally install not just the toolkit but the full package “install cuda” which by default will also install the Native Linux CUDA Driver.
So this is to avoid accidentally overwriting NVIDIA Drivers for CUDA on WSL with NVIDIA Native Linux Driver by executing sudo apt-get install cuda.
An other easy way to avoid any issues would be to download the .run file for the CUDA toolkit. Those will be able to check for WSL and skip the native driver install.
I might be just rewording your response but … so I can still go through CUDA Toolkit 11.1.0 (archive) download site and avoid overwriting NVIDIA Drivers for CUDA on WSL by selecting the runfile (local) as shown below (this is regardless of whether NVIDIA Native Linux CUDA Driver (e.g. Ubuntu 20.04) is selected):