본문 바로가기

날리지/AI

manjaro에 gtx 1060 cuda 11.0, cudnn 8.1 설치하기

This tutorial is tested with RTX3090 on Ubuntu 20.04 LTS. The refereed installation guide is from: https://medium.com/@dun.chwong/the-ultimate-guide-ubuntu-18-04-37bae511efb0

1. Configuration

2. Nvidia (Driver, CUDA, cuDnn)

2.1 Install Nvidia Driver

nvidia 460.67-5 이 manjaro AUR에서 최신 nvidia 드라이버다. 설치하면 된다. 

필자의 그래픽카드는 몇년 전의 gtx 1060 인데,. 이걸 설치하였다. 상위는 당연히 호환이 됨 

Reboot your computer after installation!!!

Verification

Type `nvidia-smi` to see the GPU info and the processes that are using Nvidia GPU

nvidia-smi

Verification of the installed driver

RTX 3090 대신에 GTX 1060 이라는 걸 제외하고 정확히 동일함

2.2 Install CUDA 11.2 Toolkit

yay -S cuda

하면 cuda 11.0 이 설치가 된다. 최신 버전이 12.0이니 그대로 사용해도 될 듯 ...  

Set environmental variables in the `~/.bashrc`.

sudo nano ~/.bashrc

Add the following at the end of `~/.bashrc`

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

2.3 Install cuDNN v8.1.0

cuDNN Archive

NVIDIA cuDNN is a GPU-accelerated library of primitives for deep neural networks.

developer.nvidia.com

 

Download cuDNN v8.1.0 (released on January 26th, 2021), for CUDA 11.0,11.1, and 11.2 from the link above. Then, unzip the embedded folder.

tar -zvxf cudnn-11.2-linux-x64-v8.1.0.77.tgz

Link the downloaded lib64 to local environmental variables. First, open `~/.bashrc`by run the following.

cd ~
sudo gedit .bashrc

Add the following at the end of `~/.bashrc`. Note: replace xxx with your own path.

export LD_LIBRARY_PATH=xxx/cuda/lib64:$LD_LIBRARY_PATH

Save the file, and run by the following at the terminal.

source .bashrc

Restart the terminal, and copy the head files to the CUDA folder.

cd xxx/cuda/include
sudo cp *.h /usr/local/cuda/include/
# replace xxx with your own path

Finally, reset the read and write permissions of the cudnn.h file.

sudo chmod a+r /usr/local/cuda/include/cudnn.h

To verify the installation, check `nvidia-smi`, and `nvcc -V`.

nvidia-smi
nvcc -V