chldydgh4687 / 00Self-Linux_trial_and_error

Linux & DeepLearning
0 stars 0 forks source link

[Tip] [Linux]_CUDA 9.0 설치(현 : 18.04 LTS) #32

Open chldydgh4687 opened 4 years ago

chldydgh4687 commented 4 years ago

runfile에 해당하는 base 파일과 patch파일을 받은 뒤 해당 경로로 가서 다음의 명령어를 진행합니다. 설치이전에 update 와 upgrade를 충분히 하신 뒤에 libraries를 다운 받고 진행하세요.

$sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
$sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev
$chmod a+x cuda*
$sudo ./sudo sh cuda_9.0.176_384.81_linux.run --override compiler

이 후 cuda 설명을 스페이스바, 엔터를 누르다보면, 다음과 같은 설치 설정이 뜨는데 그대로 입력하면된다.

-----------------
Do you accept the previously read EULA?
accept/decline/quit: accept          

You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n

Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
 [ default is /usr/local/cuda-9.0 ]: 

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /home/ivcl ]: 

Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
Installing the CUDA Samples in /home/ivcl ...
Copying samples to /home/ivcl/NVIDIA_CUDA-9.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-9.0
Samples:  Installed in /home/ivcl

Please make sure that
 -   PATH includes /usr/local/cuda-9.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_15209.log

위 Summary 처럼 Toolkit과 sampoles가 제대로 잡히면 성공이다. 어떠한 부정어가 떠서 위와 다를 경우 아래를 참고하여 위와 같은 화면을 띄우도록 한다. 이제 패치를 설치도 똑같은 방법으로 설치한 이 후 cuda의 경로를 설정해주면 된다.

chldydgh4687 commented 4 years ago

$sudo ./cuda_9.0.176_384.81_linux.run 할 경우

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installation Failed. Using unsupported Compiler.
Samples:  Cannot find Toolkit in /usr/local/cuda-6.5

Logging to /tmp/cuda_install_37767.log

다음과 같이 Toolkit 에서 인식이 안됨 따라서 위에서 제시한 방법으로 설치할 것..!!!

chldydgh4687 commented 4 years ago

but missing recommended libraries

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-9.0
Samples:  Installed in /home/ivcl, but missing recommended libraries

다음의 명령어로 install third-party libraries를 설치해야함.

$ sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
$ sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev
chldydgh4687 commented 4 years ago

cuda 경로 추가

일단 anaconda와 cudnn을 설치하지 않았으므로 다음 넣어달라는 path만 넣는다.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-9.0
Samples:  Installed in /home/ivcl

Please make sure that
 -   PATH includes /usr/local/cuda-9.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin
$sudo gedit ~/.bashrc

bashrc 파일 맨 밑에 다음을 추가 하고 저장 >> 종료한다.

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64
chldydgh4687 commented 4 years ago

최종 설치 확인

$ nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

다음과 같이 떠야 성공이다. 이제 cudnn을 설치하러가자.