An R Introduction to Statistics

Installing CUDA Toolkit 5.0 on Ubuntu 11.10 Linux

The following explains how to install CUDA Toolkit 5.0 on 64-bit Ubuntu 11.10 Linux. I have tested it on a self-assembled desktop with AMD Phenom II X4 CPU, 4GB RAM, 500GB hard drive, 650W power supply, and NVIDIA GeForce GTX 460 graphics card. The instruction assumes you have the necessary CUDA compatible hardware support. Depending on your system configuration, your mileage may vary.

Basic Video Driver

First of all, you have to reconfigure Ubuntu with the basic video driver. Enter the following in a terminal.

$ sudo apt-get --purge remove nvidia*

Then create a new file in /etc/modprobe.d with the following content in order to blacklist the built-in nouveau driver, which conflicts with the CUDA developer video driver that you will install later.

# /etc/modprobe.d/blacklist-nouveau.conf 
blacklist nvidiafb 
blacklist nouveau 
blacklist rivafb 
blacklist rivatv 
blacklist vga16fb 
options nouveau modeset=0

You may manually update the kernel image in a terminal afterward:

$ sudo update-initramfs -u

Now you can reboot the system at this point for the change to take effect.

Linux Development Tools

After you have successfully configured Ubuntu Linux with the basic video driver, you can install the Linux development tools.

$ sudo apt-get update 
$ sudo apt-get install build-essential

OpenGL Developer Driver

To prepare for compiling the OpenGL code samples in the CUDA SDK, you will have to install the OpenGL developer environment as well.

$ sudo apt-get install freeglut3-dev libxi-dev libxmu-dev

OpenMPI Developer Driver

Since there is a new MPI sample in the CUDA SDK, you will have to install the OpenMPI environment as well.

$ sudo apt-get install mpi-default-dev

CUDA Toolkit

Download the CUDA Toolkit from the CUDA download site. The graphical display manager must not be running during the CUDA video driver install. Hence you should logout your Linux desktop and switch to console mode with the Alt+Ctrl+F2 keystroke. You then login the text console, and stop the graphical display manager.

$ sudo service lightdm stop

You may have to enter the same Alt+Ctrl+F2 keystroke again to resume the text console. Now install the CUDA Toolkit:

$ sudo sh cuda_5.0.35_linux_64_ubuntu11.10.run

And reboot afterward:

$ sudo reboot

Environment Variables

Assuming you have accepted the default install locations, you should add the following in the .bashrc file of your home folder.

export CUDA_HOME=/usr/local/cuda-5.0 
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 
 
PATH=${CUDA_HOME}/bin:${PATH} 
export PATH

CUDA SDK Samples

There should be a copy of the SDK samples in your home directory already, and you can proceed with the build process.

$ cd ~/NVIDIA_CUDA-5.0_Samples 
$ make

If everything goes well, you should be able to verify your CUDA installation by running the deviceQuery sample in bin/linux/release.