Skip to content

Installing Nvidia Drivers and CUDA 7.5 in Debian Jessie

Versión en español de esta publicación.
This tutorial explains how to install CUDA 7.5 Production Release in a Debian Jessie system, the first thing we have to do is to download the graphics driver from Nvidia website and select the current model of the graphics card we have, in my case I have a server with 2 Nvidia cards the first one is a GeForce GTX660 and the second one is a GeForce GTX650, if you’re not sure of which driver version you should install, you can check the driver versions and models in the following link

http://www.nvidia.com.mx/Download/index.aspx?lang=en-us

The latest driver version available for my cards is 352.79 and is available at http://us.download.nvidia.com/XFree86/Linux-x86_64/352.79/NVIDIA-Linux-x86_64-352.79.run, please make sure to download the latest version of your card driver.

Also we need to download the CUDA toolkit 7.5 from located at http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run. The installer file of the toolkit needed is the Linux RUN file for Ubuntu, the file name is: cuda_7.5.18_linux.run.

Now we need to verify the requirements to install CUDA. First we need a capable GPU device.

cuda7_5_install.sh

# verify we have a cuda capable gpu
lspci | grep -i nvidia

We need to check our Linux version

cuda7_5_install.sh

# Linux version
uname -m && cat /etc/*release

Now we need to verify that we have a valid GCC compiler

cuda7_5_install.sh

# verify gcc version 
gcc --version

If you don’t have a valid GCC compiler installed please install it by running the following command

cuda7_5_install.sh

# gcc install
sudo apt-get install build-essential

Before we proceed with the actual installation process we need to uninstall any version of CUDA we had installed previously, if this is the first time you install CUDA please skip this step, we uninstall previous installations by running the following command

cuda7_5_install.sh

# cuda uninstall
sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl

Where X and Y is the cuda version. If we are upgrading the Nvidia driver we don’t have to do anything just because the installer itself removes old driver versions. If we want to uninstall the CUDA driver just run the following command.

cuda7_5_install.sh

# cuda driver uninstall
sudo /usr/bin/nvidia-uninstall

Once we have completed the steps above and have downloaded the files needed for the installation we proceed to disable the nouveau driver which is the default driver for Debian, we do that by creating a new file:

cuda7_5_install.sh

# edit debian driver configuration file
vim /etc/modprobe.d/disable-nouveau.conf 

And add the following content to it

cuda7_5_install.sh

# blacklist defualt driver
blacklist nouveau
options nouveau modeset=0

Note: to verify that we have the nouveau driver running, just run the following command, if it outputs something it means that we actually have a nouveau driver running

cuda7_5_install.sh

# verify driver
lsmod | grep nouveau

After having the file for blocking the default driver in place, we proceed to restart the machine in default mode. Once restarted we are going to note that the screen resolution got at a lower level and that means that the default driver was not loaded, then we need to get some header files from our repository to build the Nvidia driver, we do this by executing the following command.

cuda7_5_install.sh

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

After installing this files we proceed to remove the nouveau driver completely from our system by executing the following command

cuda7_5_install.sh

# remove
apt-get remove --purge xserver-xorg-video-nouveau

After the removal of the driver has happened we need to restart our system in recovery mode, once restarted in recovery mode and having the nice console interface we proceed with the driver installation process, first we need to know which version of the compiler was used to compile the current system kernel, this because the system needs to compile the Nvidia driver, if we don’t know which version was used and which kernel we have, we can find that out by running the following command

cuda7_5_install.sh

# find curr gcc version
cat /proc/version

Once we know the correct compiler version, we need to set it up with an export like this

cuda7_5_install.sh

# set gcc version
export CC=gcc-4.8

Now we can proceed with the driver installation, we navigate to our download path and execute the driver

cuda7_5_install.sh

# execute driver install
sudo sh NVIDIA-Linux-x86_64-346.47.run

Once the installation is finished we proceed to reboot the machine and we’re going to note that we have a nice screen resolution and our new Nvidia drivers installed, next we proceed with the toolkit installation like this.

cuda7_5_install.sh

# execute toolkit install
sudo sh cuda_7.5.18_linux.run

When prompted we need to select not to install the Nvidia driver since we already installed it, and choose the default path for the samples (recommended).
The last thing to do is to compile the samples and run them, to do this we navigate to the samples directory that we choose and just execute a make command

And that’s it!

Here are some useful links related to CUDA 7.5

The CUDA getting started manual which covers in deep installation instructions
http://developer.download.nvidia.com/compute/cuda/7_0/Prod/doc/CUDA_Getting_Started_Linux.pdf

The CUDA downloads page
https://developer.nvidia.com/cuda-downloads

The Nvidia Driver downloads page
http://www.nvidia.com.mx/Download/index.aspx?lang=en-us

A blog post of the CUDA 7.5 features
https://devblogs.nvidia.com/parallelforall/new-features-cuda-7-5/

The Nvidia CUDA toolkit 7.5
http://developer.download.nvidia.com/compute/cuda/7.5/Prod/docs/sidebar/CUDA_Toolkit_Release_Notes.pdf

Have Fun! 🙂
-Yohan

Leave a Reply

Your email address will not be published. Required fields are marked *