This project is read-only.

CUDA Installation on Linux (Ubuntu 8.10)

This is a little guide to help people in the installation of CUDA drivers and SDK. I've just listed some problems that happened during all the installation of CUDA in a fresh, new, recently installed Ubuntu 8.10.
A similar guide for Windows and Visual Studio will probably be disponible soon.

First steps

The first thing that you need is a CUDA Capable GPU if you want to run anything in GPGPU. After that, you have to install it in your motherboard. Beware of the size of your GPU because it may not fit in your chassis.

Figure 1. The GTX 280 almost does not fit in.

Key components

As you may find in NVIDIA's website, you need to install three key components to develop with CUDA: the driver, the toolkit and the SDK code samples. The code samples are usefull to see if everything is fine.

Figure 2. The .run files.

Do not forget to chmod +x the files!

To install the driver, you will need root privileges. But it does not stop there! The X server cannot be running!

Figure 3. Told you, it must not be running.

How I handled it:
  1. ctrl + alt + F1 = goes to Text Mode
  2. sudo /etc/init.d/gdm stop
  3. install the CUDA driver (with sudo)
  4. sudo /etc/init.d/gdm start
The driver must be compiled with the same compiler that was used for your kernel.
Do not forget to include the following lines in your .bashrc (but change it for the path that you installed the driver):
  • export PATH=$PATH:/usr/local/cuda/bin
  • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
Also, to make my life easier in the next steps, I create two alias:
  • alias aptc="apt-cache search"
  • alias aptg="sudo apt-get install"

There were no problems in the installation of the toolkit. No comments.

Now, to install the SDK code samples and compile them, I encountered several problems, listed below:
  1. nvcc only works with the g++/gcc 4.1. The OS comes with the gcc 4.3 installed. To change this, use sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.1
  2. You will need the libxmu-dev and the libraries that contains the glut (OpenGL). In doubt, I installed almost everything to solve it (libglu1, libglut3, libglu1-mesa-dev...). This problem is presented by the absence of the GL/glu.h file.

After installing the code samples, we just have to test if everything is working.


Thanks to the CUDA SDK code samples, you do not have to develop and debbug any code to guarantee that everything is fine. Just to go where you installed the samples (probably ~/NVIDIA_CUDA_SDK$ ), and make it. The problems listed above may happen if any library is missing.

After the compilation of the samples, just go to ~/NVIDIA_CUDA_SDK/bin/linux/release and run some samples. My favorites were the nbody simulation and the fluidsGL.

Figure 4. N-body simulation.

Figure 5. fluidsGL. Just use your mouse in the green screen.

And that's all. Please send me anything new or interesting if you have different problems in the installation.

Last edited Sep 8, 2009 at 6:47 PM by Pilla, version 6


No comments yet.