CentOS 7.x NVIDIA CUDA Toolkit installation

Will finish this later; just remember the site you were using had all the names wrong... it should be dashes, not dots.

Pre-requisites

  1. CentOS 7.x installed
  2. Depending on what CUDA Toolkit version you want, view the versions and compatible NVIDIA drivers below
  3. NVIDIA driver installed

CUDA ToolkitLinux x86_64 Driver Version
CUDA 10.0 (10.0.130)>= 410.48
CUDA 9.2 (9.2.88)>= 396.26
CUDA 9.1 (9.1.85)>= 390.46
CUDA 9.0 (9.0.76)>= 384.81
CUDA 8.0 (8.0.61 GA2)>= 375.26
CUDA 8.0 (8.0.44)>= 367.48
CUDA 7.5 (7.5.16)>= 352.31
CUDA 7.0 (7.0.28)>= 346.46

Instructions

For my example, I am installing CUDA 10.0 with NVIDIA driver 410.79 installed.

Step 1: Download the latest Nvidia CUDA repository package.

Full list here: https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/

wget https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-10.0.130-1.x86_64.rpm

Step 2: Install the CUDA repository package you just downloaded

rpm -i cuda-repo-*.rpm

Step 3: Use 'yum install' to install your desired meta package

In my example:

yum install -y cuda-10-0

Highly recommend against installing the meta packages that handles upgrades to the next version automatically, best to perform the NVIDIA driver installation separately, and then carefully choosing the NVIDIA CUDA toolkit you require.

Meta PackagePurpose
cudaInstalls all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released.
cuda-10-0Installs all CUDA Toolkit and Driver packages. Remains at version 10.0 until an additional version of CUDA is installed.
cuda-toolkit-10-0Installs all CUDA Toolkit packages required to develop CUDA applications. Does not include the driver.
cuda-tools-10-0Installs all CUDA command line and visual tools.
cuda-runtime-10-0Installs all CUDA Toolkit packages required to run CUDA applications, as well as the Driver packages.
cuda-compiler-10-0Installs all CUDA compiler packages.
cuda-libraries-10-0Installs all runtime CUDA Library packages.
cuda-libraries-dev-10-0Installs all development CUDA Library packages.
cuda-driversInstalls all Driver packages. Handles upgrading to the next version of the Driver packages when they're released.

Full list of meta packages was taken from NVIDIA documents linked below:

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#package-manager-metas

Step 4: Export system path to NVIDIA CUDA binary executables

Add the following to '/root/.bashrc' by using your preferred text editor:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

My example below:

nano /root/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Step 5: Source recently updated '.bashrc' file

source /root/.bashrc

Step 6: Validate CUDA installation

nvcc --version

My example:

nvcc --version


nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

Step 7: Install CUDA samples and further tests by compiling CUDA programs in the 'cuda-samples'

mkdir cuda-samples
cuda-install-samples-10.0.sh cuda-samples/
cd cuda-samples/NVIDIA_CUDA-10.0_Samples/0_Simple/simpleCallback
make