반응형

#### 환경

Ubuntu 18.04

Nvidia GTX 1060 6G (Notebook)

 

#### 목표

Nvidia-driver-455

CUDA 11.0.2

CuDNN 8.0

Tensorflow 2.4.0

Pytorch 1.7.1

 

 

### Nvidia driver 삭제

sudo apt-get -y remove --purge nvidia*

sudo apt-get -y autoremove

sudo apt-get -y autoclean

 

### CUDA 삭제

sudo apt-get -y remove --purge cuda*

sudo rm -rf /usr/local/cuda*

 

### CuDNN 삭제

sudo apt-get -y remove --purge cudnn*

 

 

 

### Nvidia driver 설치

sudo apt-add-repository ppa:graphics-drivers/ppa

sudo apt-get update

sudo apt-get install nvidia-driver-[TAP]

 

sudo apt-get install nvidia-driver-455

sudo reboot

sudo apt-get install

 

### CUDA 다운받기

# developer.nvidia.com/cuda-toolkit-archive

wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run

sudo sh cuda_11.0.2_450.51.05_linux.run

# bashrc에 cuda path 잡아주기

export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

 

### CuDNN

# 가이드대로 docs.nvidia.com/deeplearning/cudnn/install-guide/index.html

# developer.nvidia.com/rdp/cudnn-download

developer.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.0_20201106/Ubuntu18_04-x64/libcudnn8_8.0.5.39-1+cuda11.0_amd64.deb

libcudnn8_8.0.5.39-1+cuda11.0_amd64.deb

developer.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.0_20201106/Ubuntu18_04-x64/libcudnn8-dev_8.0.5.39-1+cuda11.0_amd64.deb

libcudnn8-dev_8.0.5.39-1+cuda11.0_amd64.deb

developer.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.0_20201106/Ubuntu18_04-x64/libcudnn8-samples_8.0.5.39-1+cuda11.0_amd64.deb

libcudnn8-samples_8.0.5.39-1+cuda11.0_amd64.deb

 

### CuDNN Test

cp -r /usr/src/cudnn_samples_v8/ $HOME

cd $HOME/cudnn_samples_v8/mnistCUDNN

make clean && make

./mnistCUDNN

# 잘 깔렸으면 "Test passed!" 라는 메시지가 나온다.

 

 

 

### Docker

# Set up the repo

sudo apt-get update

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install Docker engine

sudo apt-get update

sudo apt-get install -y docker-ce docker-ce-cli containerd.io

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update

sudo apt-get install -y nvidia-docker2

sudo systemctl restart docker

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

하는중

# pytorch on conda

conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch

 

 

728x90

+ Recent posts