75 lines
2.1 KiB
Markdown
75 lines
2.1 KiB
Markdown
# CUDA 12.4 Install
|
|
|
|
> https://unknowndba.blogspot.com/2024/04/cuda-getting-started-on-wsl.html (@\_freddenis\_, 2024)
|
|
|
|
```bash
|
|
# get md5sums
|
|
wget https://developer.download.nvidia.com/compute/cuda/12.4.1/docs/sidebar/md5sum.txt
|
|
#
|
|
# setup cuda apt repo
|
|
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
|
|
#
|
|
# download installer and check md5sum
|
|
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
|
|
md5sum --check --ignore-missing md5sum.txt
|
|
#
|
|
# try to install cuda (this will fail, but it puts the keyring file in the correct spot)
|
|
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
|
|
#
|
|
# copy cuda gpg keyring to keyrings
|
|
sudo cp /var/cuda-repo-wsl-ubuntu-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
|
|
#
|
|
# install cuda (this time for real)
|
|
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.1-1_amd64.deb
|
|
#
|
|
# install cuda-toolkit
|
|
sudo apt update
|
|
sudo apt install cuda-toolkit-12-4
|
|
#
|
|
# setup path
|
|
# sudo apt install plocate
|
|
locate nvcc
|
|
# -> returns /usr/local/cuda-12.4
|
|
# add these lines to your .profile (.zshrc, ...)
|
|
#
|
|
# export PATH="/usr/local/cuda-12.4/bin:$PATH"
|
|
# export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH"
|
|
#
|
|
# after source-ing, check version of nvcc
|
|
nvcc -V
|
|
```
|
|
|
|
## check cuda installation with cuda samples
|
|
|
|
```bash
|
|
git clone https://github.com/NVIDIA/cuda-samples
|
|
cd cuda-samples/Samples/1_Utilities/deviceQuery
|
|
make
|
|
./devicequery
|
|
```
|
|
|
|
|
|
### if the cuda-toolkit install fails with unmet dependencies
|
|
|
|
>https://askubuntu.com/a/1493087 (jspinella, 2023, CC BY-SA 4.0)
|
|
|
|
1. Open the *new* file for storing the sources list
|
|
|
|
```bash
|
|
sudo nano /etc/apt/sources.list.d/ubuntu.sources
|
|
```
|
|
|
|
2. Paste in the following at the end of the file:
|
|
|
|
```raw
|
|
Types: deb
|
|
URIs: http://archive.ubuntu.com/ubuntu/
|
|
Suites: lunar
|
|
Components: universe
|
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
|
```
|
|
|
|
3. Save the file and run `sudo apt update` - now the install command for CUDA should work.
|
|
|