Posts

Wednesday, 30 January 2019

Setting to use my gpu : NVIDIA graphic drivers / CUDA


Install NVIDIA Graphic Drivers

Find your NVIDIA driver on NVIDIA website and download it. I downloaded NVIDIA-Linux-x86_64-410.93. It should be installed without lightDM. You should open the TTY with ctrl + alt +f1 before you stop the lightDM. TTY's are text-only terminals commonly used as a way to get access to the computer to fix things, without actually logging into a possibly b0rked desktop.

 sudo service lightdm stop  
 chmod +x ./NVIDIA-Linux-x86_64-410.93  
 sudo ./NVIDIA-Linux-x86_64-410.93  
 sudo reboot  

Install CUDA 9.0 and cuDNN 7.0 on Ubuntu 16.04

Find CUDA version you want on NVIDIA website or if you are looking for the same version with me just follow me from the first row. If you downloaded a different one, start from the second row and change the file name as yours.

 # Uninstall Old Version  
 sudo apt-get purge cuda  
 sudo apt-get purge libcudnn6  
 sudo apt-get purge libcudnn6-dev  

 # Install CUDA toolkit 9.0 and cuDNN 7.0  
 wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.1.4-1+cuda9.0_amd64.deb  
 wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.1.4-1+cuda9.0_amd64.deb  

If you just formatted your desktop, you need to fo this before dpkg.

 sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub  

 sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb  
 sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb  
 sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb  
 sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb  
 sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb

 sudo apt-get update  
 sudo apt-get install cuda=9.0.176-1  
 sudo apt-get install libcudnn7-dev  
 sudo apt-get install libnccl-dev  

Modify the PATH. Open '.bashrc' file and end two lines below.

 gedit .bashrc
 export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}  
 export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
 source .bashrc  

And then reboot your desktop.

 reboot  

Verify CUDA installation.

 jihyo@jihyo-desktop:~$ nvidia-smi  
 Wed Jan 30 15:19:03 2019      
 +-----------------------------------------------------------------------------+  
 | NVIDIA-SMI 410.48         Driver Version: 410.48          |  
 |-------------------------------+----------------------+----------------------+  
 | GPU Name    Persistence-M| Bus-Id    Disp.A | Volatile Uncorr. ECC |  
 | Fan Temp Perf Pwr:Usage/Cap|     Memory-Usage | GPU-Util Compute M. |  
 |===============================+======================+======================|  
 |  0 GeForce RTX 2070  Off | 00000000:01:00.0 On |         N/A |  
 | 0%  49C  P8  25W / 215W |  737MiB / 7944MiB |   2%   Default |  
 +-------------------------------+----------------------+----------------------+  
 +-----------------------------------------------------------------------------+  
 | Processes:                            GPU Memory |  
 | GPU    PID  Type  Process name               Usage   |  
 |=============================================================================|  
 |  0   1021   G  /usr/lib/xorg/Xorg              550MiB |  
 |  0   1581   G  compiz                    125MiB |  
 |  0   1980   G  ...uest-channel-token=15398769083618213155  59MiB |  
 +-----------------------------------------------------------------------------+  
 jihyo@jihyo-desktop:~$ nvcc -V  
 nvcc: NVIDIA (R) Cuda compiler driver  
 Copyright (c) 2005-2015 NVIDIA Corporation  
 Built on Tue_Aug_11_14:27:32_CDT_2015  
 Cuda compilation tools, release 7.5, V7.5.17  







No comments:

Post a Comment

[ new blog ]

new blog https://jihyo-jeon.github.io/