슬기로운 연구생활

GPU 데스크탑 세팅 본문

슬기로운 세팅 생활

GPU 데스크탑 세팅

vhrehfdl 2022. 5. 10. 13:31

1. nvidia-driver 설치

$ apt-get install nvidia-driver-470
$ nvidia-smi

 

2. cuda 설치

페이지 이동 : https://developer.nvidia.com/cuda-11-4-3-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local

$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin --no-check-certificate
$ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.4.3/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.3-470.82.01-1_amd64.deb --no-check-certificate
$ sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.3-470.82.01-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get -y install cuda
$ vi ~/.bashrc
export PATH=/usr/local/cuda-11.4/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

$ source ~/.bashrc
$ nvcc --version

 

3. cudnn 설치

$ tar xvzf cudnn-11.4-linux-x64-v8.2.4.15.solitairetheme8
$ sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
$ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn*.h /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

 

4. 하드 마운트

$ sudo fdisk -l
$ mkfs.ext4 /dev/sda1
$ sudo blkid
$ mkdir /data
$ vi /etc/fstab 
# UUID=e6cfb8f2-0d17-4717-a482-6719fb67e983	/data	ext4	defaults	0	0
$ sudo mount -a
$ df -h

 

5. root 접속

$ sudo passwd root
$ apt-get install ssh
$ vi /etc/ssh/sshd_config
PermitRootLogin yes
$ systemctl restart sshd

 

6. pyenv-virtualenv

$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
$ git clone https://github.com/pyenv/pyenv.git /data/.pyenv
$ echo 'export PYENV_ROOT="/data/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
$ pyenv install 3.7.11

$ git clone https://github.com/yyuu/pyenv-virtualenv.git /data/.pyenv/plugins/pyenv-virtualenv
$ pyenv virtualenv 3.7.11 hooni

 

7. pytorch install

$ pyenv shell hooni
$ pip install torch==1.10.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
$ python
import torch
torch.rand(10).to("cuda")

'슬기로운 세팅 생활' 카테고리의 다른 글

Mecab 윈도우 설치  (0) 2022.05.11
Konlpy 윈도우 설치  (0) 2022.05.11
nginx 도메인 주소 추가  (0) 2022.04.26
Mysql 설치 및 외부접속 허용  (0) 2022.04.26
Flask + Nginx + Uwsgi 연동  (0) 2022.04.26
Comments