Pre-installation Actions
Verify You Have a CUDA-Capable GPU
1 |
lspci | grep -i nvidia |
If you have CUDA capable GPU you should see something like,
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 730M]
Verify You Have a Supported Version of Linux
1 |
uname -m && cat /etc/*release |
Supported distributions can be found here.
Verify the System Has gcc Installed
1 |
gcc --version |
should give something like,
gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1
Download the NVIDIA CUDA Toolkit
Choose suitable version for your system from here.
Download Verification
Downloaded file can be verified by comparing the MD5 checksum posted at http://developer.download.nvidia.com/compute/cuda/7_0/Prod/md5sum-7.0.txt with that of the downloaded file. If either of the checksums differ, the downloaded file is corrupt and needs to be downloaded again.
To calculate the MD5 checksum of the downloaded file, run the following:
1 |
md5sum <downloaded_file> |
Handle Conflicting Installation Methods
Before installing CUDA, any previously installations that could conflict should be uninstalled. This will not affect systems which have not had CUDA installed previously,
Use the following command to uninstall a Toolkit runfile installation:
1 |
sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl |
Use the following command to uninstall a Driver runfile installation:
1 |
sudo /usr/bin/nvidia-uninstall |
Use the following commands to uninstall a RPM/Deb installation:
1 |
sudo apt-get --purge remove <package_name> # Ubuntu |
Package Manager Installation
- Install repository meta-data
1sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
Depending on your downloaded version you should execute something like
sudo dpkg -i cuda-repo-ubuntu1410-7-0-local7.0-28amd64.deb
- Update the Apt repository cache
1sudo apt-get update - Install CUDA
1sudo apt-get install cuda
Post-installation Actions
Environment Setup
The PATH variable needs to include /usr/local/cuda-7.0/bin. These paths must be added into .bashrc file under home directory.
For 64-bit system
1 2 |
export PATH=/usr/local/cuda-7.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH |
For 32-bit system
1 2 |
export PATH=/usr/local/cuda-7.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib:$LD_LIBRARY_PATH |
Then execute .bashrc file with following command
1 |
source ~/.bashrc |
Install Writable Samples
In order to modify, compile, and run the samples, the samples must be installed with write permissions with following command.
1 |
cuda-install-samples-7.0.sh <dir> |
Samples will come to specified directory.
Verify the Driver Version
When the driver is loaded, the driver version can be found by executing the command.
1 |
cat /proc/driver/nvidia/version |
This command will not work on an iGPU/dGPU system. Instead you may try the following.
1 |
nvidia-settings --version |
Compiling the Examples
The version of the CUDA Toolkit can be checked by running.
1 |
nvcc -V |
The NVIDIA CUDA Toolkit includes sample programs in source form. You should compile them by wherever you installed “NVIDIACUDA-7.0Samples” directory and type
1 |
make |
The resulting binaries will be placed under “NVIDIACUDA-7.0Samples/bin”.
Running the Binaries
At this point, rebooting is recommended, otherwise this step might be failed.
After compilation, find and run “NVIDIACUDA-7.0Samples/1_Utilities/deviceQuery/deviceQuery”. If the CUDA software is installed and configured correctly you should see something like
NVIDIA cuDNN – GPU Accelerated Deep Learning
Get cuDNN library from attachment.
Then apply the following commands upon the downladed file.
1 2 |
tar -xzvf cudnn-6.5-linux-R1.tgz cd cudnn-6.5-linux-R1 |
Adding cuDNN libraries into cuda libraries
1 2 |
sudo cp lib* /usr/local/cuda/lib64/ sudo cp cudnn.h /usr/local/cuda/include/ |