MJay

GPU 서버에 Nvidia Driver , CUDA, CUDNN , Docker , Nvidia-Docker를 다시 깔기 본문

Linux

GPU 서버에 Nvidia Driver , CUDA, CUDNN , Docker , Nvidia-Docker를 다시 깔기

MJSon 2017. 8. 26. 20:04
Edit

GPU 서버에 Nvidia Driver , CUDA, CUDNN , Docker , Nvidia-Docker를 다시 깔기

학교 정전때문에 Docker도 실행이 안되고 nvidia-smi도 안되길래 다시 깔아봤다.

sudo apt update

일단 rabbitmq이랑 관련된 pakcage가 오류가 있다고 한다.
()NO_PUBKEY 6b~~~)

Public key를 추가하면 된다.

PUBKEY에 해당하는 public key를 추가해준다.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B73A36E6026DFCA

그럼 해결된다.

그 다음은 R-Studio 문제이다.

R-Studio랑 관련된 The repository 가 없다고 한다. 이전 R-Stuido을 지우고 그냥 새로운 r-studio을 깔았다.

sudo apt-get remove r-base-core 
sudo vi /etc/apt/source.list 여기 들어가서
deb http://cran.rstudio.com/bin/linux/ubuntu precise/ 이걸 추가해준다

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev //이건 안되는듯
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base

이렇게 해결된다.

마지막 문제점

이건 저 repository을 주석처리해버렸다.

여기 폴더에서

이 두파일에 들어가서 다 주석처리해버렸다.

에러에 나오는 PPA를 주석처리해버렸다. 그러니 해결이 됬다.

이렇게 apt-update 는 해결하고

OpenCL 을 해보려고 하다가 OpenCL.so 파일을 다 지워버렸다.

알고보면 libOpenCL.so은 cuda를 깔 때 같이 깔리는거라서

그냥 다시 다 깔기로했다.

ftp.daum.net 사용

vi /etc/apt/source.list를 보면

기존에는 ubuntu 저장소가 kr.ubuntu.com 뭐시기 뭐시기 되어있는데 그게 오류가 있다고 해서

ftp.daum.net 으로 바꿨다.

Cuda 삭제

이렇게 하면 사라질꺼같은디

폴더는 그냥 남아있다.

CUDA삭제하려면 그냥

rm -rf /usr/local/cuda

rm -rf /usr/local/cuda-8.0 하면 끝난다

cuDNN 삭제

cuDNN이랑 관련된 모든 파일도 /usr/local/cuda 폴더 안에 있기 떄문에 안해져도 된다.

sudo apt-get purge --auto-remove nvidia-cuda-toolkit

이렇게도 해준다고 한다.

Nvidia Driver도 지우기

sudo apt-get remove --purge nvidia-*

Nvidia Driver랑 Cuda-8.0 버전 설치

