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):
sudo ./NVIDIA-Linux-x86_64-180.22-pkg2.run
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-video
and comment out the line install nvidia /sbin/lrm-video nvidia $CMDLINE_OPTS
by 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
sudo ./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:PATH=$PATH:/usr/local/cuda/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
export PATH
export LD_LIBRARY_PATH
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
./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:
make
./bin/linux/release/fluidsGL
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 make
.If you want to put the files in a different directory or rename or add files to your project, you need to edit the
Makefile
file in your project directory and possibly also the common.mk
file located in ~/NVIDIA_CUDA_SDK/common/
folder.
The instructions on loading the path did not work for me but adding the following line to end of .bashrc it did.
ReplyDeleteexport PATH=$PATH:/usr/local/cuda/bin
Everything else did work fine though thanks.
You are totally correct. Thankyou for pointing that out, should be fixed now.
ReplyDeleteHope the guide was helpful.
For the error:
ReplyDelete(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.
The fix about comment the line at /etc/modprobe.d/lrm-video, does not worked for me (since this file is not present in my jaunty). However I found this other solution, which actually worked for me:
Edit /etc/X11/xorg.conf and add:
Section "ServerFlags"
Option "IgnoreABI" "True"
EndSection
··· thanks to the forum post at:
http://ubuntuforums.org/archive/index.php/t-1011847.html
This comment has been removed by the author.
ReplyDeleteI had some troubles with the 180.22 driver and the fix that monoaquillo posted did not help.
ReplyDeleteHowever it worked after installing the 185.18.14 drivers from nvidias ftp and tweaking accoring to bruj0's post at: http://progjournal.blogspot.com/2008/05/install-cuda-on-ubuntu-710.html
which is by adding
int __builtin_va_arg_pack();
to /usr/include/bits/stdio2.h, after line 28
and installing libxmu-dev package.
(on ubuntu 9.04)
Hi,
ReplyDeletethanks for this guide. :)
I think we need some other packages.
sudo apt-get install libxi-dev libxmu-dev // from http://forums.nvidia.com/index.php?showtopic=84989
I get this error:
ReplyDelete/home/chris/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/fluidsGL: error while loading shared libraries: libcudart.so.2: wrong ELF class: ELFCLASS32
BTW I am using Ubuntu 9.04 64-bit
ReplyDeleteI solved my "low-graphics mode" problems by uninstalling not only the CUDA nVidia driver but also the nVidia kernel modules and binary driver from Synaptic (I just did a search for "nvidia" and removed "nvidia-180-kernel-source" and "nvidia-glx-180".
ReplyDelete