- おまじない
bash
sudo apt update
sudo apt upgrade
sudo apt install build-essential libbz2-dev libdb-dev \
libreadline-dev libffi-dev libgdbm-dev liblzma-dev \
libncursesw5-dev libsqlite3-dev libssl-dev \
zlib1g-dev uuid-dev tk-dev
- Nvidia Driver Install
- CUDA Toolkit Install
最新版
旧バージョン(Pytorch との相性をみて決めるかも)
いまcuda11-6-2を選択する。
bash
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/11.6.2/local_installers/cuda-repo-wsl-ubuntu-11-6-local_11.6.2-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-6-local_11.6.2-1_amd64.deb
sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
- CUDNN Install
Ubuntuのversionを確認してきめる。
いま、Local Installer for Ubuntu20.04 x86_64 (Deb)を選択する。
bash
sudo dpkg -i /mnt/c/Users/XXXXXX/Downloads/cudnn-local-repo-ubuntu2004-8.5.0.96_1.0-1_amd64.deb
- Pytorch Install
bash
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
python3
import torch
torch.cuda.is_available()
print(torch.__version__)
- remove CUDA
bash
# Remove existing CuDA versions
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
rm -rf /usr/local/cuda*
sudo apt-get autoremove && sudo apt-get autoclean
- remove torch
pip uninstall torch
pip install pip-autoremove
参考文献