WSL2 and CUDA (CUDA not available)
Even tho CUDA is available, the bend run-cu tells me otherwise:
Error reading result from hvm. Output :
CUDA not available!
Have you installed cuda after installing hvm? If you did, please try reinstalling HVM
Hello, I too face the same issue with WSL2 and CUDA. I did try reinstalling both HVM and bend-lang as @developedby suggested, but it yields the same error "CUDA not available".
Same here, I reinstalled hvm and bend but it still did not work, everything is also up to date aswell.
If you run nvcc --version what does it show?
Also, when installing HVM does it show a warning saying that CUDA was not found and will not be available?
Have you installed cuda after installing hvm? If you did, please try reinstalling HVM
According to the CUDA on WSL guide by Nvidia there is no need to install anything besides the current GPU drivers on the host system: https://docs.nvidia.com/cuda/wsl-user-guide/index.html#getting-started-with-cuda-on-wsl-2
If you run nvcc --version what does it show?
nvcc doesn't seem to be installed, which might be the problem here, even tho i can find the libcuda.so files in the /usr/lib folders
nvcc --version
On wsl I get Command 'nvcc' not found, but can be installed with: but on windows is works just fine
And when installing hvm cargo I get: updating, installing, compiling and finished messages, no warnings
hvm-cu is a CUDA program, so to compile it you need to have nvcc installed. I'll update the guide to be more explicit
nvcc --version
On wsl I get
Command 'nvcc' not found, but can be installed with:but on windows is works just fine And when installing hvm cargo I get: updating, installing, compiling and finished messages, no warnings
Is there not a warning saying warning: [email protected]: WARNING: CUDA compiler not found. HVM will not be able to run on GPU.?
You need nvcc just to install HVM, later you only need CUDA to run it.
If running hvm run-cu or bend run-cu shows CUDA not available you should have seen the warning when installing HVM. Can you confirm to that it doesn't appear? Just to make sure that there is a problem with the build script
So I'll need to install nvidia-cuda-toolkit and then reinstall the hvm ?
I installed the CUDA Toolkit which also gets the nvcc binary:
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=runfile_local
So I'll need to install nvidia-cuda-toolkit and then reinstall the hvm ?
I'm not sure the exact package on WSL2 is, but yes, you need the cuda sdk/toolkit
No I can confirm, I received no such warning. I am now installing the toolkit and I will keep you updated
I installed the CUDA Toolkit which also gets the
nvccbinary:https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=runfile_local
This worked out! After adding the binary folder to the PATH and reinstalling HVM it works now.
I installed the CUDA Toolkit which also gets the
nvccbinary: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=runfile_localThis worked out! After adding the binary folder to the PATH and reinstalling HVM it works now.
This is exactly what I did earlier but it didn't work so I uninstalled it
This is exactly what I did earlier but it didn't work so I uninstalled it
Have you checked the folder with the binaries? (/usr/local/cuda-12.4/bin) and added them to your PATH?
No, I did not add them to the path. I am repeating those steps now and when they will be done, I will add it and reload my shell
UPDATE: The issue is now resolved.
Steps to fix the issue: Run this: (assumes you are using x86_64 wsl2 ubuntu)
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-4
then run sudo apt install nvidia-cuda-toolkit in bash OR add the toolkit to path