본문 바로가기
Ubuntu Server

[Ubuntu] Ubuntu server(20.04.5 LTS) + CUDA 11.6 + cudnn8.4.0 설치

by pulluper 2022. 9. 13.
반응형

1. ubuntu 20.04.5 설치 (Rufus)

 

https://releases.ubuntu.com/20.04.5/?_ga=2.163840441.788706021.1663029194-1495615447.1663029194 

 

Ubuntu 20.04.5 LTS (Focal Fossa)

Select an image Ubuntu is distributed on three types of images described below. Desktop image The desktop image allows you to try Ubuntu without changing your computer at all, and at your option to install it permanently later. This type of image is what m

releases.ubuntu.com

Swap 10000MB, EFI 500MB, else root (/) 

 

2. conda 설치

 

sudo apt-get update
wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
bash Anaconda3-2022.05-Linux-x86_64.sh
nano ~/.bashrc
# 추가
export PATH="$HOME/anaconda3/bin:$PATH"
source ~/.bashrc
# 확인
conda -V

 

3. driver 설치 

 

ubuntu-drivers devices
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt-get install nvidia-driver-510
# 재부팅
sudo reboot
# 확인
nvidia-smi

 

4. cuda 11.6 설치

 

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.6.0/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
sudo nano ~/.bashrc
# 추가
export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
# 확인
nvcc -V

 

5.  cudnn 설치

 

cudnn 8.4.0 다운

https://developer.nvidia.com/compute/cudnn/secure/8.4.0/local_installers/11.6/cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive.tar.xz

(로그인 필요)

# 압축풀기
unxz cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive.tar.xz
tar -xvf cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive.tar
# 파일 복붙
sudo cp cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive/include/* /usr/local/cuda-11.6/include
sudo cp -P cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive/lib/* /usr/local/cuda-11.6/lib64
sudo chmod a+r /usr/local/cuda-11.6/lib64/libcudnn*
# 확인
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

 

6. 가상환경 만들기

 

conda create -n pytorch python=3.9
conda activate pytorch

 

7. pytorch 1.12.1  설치 

 

conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.6 -c pytorch -c conda-forge

https://pytorch.org/get-started/previous-versions/ 참고

반응형

댓글