Skip to content

Install Nvidia Drivers and CUDA 5 on Linux

This post is a simple, quick and easy “how to”  install Nvidia Tesla drivers and CUDA 5 on Linux Ubuntu Server 11.10. CUDA is a parallel computing architecture which enables dramatic increases of computing performances by harnessing the power of the graphic processing unit (GPU). This guide covers the installation of the Nvidia Tesla K20m drivers as well as the installation of the CUDA and SDK toolkit on Ubuntu.

System Requirements :

Before beginning this tutorial you need to make sure that you have CUDA enabled hardware ( CUDA-capable GPU).

The list of all the CUDA capable devices can be found here.

To find out the type of Nvidia Graphic card your computer posses use the following command in a terminal :

Driver Installation :

Before installing the drivers, it is important to check that you have a supported version of Linux, to check so  use the following command in your terminal :

A similar output should appear on your screen :

As you can see “x86_64”  indicates that you are running a 64 bit system,  while the “ DISTRIB_RELEASE”  field indicates your version of the operating system. In this case Linux Ubuntu 11.10 which is a supported version of Linux for CUDA5.

Following these information, download the drivers of your card via the nvidia’s driver website here.

If you have installed  Ubuntu 11.10 Server you should not have any graphical user interface (GUI), you can thus download the drivers by using the command “wget” .

Once the driver downloaded, install the following libraries and packages required by CUDA5 :

Then black list the un-required modules of the operating system.

The previous command opened the blacklist.conf file, press the “i” key, to edit the file and add the following lines to the file :

To save, press the “esc” key and enter  “:wq” to quit.

 If you are using a graphical user interface before installing the drivers, please follow these steps :

  • In the terminal write the following command to change the system run level :

  • Disable the graphical user interface :

We can now proceed to the installations of the drivers. The first step is to change the rights of the drives to be able to execute the drives, to do so write the following command  in the terminal :

We can now execute the drivers :

Once the drivers installed   you can now download CUDA5 (here) by using the command wget in my case it will look like

you can now reboot your system.

Cuda Toolkit Installation :

To install the drivers, we will have to follow the same procedure has before, and give the rights to the cuda5 file to be executed :

and we can now install CUDA5

Once Installed we should now define the environment variables, to proceed so, open the following file : ~/.bash_profile  via the following command :

(use the “i” key to edit,  “esc” + “:wq” to save)

If you use a 32 bit system add the following lines  :

If you use a 64 bit system  add the following lines : 

Once done, you can now restart the computer, and use CUDA via the GUI.  If you are not using a GUI, read CUDA Error 38.  However if you use a GUI system, you can now restart your system and you should now be able to use CUDA5 on your Linux Machine.

CUDA Error 38:

If you happen to see this error while executing a CUDA example,  you should edit the following file /etc/rc.local via this command :

and add the following line :

Then create a file called  in /home/(your user name)  via the following command :

and add the following lines :

You can now restart your computer and run your CUDA examples.

 CUDA Error 10 :

If you face a CUDA Error 10, you might have plugged your card in the wrong way ! We faced this error after having received our Supermicro computer, and discovered after multiple research that the cables plugged to our card were not plugged correctly, after reading documentation of the Tesla K20m card (available here) we noticed that the supplier had plugged two 6 pins connectors into the card instead of one 8pin and one 6 pin connector, once the 8 and 6 pin connectors plugged correctly our CUDA Error 10 disappeared.

This problem was discovered by using the following command :

This might help you debug your problem. In this case “-q” should list the available GPUs on your system.

I hope this helped and you are now ready to use CUDA on Linux.


Post a Comment

Your email is never published nor shared. Required fields are marked *