lspci | grep -i nvidia
uname -m && cat /etc/*release
gcc --version
uname -r
sudo apt-get install linux-headers-$(uname -r)
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
sudo apt-get update
sudo apt-get install cuda

cuDNN 설치

cudNN 다운로드 홈페이지에가서 Linux 용 cuDNN Library를 다운받는다
압축을 풀고 /usr/local/cuda에 옮긴다.


curl -O https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7/prod/8.0_20170802/cudnn-8.0-linux-x64-v7-tgz
tar -xzvf cudnn-8.0-linux-x64-v7.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
// a+r 모든 사람이 읽기 가능

cuDNN 설치 확인

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

Docker Engine 다시 설치

sudo apt-get remove docker docker-engine docker.io
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
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"
sudo apt-get update
1982 sudo apt-get install docker-ce
1983 apt-cache madison docker-ce
sudo apt-get install docker-ce=17.03.2~ce-0~ubuntu-xenial
sudo docker run hello-world

가끔식 apt-get -f install 하라는 명령이 나오면 하면 된다.

Nvidia-Docker


wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
nvidia-docker run --rm nvidia/cuda nvidia-smi
sudo nvidia-docker run --rm nvidia/cuda nvidia-smi

%0A%23%23%23%20GPU%20%uC11C%uBC84%uC5D0%20Nvidia%20Driver%20%2C%20CUDA%2C%20CUDNN%20%2C%20Docker%20%2C%20Nvidia-Docker%uB97C%20%uB2E4%uC2DC%20%uAE54%uAE30%0A%0A%uD559%uAD50%20%uC815%uC804%uB54C%uBB38%uC5D0%20Docker%uB3C4%20%uC2E4%uD589%uC774%20%uC548%uB418%uACE0%20nvidia-smi%uB3C4%20%uC548%uB418%uAE38%uB798%20%uB2E4%uC2DC%20%uAE54%uC544%uBD24%uB2E4.%0A%0A%60%60%60%0Asudo%20apt%20update%0A%60%60%60%0A%0A%21%5BAlt%20text%5D%28./1503732323529.png%29%0A%0A%3E%uC77C%uB2E8%20rabbitmq%uC774%uB791%20%uAD00%uB828%uB41C%20pakcage%uAC00%20%uC624%uB958%uAC00%20%uC788%uB2E4%uACE0%20%uD55C%uB2E4.%0A%3E%28%29NO_PUBKEY%206b%7E%7E%7E%29%0A%3E%0A%3EPublic%20key%uB97C%20%uCD94%uAC00%uD558%uBA74%20%uB41C%uB2E4.%0A%3E%0A%3EPUBKEY%uC5D0%20%uD574%uB2F9%uD558%uB294%20public%20key%uB97C%20%uCD94%uAC00%uD574%uC900%uB2E4.%0A%0A%60%60%60%0Asudo%20apt-key%20adv%20--keyserver%20keyserver.ubuntu.com%20--recv-keys%206B73A36E6026DFCA%0A%60%60%60%0A%3E%uADF8%uB7FC%20%uD574%uACB0%uB41C%uB2E4.%20%0A%0A%21%5BAlt%20text%5D%28./1503732623580.png%29%0A%0A%3E%uADF8%20%uB2E4%uC74C%uC740%20R-Studio%20%uBB38%uC81C%uC774%uB2E4.%0A%0A%21%5BAlt%20text%5D%28./1503732660213.png%29%0A%0A%3ER-Studio%uB791%20%uAD00%uB828%uB41C%20The%20repository%20%uAC00%20%uC5C6%uB2E4%uACE0%20%uD55C%uB2E4.%20%uC774%uC804%20R-Stuido%uC744%20%uC9C0%uC6B0%uACE0%20%uADF8%uB0E5%20%uC0C8%uB85C%uC6B4%20r-studio%uC744%20%uAE54%uC558%uB2E4.%0A%0A%60%60%60%0Asudo%20apt-get%20remove%20r-base-core%20%0Asudo%20vi%20/etc/apt/source.list%20%20%uC5EC%uAE30%20%uB4E4%uC5B4%uAC00%uC11C%0Adeb%20http%3A//cran.rstudio.com/bin/linux/ubuntu%20precise/%20%uC774%uAC78%20%uCD94%uAC00%uD574%uC900%uB2E4%0A%60%60%60%0A%0A%21%5BAlt%20text%5D%28./1503733021143.png%29%0A%0A%60%60%60%0Asudo%20apt-key%20adv%20--keyserver%20keyserver.ubuntu.com%20--recv-keys%20E084DAB9%0Asudo%20add-apt-repository%20ppa%3Amarutter/rdev%20%20//%uC774%uAC74%20%uC548%uB418%uB294%uB4EF%0Asudo%20apt-get%20update%0Asudo%20apt-get%20upgrade%0Asudo%20apt-get%20install%20r-base%0A%60%60%60%0A%3E%uC774%uB807%uAC8C%20%uD574%uACB0%uB41C%uB2E4.%0A%0A%3E%uB9C8%uC9C0%uB9C9%20%uBB38%uC81C%uC810%0A%21%5BAlt%20text%5D%28./1503733160121.png%29%0A%0A%3E%uC774%uAC74%20%uC800%20repository%uC744%20%uC8FC%uC11D%uCC98%uB9AC%uD574%uBC84%uB838%uB2E4.%0A%0A%21%5BAlt%20text%5D%28./1503733213000.png%29%0A%0A%3E%uC5EC%uAE30%20%uD3F4%uB354%uC5D0%uC11C%20%0A%0A%21%5BAlt%20text%5D%28./1503733357617.png%29%0A%20%0A%3E%20%uC774%20%uB450%uD30C%uC77C%uC5D0%20%uB4E4%uC5B4%uAC00%uC11C%20%uB2E4%20%uC8FC%uC11D%uCC98%uB9AC%uD574%uBC84%uB838%uB2E4.%0A%0A%0A%21%5BAlt%20text%5D%28./1503733332220.png%29%0A%0A%0A%3E%uC5D0%uB7EC%uC5D0%20%uB098%uC624%uB294%20PPA%uB97C%20%uC8FC%uC11D%uCC98%uB9AC%uD574%uBC84%uB838%uB2E4.%20%uADF8%uB7EC%uB2C8%20%uD574%uACB0%uC774%20%uB42C%uB2E4.%0A%3E%0A%3E%uC774%uB807%uAC8C%20apt-update%20%uB294%20%uD574%uACB0%uD558%uACE0%20%0A%3E%0A%3EOpenCL%20%uC744%20%uD574%uBCF4%uB824%uACE0%20%uD558%uB2E4%uAC00%20%20OpenCL.so%20%uD30C%uC77C%uC744%20%uB2E4%20%uC9C0%uC6CC%uBC84%uB838%uB2E4.%0A%3E%0A%3E%uC54C%uACE0%uBCF4%uBA74%20libOpenCL.so%uC740%20cuda%uB97C%20%uAE54%20%uB54C%20%uAC19%uC774%20%uAE54%uB9AC%uB294%uAC70%uB77C%uC11C%20%0A%3E%0A%3E%uADF8%uB0E5%20%uB2E4%uC2DC%20%uB2E4%20%uAE54%uAE30%uB85C%uD588%uB2E4.%20%0A%0A%23%23%23%23%23%20ftp.daum.net%20%uC0AC%uC6A9%0A%0A%3Evi%20/etc/apt/source.list%uB97C%20%uBCF4%uBA74%20%0A%0A%21%5BAlt%20text%5D%28./1503739789978.png%29%0A%0A%3E%uAE30%uC874%uC5D0%uB294%20ubuntu%20%uC800%uC7A5%uC18C%uAC00%20kr.ubuntu.com%20%uBB50%uC2DC%uAE30%20%uBB50%uC2DC%uAE30%20%uB418%uC5B4%uC788%uB294%uB370%20%uADF8%uAC8C%20%uC624%uB958%uAC00%20%uC788%uB2E4%uACE0%20%uD574%uC11C%0A%0A%3Eftp.daum.net%20%uC73C%uB85C%20%uBC14%uAFE8%uB2E4.%0A%0A%0A%0A%23%23%23%23%20Cuda%20%uC0AD%uC81C%0A%0A%21%5BAlt%20text%5D%28./1503733584135.png%29%0A%0A%3E%uC774%uB807%uAC8C%20%uD558%uBA74%20%uC0AC%uB77C%uC9C8%uAEBC%uAC19%uC740%uB514%0A%0A%3E%uD3F4%uB354%uB294%20%uADF8%uB0E5%20%uB0A8%uC544%uC788%uB2E4.%20%0A%0A%3ECUDA%uC0AD%uC81C%uD558%uB824%uBA74%20%uADF8%uB0E5%20%0A%0A%3Erm%20-rf%20/usr/local/cuda%0A%0A%3Erm%20-rf%20/usr/local/cuda-8.0%20%uD558%uBA74%20%uB05D%uB09C%uB2E4%0A%0A%23%23%23%23%20cuDNN%20%uC0AD%uC81C%0A%0A%3EcuDNN%uC774%uB791%20%uAD00%uB828%uB41C%20%uBAA8%uB4E0%20%uD30C%uC77C%uB3C4%20/usr/local/cuda%20%uD3F4%uB354%20%uC548%uC5D0%20%uC788%uAE30%20%uB584%uBB38%uC5D0%20%uC548%uD574%uC838%uB3C4%20%uB41C%uB2E4.%0A%0A%60%60%60%0Asudo%20apt-get%20purge%20--auto-remove%20nvidia-cuda-toolkit%0A%60%60%60%20%0A%3E%uC774%uB807%uAC8C%uB3C4%20%uD574%uC900%uB2E4%uACE0%20%uD55C%uB2E4.%0A%0A%0A%23%23%23%23%20%20Nvidia%20Driver%uB3C4%20%uC9C0%uC6B0%uAE30%0A%0A%60%60%60%0Asudo%20apt-get%20remove%20--purge%20nvidia-*%0A%60%60%60%0A%0A%23%23%23%23%20Nvidia%20Driver%uB791%20Cuda-8.0%20%uBC84%uC804%20%uC124%uCE58%0A%0A%60%60%60%0Alspci%20%7C%20grep%20-i%20nvidia%0Auname%20-m%20%26%26%20cat%20/etc/*release%0Agcc%20--version%0Auname%20-r%0Asudo%20apt-get%20install%20linux-headers-%24%28uname%20-r%29%0Awget%20https%3A//developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb%0Adpkg%20-i%20cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb%0Asudo%20apt-get%20update%0Asudo%20apt-get%20install%20cuda%0A%60%60%60%0A%0A%23%23%23%23%20cuDNN%20%uC124%uCE58%0A%0A%3E%20cudNN%20%uB2E4%uC6B4%uB85C%uB4DC%20%uD648%uD398%uC774%uC9C0%uC5D0%uAC00%uC11C%20Linux%20%uC6A9%20cuDNN%20Library%uB97C%20%uB2E4%uC6B4%uBC1B%uB294%uB2E4%0A%3E%20%uC555%uCD95%uC744%20%uD480%uACE0%20/usr/local/cuda%uC5D0%20%uC62E%uAE34%uB2E4.%0A%0A%60%60%60%0A%0Acurl%20-O%20https%3A//developer.nvidia.com/compute/machine-learning/cudnn/secure/v7/prod/8.0_20170802/cudnn-8.0-linux-x64-v7-tgz%0Atar%20-xzvf%20cudnn-8.0-linux-x64-v7.tgz%0Asudo%20cp%20cuda/include/cudnn.h%20/usr/local/cuda/include%0Asudo%20cp%20cuda/lib64/libcudnn*%20/usr/local/cuda/lib64%0Asudo%20chmod%20a+r%20%20/usr/local/cuda/include/cudnn.h%20/usr/local/cuda/lib64/libcudnn*%0A//%20a+r%20%uBAA8%uB4E0%20%uC0AC%uB78C%uC774%20%uC77D%uAE30%20%uAC00%uB2A5%0A%0A%60%60%60%0A%0A%23%23%23%23%20cuDNN%20%uC124%uCE58%20%uD655%uC778%0A%0A%60%60%60%0Acat%20/usr/local/cuda/include/cudnn.h%20%7C%20grep%20CUDNN_MAJOR%20-A%202%0A%60%60%60%0A%0A%21%5BAlt%20text%5D%28./1503739603506.png%29%0A%0A%23%23%23%23%20Docker%20Engine%20%uB2E4%uC2DC%20%uC124%uCE58%0A%0A%60%60%60%0Asudo%20apt-get%20remove%20docker%20docker-engine%20docker.io%0Asudo%20apt-get%20install%20%20%20%20%20linux-image-extra-%24%28uname%20-r%29%20%20%20%20%20linux-image-extra-virtual%0Acurl%20-fsSL%20https%3A//download.docker.com/linux/ubuntu/gpg%20%7C%20sudo%20apt-key%20add%20-%0Asudo%20apt-key%20fingerprint%200EBFCD88%0Asudo%20add-apt-repository%20%20%20%20%22deb%20%5Barch%3Damd64%5D%20https%3A//download.docker.com/linux/ubuntu%20%5C%0A%24%28lsb_release%20-cs%29%20%5C%0Astable%22%0Asudo%20apt-get%20update%0A%201982%20%20sudo%20apt-get%20install%20docker-ce%0A%201983%20%20apt-cache%20madison%20docker-ce%0A%20sudo%20apt-get%20install%20docker-ce%3D17.03.2%7Ece-0%7Eubuntu-xenial%0A%20sudo%20docker%20run%20hello-world%0A%60%60%60%0A%3E%20%uAC00%uB054%uC2DD%20apt-get%20-f%20install%20%uD558%uB77C%uB294%20%uBA85%uB839%uC774%20%uB098%uC624%uBA74%20%uD558%uBA74%20%uB41C%uB2E4.%0A%0A%23%23%23%23%20Nvidia-Docker%0A%0A%60%60%60%0A%0Awget%20-P%20/tmp%20https%3A//github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb%0Asudo%20dpkg%20-i%20/tmp/nvidia-docker*.deb%20%26%26%20rm%20/tmp/nvidia-docker*.deb%0Anvidia-docker%20run%20--rm%20nvidia/cuda%20nvidia-smi%0Asudo%20nvidia-docker%20run%20--rm%20nvidia/cuda%20nvidia-smi%0A%0A%60%60%60%0A%21%5BAlt%20text%5D%28./1503740306371.png%29%0A%21%5BAlt%20text%5D%28./1503740358426.png%29%20

'Linux' 카테고리의 다른 글

P100 서버 설치 과정  (0) 2017.09.13
GPU Server import tensorflow as tf 오류  (0) 2017.09.12
vim 꿀팁  (0) 2017.07.19
C 프로그래밍 : C 컴파일러 [gcc](Scrap)  (0) 2017.07.16
Vim에 쓸만한 shortcut  (0) 2017.07.16