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.
- Make sure the computer has a NVIDIA graphics card that is recognized by Linux. This can be done as shown here.
Uninstall all NVIDIA drivers and kernel modules. Steps to do this are described here.
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.
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:
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/NvidiaDevCreator.sh) with the following code:
Add the line
/etc/rc.local and restart the system. This ensures that the necessary dev files are created on every startup for access by CUDA programs.
- 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