Installing Cuda 4.0 on Ubuntu 11.04 64-bit

by Carson Reynolds

Here are some rough notes describing my steps to get Cuda 4.0 installed and the SDK samples built on Ubuntu 11.04 (Natty Narwhal) 64-bit. I’ve cribbed some steps from Shenbo Yu’s instructions but installed components into “/opt”. First you must download the Cuda 4.0 install files.

From there you want to get:

  • devdriver_4.0_linux_64_270.41.19.run
  • cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
  • gpucomputingsdk_4.0.17_linux.run
# turn off X
sudo stop gdm

# uninstall any previously installed Nvidia drivers
sudo apt-get --purge remove nvidia-*

# make all the installers executable
chmod +x ~/Downloads/*.run

# run the driver installer
sudo ~/Downloads/devdriver_4.0_linux_64_270.41.19.run

# reboot
sudo reboot

# install dependencies
sudo apt-get install libxi-dev libxmu-dev freeglut3-dev gcc-4.4 g++-4.4 build-essential

# install toolkit
sudo ~/Downloads/\
 cudatoolkit_4.0.17_linux_64_ubuntu10.10.run

# install SDK
sudo ~/Downloads/gpucomputingsdk_4.0.17_linux.run

# I use /opt/NVIDIA_GPU_Computing_SDK because
# I like my home directory uncluttered

# Set path variables
export PATH=$PATH:/usr/local/cuda/bin
# 32-bit would use lib instead of lib64
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/lib
# You probably want to append these to your .bashrc if you use cuda frequently

# install gcc 4.4 into a directory for nvcc to use
sudo mkdir /opt/gcc44
sudo ln -s /usr/bin/cpp-4.4 /opt/gcc44/cpp
sudo ln -s /usr/bin/gcc-4.4 /opt/gcc44/gcc
sudo ln -s /usr/bin/g++-4.4 /opt/gcc44/g++

# modify cuda to use this gcc 4.4 installation
sudo bash -c "echo 'compiler-bindir = /opt/gcc44' >> /usr/local/cuda/bin/nvcc.profile"

# Make the SDK examples
cd /opt/NVIDIA_GPU_Computing_SDK
sudo chown -R [username] .
make

# Try out an example
./C/bin/linux/release/smokeParticles
About these ads