From Fedora Project Wiki

Revision as of 14:01, 7 September 2012 by Dtonhofer (talk | contribs) (Better dealing with library paths)

Note these instructions *only* apply to Fedora 16 and later releases.
To be reviewed, my english may be bad.

This document provides instructions to install/remove Cuda 4.2 on Fedora. The final goal will be to be able to run GPUGRID applications.



First, be sure your GPU is compatible with CUDA. Refer to this page. Then, install required packages:

su -c 'yum install wget make gcc-c++ freeglut-devel libXi-devel libXmu-devel mesa-libGLU-devel'


You will have to download two programs: "CUDA Toolkit" and "GPU Computing SDK". Refer to the NVidia CUDA downloads page for latest versions.

Let's download and save them on the Desktop.

32 bit :

cd ~/Desktop

64 bit :

cd ~/Desktop

Installation of CUDA Toolkit

Go to "Desktop", add execution permissions of the cudatoolkit downloaded file, and execute it with root permissions:

cd ~/Desktop
chmod +x cudatoolkit_4.2.9_linux_*
su -c './cudatoolkit_4.2.9_linux_*'

When it asks you:

Enter install path (default /usr/local/cuda, '/cuda' will be appended):



Installation of GPU Computing SDK

As before, go to "Desktop", add execution permissions of the gpucomputingsdk downloaded file, and execute it without root permissions:

cd ~/Desktop
chmod +x

When it asks you:

Enter install path (default ~/NVIDIA_GPU_Computing_SDK):

press [enter] (to use default path)

When it asks you:

Enter CUDA install path (default /usr/local/cuda):




Extend the executable search path to include CUDA executables:

export PATH=$PATH:/opt/cuda/bin

To make this permanent, modify your ~/.bashrc (modifying ~/.bash_profile will cause the path to be extended for the login shell only):

echo 'export PATH=$PATH:/opt/cuda/bin' >> ~/.bashrc

Extend the library search path to include CUDA libraries:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64

To make this permanent, modify your ~/.bashrc:

echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64' >> ~/.bashrc

Or more correctly, add entries to /etc/, then run ldconfig once:

su -c 'echo "/opt/cuda/lib" > /etc/; echo "/opt/cuda/lib64" > /etc/ ; ldconfig'


Fedora 16

We finally compile:


cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib/nvidia/ make


cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib64/nvidia/ make

Fedora 17

Some compatibility problems appeared with gcc-4.7. You will have to install a compatibility version:

su -c 'yum install compat-gcc-34 compat-gcc-34-c++'

Create a symbolic link to make CUDA use gcc-3.4:

su -c 'ln -s /usr/bin/gcc34 /opt/cuda/bin/gcc'

Now, you can compile.


cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib/nvidia/ make cuda-install=/opt/cuda


cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib64/nvidia/ make cuda-install=/opt/cuda


Now, let's test if CUDA is working correctly. Type:


You should see something like this on the command line:

[fluidsGL] starting...

[fluidsGL] - [OpenGL/CUDA simulation] starting...
   OpenGL device is Available
CUDA device [GeForce GT 610] has 1 Multi-Processors

A window with a fluid dynamics simulation should appear. Use the mouse pointer to generate some activity:

Cuda test.png

Now we can use GPUGRID applications with BOINC.

There are additional test programs underneath ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/.

If the following error message appears:


[fluidsGL] - [OpenGL/CUDA simulation]
   OpenGL device is NOT Available, [fluidsGL] exiting...
[fluidsGL] test results...                

You are probably running the application as a user that does not currently have access to the display.


Now that CUDA has been installed, the installers files are useless. You can remove them:

cd ~/Desktop
rm cudatoolkit_4.2.9_linux_*


If you want to totally remove Cuda, juste delete the /opt/cuda and ~/NVIDIA_GPU_Computing_SDK folders:

rm -r ~/NVIDIA_GPU_Computing_SDK
su -c 'rm -r /opt/cuda'

and remove the export PATH=$PATH:/opt/cuda/bin and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64 lines of the ~/.bash_profile file.

Useful links