Halo
发布于 2022-12-05 / 109 阅读 / 0 评论 / 0 点赞

ubuntu setup pytorch env

clear cuda old driver

sudo apt-get purge nvidia-*
sudo apt-get purge cuda*
sudo apt autoremove

install cuda

go to: https://developer.nvidia.com/cuda-toolkit-archive
choose your version, such as install 11.7:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring*.deb
sudo apt-get update
sudo apt-get -y install cuda

show cuda version

nvcc --version

show cuda status

nvidia-smi -l 1

install cunn

go to: https://developer.nvidia.com/rdp/cudnn-download
choose cudnn version which mathed cuda version, such as 11.x:

wget https://developer.nvidia.com/downloads/c118-cudnn-local-repo-ubuntu2204-8708410-1amd64deb
sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
sudo apt-get install libcudnn8 libcudnn8-dev libcudnn8-samples

install pytoch

go to: https://pytorch.org/get-started/locally/
choose pytorch version which mathed cuda version, such as 1.13:

wget https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu117.zip

reboot

sudo reboot

评论