Installing CUDA on Ubuntu 11.04/11.10

To install CUDA on new versions of Ubuntu can be challenging. With the current version of CUDA there are issues with new versions of gcc. To solve the problems on your machines try the following steps. On the lab-machines, do the last step to compile the SDK:

Download the current Cuda Toolkit for Ubuntu and the GPU Computing SDK, and save the .run files somewhere.

Install and select gcc/g++ 4.4

 
sudo apt-get install \
    gcc-4.4 g++-4.4 build-essential
 
sudo update-alternatives \
    --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 \
    --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 
 
sudo update-alternatives \
    --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 \
    --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
 
Check with
 
sudo update-alternatives —config gcc
gcc —version
 
that you have now version 4.4.x of the compilers.
Install the nvidia drivers
 
sudo apt-get install \
    nvidia-current\
    nvidia-current-dev\
    nvidia-current-updates\
    nvidia-current-updates-dev
 
As root, run the two .run files from nvidia.
 

For compiling the SDK examples, you also need to install

 
sudo apt-get install freeglut3-dev libxi-dev
 
and create the following links
 
sudo ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so
sudo ln -s /usr/lib/nvidia-173/libGL.so /usr/lib/libGL.so
 
Then go to the NVIDIA_GPU_COMPUTING_SDK_... folder. In the file C/common/common.mk change the line
 
LINKFLAGS +=
 
to
 
LINKFLAGS += /usr/lib/nvidia-current
 
Then run make. This should compile everything, indicating that the CUDA stuff works.
Published Nov. 8, 2011 2:07 PM