$ sudo apt update
$ sudo apt-get install build-essential
$ sudo apt-get install -y gnome-tweak-tool
$ sudo apt-get install vim
$ ubuntu-drivers devices
$ lspci | grep -i nvidia
$ sudo apt install nvidia-driver-515
$ sudo apt update
$ sudo apt upgrade
$ sudo reboot
$ sudo lshw -c display
driver=nvidia인지 확인
$ nvidia-smi
Release Note - CUDA Tookit Documentation
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
$ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-ubuntu2004-11-7-local_11.7.0-515.43.04-1_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu2004-11-7-local_11.7.0-515.43.04-1_amd64.deb
$ sudo cp /var/cuda-repo-ubuntu2004-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg
$ sudo apt-get update
$ sudo apt-get -y install cuda
$ vim ~/.bashrc
insert 키 누른 후 아래 코드 추가
# <<< conda initialize <<<
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
Esc 키 누른 후 :wq로 저장 후 나가기
$ source ~/.bashrc
$ nvcc -V
$ sudo cp ~/cudnn-linux-x86_64-8.5.0.96_cuda11-archive/include/* /usr/local/cuda-11.7/include
$ sudo cp ~/cudnn-linux-x86_64-8.5.0.96_cuda11-archive/lib/* /usr/local/cuda-11.7/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h
$ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
$ cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
$ ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep libcudnn
Terminal 열기
$ python
import torch
torch.cuda.is_available()