Install CUDA on CentOS

Verify You Have a CUDA-Capable GPU

To verify that your GPU is CUDA-capable, go to your distribution’s equivalent of System Properties, or, from the command line, enter:

1
lspci | grep -i nvidia

If you do not see any settings, update the PCI hardware database that Linux maintains by entering update-pciids (generally found in /sbin) at the command line and rerun the previous lspci command.

If your graphics card is from NVIDIA and it is listed in CUDA-GPUS, your GPU is CUDA-capable.

The Release Notes for the CUDA Toolkit also contain a list of supported products.

Verify You Have a Supported Version of Linux

The CUDA Development Tools are only supported on some specific distributions of Linux. These are listed in the CUDA Toolkit release notes.

To determine which distribution and release number you’re running, type the following at the command line:

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

You should see output similar to the following, modified for your particular system:

x86_64

Red Hat Enterprise Linux Workstation release 6.0 (Santiago)
The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.

Verify the System Has gcc Installed

The gcc compiler is required for development using the CUDA Toolkit. It is not required for running CUDA applications. It is generally installed as part of the Linux installation, and in most cases the version of gcc installed with a supported version of Linux will work correctly.

To verify the version of gcc installed on your system, type the following on the command line:

1
gcc --version

If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.

Verify the System has the Correct Kernel Headers and Development Packages Installed

The CUDA Driver requires that the kernel headers and development packages for the running version of the kernel be installed at the time of the driver installation, as well whenever the driver is rebuilt. For example, if your system is running kernel version 3.17.4-301, the 3.17.4-301 kernel headers and development packages must also be installed.

While the Runfile installation performs no package validation, the RPM and Deb installations of the driver will make an attempt to install the kernel header and development packages if no version of these packages is currently installed. However, it will install the latest version of these packages, which may or may not match the version of the kernel your system is using. Therefore, it is best to manually ensure the correct version of the kernel headers and development
packages are installed prior to installing the CUDA Drivers, as well as whenever you change the kernel version.

The version of the kernel your system is running can be found by running the following command:

1
uname -r

This is the version of the kernel headers and development packages that must be installed prior to installing the CUDA Drivers. This command will be used multiple times below to specify the version of the packages to install. Note that below are the common-case scenarios for kernel usage. More advanced cases, such as custom kernel branches, should ensure that their kernel headers and sources match the kernel build they are running.

RHEL/CentOS

The kernel headers and development packages for the currently running kernel can be installed with:

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

Fedora

The kernel headers and development packages for the currently running kernel can be installed with:

1
sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

OpenSUSE/SLES

Use the output of the uname command to determine the running kernel’s version and variant:

1
uname -r

1
3.16.6-2-default

In this example, the version is 3.16.6-2 and the variant is default. The kernel headers and development packages can then be installed with the following command, replacing and with the variant and version discovered from the previous uname command:

1
sudo zypper install kernel-<variant>-devel=<version>

Ubuntu

The kernel headers and development packages for the currently running kernel can be installed with:

1
sudo apt-get install linux-headers-$(uname -r)

Read more at: Cuda installation guide

Download from Official Site

1
https://developer.nvidia.com/cuda-downloads

Navigate to downloaded folder.

1
bash cuda_8.0.61_375.26_linux.run

Press ctrl+D to go next page and accept all the question.

1
2
3
4
5
vi ~/.bash_profile
export CUDA_HOME=/usr/local/cuda-8.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
export PATH=${CUDA_HOME}/bin:${PATH}

Source profile

1
source ~/.bash_profile

Download cuDNN v5.1

cuDNN

Sing In and select cuDNN v5.1

Navigate to downloaded cudnn folder.

1
2
3
4
tar zxvf cudnn-8.0-linux-x64-v5.1.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/* /usr/local/cuda/include/

Install libcupti-dev

The libcupti-dev library, which is the NVIDIA CUDA Profile Tools Interface. This library provides advanced profiling support. To install this library, issue the following command:

1
2

,