본문 바로가기

Artificial Intelligence/Natural Language Processing

Ubuntu 16.04 Server에서 CUDA 9.0 + CUDNN 7.1 + Anaconda 설치

Ubuntu 16.04 Server에서 CUDA 9.0 + CUDNN 7.1 _ Anaconda 설치

 

설치순서

1. CUDA

2. CUDNN

3. Anaconda

 

설치하시기 전에 버전확인 먼저 하시고 설치

최신버전 추가

1. CUDA 9.0 설치

https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=deblocal

 

local version

파일을 다운받아서 하는 방법이다.

patch 파일도 cuBLAS관련해서 세개나 있어서 각각 업데이트 해줘야 한다.

 

#본 파일

cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb

 

#패치 파일

cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-3_1.0-1_amd64.deb

cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb

cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb

 

 

본설치

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda

 

패치 적용

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get upgrade cuda-9-0

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get upgrade cuda-9-0

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-3_1.0-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get upgrade cuda-9-0

 

1.1.Ubuntu 18.04(CUDA 11.0)

# Add NVIDIA package repositories
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update

wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb

sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt-get update

wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
sudo apt install ./libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
sudo apt-get update

# Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
    cuda-11-0 \
    libcudnn8=8.0.4.30-1+cuda11.0  \
    libcudnn8-dev=8.0.4.30-1+cuda11.0

# Reboot. Check that GPUs are visible using the command: nvidia-smi

# Install TensorRT. Requires that libcudnn8 is installed above.
sudo apt-get install -y --no-install-recommends libnvinfer7=7.1.3-1+cuda11.0 \
    libnvinfer-dev=7.1.3-1+cuda11.0 \
    libnvinfer-plugin7=7.1.3-1+cuda11.0
1.2.Ubuntu 16.04(CUDA 11.0)
# Add NVIDIA package repositories
# Add HTTPS support for apt-key
sudo apt-get install gnupg-curl
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-ubuntu1604.pin
sudo mv cuda-ubuntu1604.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/ /"
sudo apt-get update
wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt-get update
wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
sudo apt install ./libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
sudo apt-get update

# Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
    cuda-11-0 \
    libcudnn8=8.0.4.30-1+cuda11.0  \
    libcudnn8-dev=8.0.4.30-1+cuda11.0


# Reboot. Check that GPUs are visible using the command: nvidia-smi

# Install TensorRT. Requires that libcudnn7 is installed above.
sudo apt-get install -y --no-install-recommends \
    libnvinfer7=7.1.3-1+cuda11.0 \
    libnvinfer-dev=7.1.3-1+cuda11.0 \
    libnvinfer-plugin7=7.1.3-1+cuda11.0 \
    libnvinfer-plugin-dev=7.1.3-1+cuda11.0

 

2. CUDNN v7.4.2 설치

https://developer.nvidia.com/cudnn

 

CUDA Deep Neural Network

cuDNN provides researchers and developers with high-performance GPU acceleration.

developer.nvidia.com

로그인 후 버전에 맞는 CUDNN 다운로드

$ sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-3_1.0-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get upgrade cuda-9-0

 

$ tar xvzf cudnn-9.0-linux-x64-v7.4.2.24.solitairetheme8
$ sudo cp -p 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*
$ sudo apt-get install libcupti-dev
$ vi ~/bashrc

export PATH=/usr/local/cuda/bin:$PATH 

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" 

export CUDA_HOME=/usr/local/cuda

 

$ source ~/.bashrc
$ nvcc --version

 

3. Anaconda 3 설치

 

 

https://www.anaconda.com/download/

$ chmod +x Anaconda3-2018.12-Linux-x86_64.sh 
$ bash Anaconda3-2018.12-Linux-x86_64.sh 
$ source ~/.bashrc
$ conda list

 

 

 

 

 

 

 

 

 

반응형
LIST