Install the build tools we need
Open a console window and type the following:
sudo apt-get install build-essential libglut3-dev
Install the NVIDIA drivers
Go to the CUDA ZONE download page and download the CUDA driver. (The Ubuntu 8.04 will work for Ubuntu 9.04 Jaunty).
Press CTRL+ALT+F1 to go to a terminal, log in with your username and password.
Navigate to the folder that you placed the driver file in and type the following:
chmod +x NVIDIA-Linux-x86_64-180.22-pkg2.run
This will first make the driver installer runnable. We then need to stop Xwindows (remember to save any open files). (if you are using KDE use kdm instead of gdm (which is for gnome)):
sudo /etc/init.d/gdm stop
Next we run the driver installation (Usually selecting yes to all questions is ok):
Finally we restart the Xwindows session.
sudo /etc/init.d/gdm start
A new error for Ubuntu Jaunty is that upon reboot you might get a message similar to:
(EE)Failed to load module "type1" (module does not exist,0)
(EE)Failed to load module "freetype" (module does not exist,0)
(EE) NVIDIA(0) Failed to load the NVIDIA Kernel Module
(EE) NVIDIA ***Aborting***
(EE) Screen(s) found, but none have a usable configuration.
To fix this problem edit the file
/etc/modprobe.d/lrm-videoand comment out the line
install nvidia /sbin/lrm-video nvidia $CMDLINE_OPTSby putting a # in front of it.
Solution found from: http://ubuntuforums.org/showthread.php?t=950777
Install the CUDA Toolkit
Go to the CUDA ZONE download page again and download the CUDA Toolkit. Open a console window and navigate to the directory containing the file, type the following:
chmod +x cudatoolkit_2.1_linux64_rhel5.2.run
Use the default options suggested by the installer (press enter).
Note: The following steps need to be taken by all users
Add environment variables
This is very important step.
Open a console window to your home directory and edit the file
.bashrc, this is the settings file for your console window. Add the following lines to the bottom of the file:
These settings will not take effect before you open a new window so remember to do that.
Install the CUDA SDK
download the CUDA SDK from the CUDA ZONE download page. As with the Toolkit, open a console window, navigate to the directory with the files and type the following:
chmod +x cuda-sdk-linux-2.10.1215.2015-3233425.run
Accept the default options. The installer will create a folder called NVIDIA_CUDA_SDK in your home directory.
Compile and run an example
Open a console window, navigate to the NVIDIA_CUDA_SDK folder in your home directory, type:
This should open a window with a fluid dynamics simulation.
Writing code for CUDA devices
When writing code for CUDA GPUs its is useful to begin from the examples included in the SDK, the source code can be found in
~/NVIDIA_CUDA_SDK/projects/(the directory in your home directory). Copy one of the directories and start editing the files in it. To compile the program type
If you want to put the files in a different directory or rename or add files to your project, you need to edit the
Makefilefile in your project directory and possibly also the
common.mkfile located in