AI

Nvidia Driver & CUDA install

JungGwig 2019. 10. 1. 16:14
$ sudo vim /etc/modprobe.d/blacklist-nouveau.conf
// nouveau 비활성화

[ CentOS 7 ]

 

1. 터미널을 통해 현재 사용중인 Nvidia graphic card 모델을 확인한다.

lshw -numeric -C display
  *-display
       description: VGA compatible controller
       product: GK208 [GeForce GT 635] [10DE:1280]
       vendor: NVIDIA Corporation [10DE]
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list
       configuration: latency=0
       resources: irq:32 memory:f6000000-f6ffffff memory:e8000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:f7000000-f707ffff

 

2. nvidia.com 사이트에서 자신의 그래픽 카드 모델과 운영체제에 맞는 Nvidia driver package를 설치

$ ls NVIDIA-Linux-x86_64-*
NVIDIA-Linux-x86_64-430.50.run

 

3. Nvidia driver 설치를 위해 필요한 라이브러리 및 패키지 설치

$ yum groupinstall -y "Development Tools"
$ yum install -y kernel-devel epel-release
$ yum install -y dkms // this package is optional

 

4. /etc/default/grub 파일을 수정하여 nouveau driver를 disable 시킨다. GRUB_CMDLINE_LINUX 줄에 nouveau.modeset=0를 추가하여 이를 수행할 수 있다.

GRUB_TIMEOUT=5                                                                                                                                      
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"                                                                                   
GRUB_DEFAULT=saved                                                                                                                                  
GRUB_DISABLE_SUBMENU=true                                                                                                                           
GRUB_TERMINAL_OUTPUT="console"                                                                                                                      
GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet nouveau.modeset=0"                                                                                  
GRUB_DISABLE_RECOVERY="true"
BIOS:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
EFI:
$ sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

 

5. Nvidia driver는 반드시 Xorg 서버가 멈춘 상태에서 설치되어야 한다.

$ systemctl isolate multi-user.target

 

6. Nvidia driver installer 실행

$ bash NVIDIA-Linux-x86_64-*

 

Troubleshooting

Error : Unable to determine the version of the kernel sources located in '/lib/modules/3.10.0-693.11.6.el7.x86_64/source/'. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.

 

Solution : sh Nvidia-version_you_are_using-.run --kernel-source-path=/lib/modules/3.10.0-1062.1.1.el7.x86_64/build

 

 

[ Ubuntu 16.04 ]

* 설치전 : Ubuntu에는 nouveau라는 기본 그래픽 드라이버가 있다. 기본 그래픽 드라이버가 종료되야만 nvidia 드라이버의 설치가 가능하다.

 

 

1. 터미널을 통해 현재 사용중인 Nvidia graphic card 모델을 확인한다.

$ sudo lshw -C video
  *-display
       description: VGA compatible controller
       product: GK208 [GeForce GT 635]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nouveau latency=0
       resources: irq:32 memory:f6000000-f6ffffff memory:e8000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff

 

2. https://developer.nvidia.com/cuda-gpus에서 자신의 그래픽 카드 모델 연산 능력과 운영체제에 맞는 CUDA Toolkit 설치

$ wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
// Cuda 8 version for ubuntu 16.04

$ ls cuda_8*
cuda_8.0.61_375.26_linux-run

$ chmod 755 cuda_8*

$ ./cuda_8*

3. Nvidia driver 설치를 위해 필요한 라이브러리 및 패키지 설치

$ yum groupinstall -y "Development Tools"
$ yum install -y kernel-devel epel-release
$ yum install -y dkms // this package is optional

4. /etc/default/grub 파일을 수정하여 nouveau driver를 disable 시킨다. GRUB_CMDLINE_LINUX 줄에 nouveau.modeset=0를 추가하여 이를 수행할 수 있다.

GRUB_TIMEOUT=5                                                                                                                                      
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"                                                                                   
GRUB_DEFAULT=saved                                                                                                                                  
GRUB_DISABLE_SUBMENU=true                                                                                                                           
GRUB_TERMINAL_OUTPUT="console"                                                                                                                      
GRUB_CMDLINE_LINUX="crashkernel=auto ... rhgb quiet nouveau.modeset=0"                                                                                  
GRUB_DISABLE_RECOVERY="true"
BIOS:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
EFI:
$ sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

 

5. Nvidia driver는 반드시 Xorg 서버가 멈춘 상태에서 설치되어야 한다.

$ systemctl isolate multi-user.target

 

6. Nvidia driver installer 실행

$ bash NVIDIA-Linux-x86_64-*