add installation notes for CUDA 12.4, pyenv, and PyTorch; include useful links

This commit is contained in:
Joseph Hopfmüller
2024-11-16 00:03:43 +01:00
parent 2bf47dc0c0
commit 939a511625
4 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
# 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.

4
notes/links.md Normal file
View File

@@ -0,0 +1,4 @@
# useful links
- (Optuna)[https://optuna.org] Hyperparameter optimization framework
`pip install optuna`

46
notes/pyenv-install.md Normal file
View File

@@ -0,0 +1,46 @@
# pyenv install
## install
nice to have:
```bash
sudo apt install python-is-python3
```
```bash
curl https://pyenv.run | bash
```
## setup zsh
add the following to `.zshrc`:
```bash
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
```
## pyenv install
prerequisites:
```bash
sudo apt update
sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev liblzma-dev python3-pip
```
install:
```bash
# using python 3.12.7 as an example
pyenv install 3.12.7
# optional
pyenv global 3.12.7
pyenv versions
```

25
notes/pytorch-install.md Normal file
View File

@@ -0,0 +1,25 @@
# pytorch install
## create venv
```bash
python -m venv ./.venv
source ./.venv/bin/activate
```
## install pytorch
> https://pytorch.org/get-started/locally/
```bash
pip install torch torchvision torchaudio
```
## test pytorch install
```python
import torch
x = torch.rand(5, 3)
print(x)
torch.cuda.is_available()
```