From FedoraProject

Revision as of 19:34, 8 September 2012 by Dtonhofer (Talk | contribs)

Jump to: navigation, search
Warning (medium size).png
Note these instructions *only* apply to Fedora 16 and later releases.

This document provides instructions to install/remove CUDA 4.2 on Fedora. The final goal will be to be able to run GPU-enabled BOINC applications (in particular, GPUGRID).




First, be sure your GPU is compatible with CUDA. Refer to NVidia's list of CUDA GPUs.

Then, install required packages:

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

Additional prerequisites

Warning (medium size).png
Additional confirmation needed
This is additionally needed for running BOINC projects. However, it implies that the graphics driver is changed to the 'nvidia' driver. Is this really necessary?

If you want to run BOINC projects, you will also need the NVidia drivers and libraries provided by the "rpmfusion" repository.

  • See ForbiddenItems#NVIDIA for Fedora's official policy on the NVidia drivers (which is why the "nouveau" graphics driver instead of the "nvidia" one is used by default.)
  • See rpmfusion configuration on how to activate the "rpmfusion" repository for your installation.
  • See xorg-x11-drv-nvidia on what the "xorg-x11-drv-nvidia" package is about and how to install it.

Note in particular that you need to install the 32 bit and 64 bit "xorg-x11-drv-nvidia" packages if you are on a 64 bit machine otherwise some BOINC projects won't run.

On 32 bit:

su -c 'yum install xorg-x11-drv-nvidia-libs' 

On 64 bit:

su -c 'yum install xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686' 

After installation, check the list of provided libraries using "rpm --query --list xorg-x11-drv-nvidia-libs | grep -P '\.so(\.[123])?$'"



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):




Executable search path

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

Library search path

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'

If you later want to check whether any of your programs need something that isn't there, run this command in the relevant directory:

find . -exec file --mime '{}' ';' | grep 'application/x-executable' | cut --fields=1 --delimiter=':' | xargs ldd | grep 'not found'


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.

If the following error message appears instead:


[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.

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

In particular


will tell you about the capabilities of the graphics device:

Device 0: "GeForce GT 610"
  CUDA Driver Version / Runtime Version          5.0 / 4.2
  CUDA Capability Major/Minor version number:    2.1
  Total amount of global memory:                 1024 MBytes (1073283072 bytes)
  ( 1) Multiprocessors x ( 48) CUDA Cores/MP:    48 CUDA Cores
  GPU Clock rate:                                1620 MHz (1.62 GHz)
  Memory Clock rate:                             667 Mhz
  Memory Bus Width:                              64-bit
  L2 Cache Size:                                 65536 bytes
  Max Texture Dimension Size (x,y,z)             1D=(65536), 2D=(65536,65535), 3D=(2048,2048,2048)
  Max Layered Texture Size (dim) x layers        1D=(16384) x 2048, 2D=(16384,16384) x 2048
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 32768
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1536
  Maximum number of threads per block:           1024
  Maximum sizes of each dimension of a block:    1024 x 1024 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 65535
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and execution:                 Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Bus ID / PCI location ID:           2 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >


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