1. 程式人生 > >CentOS 7中以runfile形式安裝CUDA 9.0

CentOS 7中以runfile形式安裝CUDA 9.0

more tex egl ttr rom pack nvi black ons

GPU: NVIDIA Tesla K40C

Enter the ‘root‘ mode:

$ su -

1. Pre-installation

1.1 Verify you have a CUDA-capable GPU

$ lspci | grep -i nvidia

1.2 Verify you have a supported version of Linux

$ uname -m && cat /etc/*release

1.3 Verify the system has gcc installed

$ gcc --version

1.4 Verify the system has the correct kernel headers and development packages installed

$ uname -r

Note: If you perform a system update which changes the version of the linux kernel being used, make sure to rerun the commands below to ensure you have the correct kernel headers and kernel development packages installed. Otherwise, the CUDA Driver will fail to work with the new kernel.

$ yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

2. Runfile installation

2.1 Disable the Nouveau drivers

The Nouveau drivers are loaded if the following command prints anything:

$ lsmod | grep nouveau

To disable the Nouveau drivers, creating a file at "/usr/lib/modprobe.d/blacklist-nouveau.conf" with following content:

blacklist nouveau

options nouveau modeset=0

Then regenerate the kernel inittramfs:

$ dracut --force

2.2 Reboot into the text mode (runlevel 3)

$ systemctl set-default multi-user.target

$ init 3

$ reboot

2.3 Run the CUDA toolkit installer

$ sh cuda_<version>_linux.run --no-opengl-libs

Note:

(1) If installing the driver, the installer will also ask if the openGL libraries should be installed. If the GPU used for display is not an NVIDIA GPU, the NVIDIA openGL libraries should not be installed. Otherwise, the openGL libraries used by the graphics driver of the non-NVIDIA GPU will be overwritten and the GUI will not work. If performing a silent installation, the --no-opengl-libs option should be used to prevent the openGL libraries from being installed. See the Advanced Options section for more details.

(2) If the GPU used for display is an NVIDIA GPU, the X server configuration file, /etc/X11/xorg.conf, may need to be modified. In some cases, nvidia-xconfig can be used to automatically generate a xorg.conf file that works for the system. For non-standard systems, such as those with more than one GPU, it is recommended to manually edit the xorg.conf file. Consult the xorg.conf documentation for more information.

2.4 Reboot into the graphical mode (runlevel 5)

$ systemctl set-default graphical.target

$ init 5

3. Post-installation actions

3.1 Environment setup

$ export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}

To change the environment variables for 64-bit operating systems:

$ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

3.2 Install Third-party libraries

$ yum install freeglut-devel libX11-devel libXi-devel libXmu-devel \ make mesa-libGLU-devel

3.3 Verify the installation

(1) Verify Nvidia driver

$ cat /proc/driver/nvidia/version

$ nvidia-smi // NVIDIA System Management Interface: It allows administrators to query GPU device state.

(2) Verify the cuda compiler

$ nvcc --version / nvcc -V

3.4 Compiler CUDA examples

Enter the "~/NVIDIA_CUDA-9.0_Samples" directory, type "make" command to run the "Makefile" file.

After compilation, then enter the "~/NVIDIA_CUDA-9.0_Samples/bin" directory to find and run the "deviceQuery" executable file.

This command shows the information of GPU device.

CentOS 7中以runfile形式安裝CUDA 9.0