728x90
최근 tensorflow 2.0이 release 된 이후로, cuda 설치가 매우 간단해졌다.
(저는 cuda+cudnn 설치하는 시간 5분 걸렸습니다.)
Ubuntu 16.04 (CUDA 10) + cudnn + driver 설치
# 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-repo-ubuntu1604_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
wget http://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
# Install NVIDIA driver
# Issue with driver install requires creating /usr/lib/nvidia
sudo mkdir /usr/lib/nvidia
sudo apt-get install --no-install-recommends nvidia-driver-418
# Reboot. Check that GPUs are visible using the command: nvidia-smi
# Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
cuda-10-0 \
libcudnn7=7.6.2.24-1+cuda10.0 \
libcudnn7-dev=7.6.2.24-1+cuda10.0
# Install TensorRT. Requires that libcudnn7 is installed above.
sudo apt-get install -y --no-install-recommends libnvinfer5=5.1.5-1+cuda10.0 \
libnvinfer-dev=5.1.5-1+cuda10.0
Ubuntu 16.04 (CUDA 9.0 for TensorFlow < 1.13.0) + cudnn + driver 설치
# Add NVIDIA package repository
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt install ./cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget http://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 update
# Install the NVIDIA driver
# Issue with driver install requires creating /usr/lib/nvidia
sudo mkdir /usr/lib/nvidia
sudo apt-get install --no-install-recommends nvidia-410
# Reboot. Check that GPUs are visible using the command: nvidia-smi
# Install CUDA and tools. Include optional NCCL 2.x
sudo apt install cuda9.0 cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 \
cuda-cusolver-9-0 cuda-cusparse-9-0 libcudnn7=7.2.1.38-1+cuda9.0 \
libnccl2=2.2.13-1+cuda9.0 cuda-command-line-tools-9-0
# Optional: Install the TensorRT runtime (must be after CUDA install)
sudo apt update
sudo apt install libnvinfer4=4.1.2-1+cuda9.0
위에는 cuda-10.0, 아래는 cuda-9.0 인데, 2개 모두 동시 설치 가능하다.
본인 계정 -> basrhc 에 들어가서 아래와 같이 사용할 버전을 typing 한다.
vi ~/.bashrc
export PATH=/mnt/junewoo/bin:/mnt/junewoo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
# Path for cuda-9.0
export PATH=$PATH:/usr/local/cuda-9.0/bin
# Path for cuda-10.0
#export PATH=$PATH:/usr/local/cuda-10.0/bin
# Path for cudnn with cuda-9.0
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/junewoo/utils/cuda-9.0/lib64
# Path for cudnn with cuda-10.0
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:/mnt/junewoo/utils/cuda-10.0/lib64
만약 특정 폴더에 cudnn이 있을 경우(하지만 위의 명령어대로 설치할 경우 usr/local/cuda-n.m에 설치된다.
# Path for cudnn with cuda-10.0
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:/where/your_dir/cuda-10.0/lib64
그 뒤,
source ~/.bashrc
nvcc -V
확인해보면 설치된 cuda version 체크할 수 있다.
진짜 5분만에 설치할 수 있다 매우 간단...
728x90
'딥러닝 > CUDA' 카테고리의 다른 글
Tensorflow 이용 후 cuDNN 초기화 및 GPU에 garbage메모리 있을 때 처리법 (4) | 2018.04.12 |
---|---|
nvcc --Version 업데이트 및 torch, pytorch 설치시 nvcc 오류 (0) | 2017.09.28 |
CUDA 8.0, 7.5, 6.0 등 예전 버전 다운 (0) | 2017.09.28 |
CUDA (쿠다) 란, 왜 사용하는 것인가. (0) | 2017.03.14 |
CUDA 란? (0) | 2017.03.14 |