How to install CUDA 5.0 on Ubuntu 12.04 LTS

These steps helped me to successfully install CUDA 5.0 on many Ubuntu 12.04 LTS computers, including headless servers that do not run X windows.

1. Make sure the computer has a NVIDIA graphics card that is recognized by Linux. This can be done as shown here.

2. Uninstall all NVIDIA drivers and kernel modules. Steps to do this are described here.

3. Download CUDA 5.0 installer for Linux. There is no installer for Ubuntu 12.04 LTS, so download the installer for Ubuntu 11.10 instead.

4. Make the installer executable and run it as sudo. When asked to install the NVIDIA driver, choose Yes. This is important, allow the installer to install its own drivers. Let it install CUDA to the default location: /usr/local/cuda-5.0/

5. If the computer is a headless Ubuntu server which is not connected to a display or does not run X, then device files for your card are not created by default. So, create a shell script file (say /home/joe/ with the following code:

Add the line /home/joe/ to /etc/rc.local and restart the system. This ensures that the necessary dev files are created on every startup for access by CUDA programs.

6. Add the following to your bashrc:

This ensures that the CUDA libraries are available for dynamic loading by CUDA programs.

That is all! Any user on your Ubuntu 12.04 system should now be able to compile and run CUDA 5.0 programs without any special access permissions or privileges :-)

Note: I had problems when I used the nvidia-current and nvidia-current-updates drivers from Ubuntu. Only by uninstalling them and using the drivers that ship with the CUDA installer was I able to get CUDA working.

Tried with: NVIDIA GeForce 9900 GT and NVIDIA GTX 690

About these ads

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s