CUDA in Fedora 10

Acknowledgements: Thanks to seibert from nVidia Forums for his help in setting this up.


I assume you have a CUDA ready GPU.

Test System: Intel Core i7 920 CPU, Palit GTX 295 GPU, 3 GB DDR 3 1333 MHz RAM, Fedora Core 10

Step 1: Download the nVidia Cuda driver from http://www.nvidia.com/object/cuda_get.html. This is an nVidia accelerated driver. To install it, we need to exit the X Windows system and use the good old console. The best way to get to this is to edit (as superuser (root)) the relevant line in /etc/inittab and reboot into text mode. Here is what my /etc/inittab looks like.

# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/event.d/rcS
#
# Individual runlevels are started by /etc/event.d/rc[0-6]
#
# Ctrl-Alt-Delete is handled by /etc/event.d/control-alt-delete
#
# Terminal gettys (tty[1-6]) are handled by /etc/event.d/tty[1-6] and
# /etc/event.d/serial
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(8), initctl(8), and events(5).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:5:initdefault:

All you have to do is change the last line from "id:5:initdefault" to

id:3:initdefault

DO NOT comment the original line. If you're scared, you could just as well make a copy of the old inittab.

Step 2: Reboot the system.

shutdown -r now

Step 3: Log in as root, when the text-mode login prompt shows up. Navigate to the directory containing the downloaded pkg/run nvidia driver, and do

sh ./filename.run

Follow the onscreen instructions (I guess you'll just have to say yes to everything).

Step 4: Edit /etc/inittab and change the last line back to

id:5:initdefault

Step 5: Reboot the system. You should have the nVidia Driver up and running (unless you use kmod-nvidia which I haven't tried for the GTX 295 but which works nicely for the GeForce Go 7400 on my laptop, at least you won't get a fancy nvidia splash screen).

Step 6: Get the CUDA SDK from the above link and install it the same way as you installed the nvidia driver. Only this time, you don't have to install it through a true text console.

Step 7: Follow the instructions in the Getting Started pdf; run make in the NVIDIA_CUDA_SDK folder (typically in /root). If you get the following output (error):

[root@farpoint NVIDIA_CUDA_SDK]# make
make[1]: Entering directory `/root/NVIDIA_CUDA_SDK/common'
In file included from src/bank_checker.cpp:34:
./../common/inc/bank_checker.h:52: warning: type qualifiers ignored on function return type
./../common/inc/bank_checker.h:238: warning: type qualifiers ignored on function return type
src/bank_checker.cpp:75: warning: type qualifiers ignored on function return type
src/bank_checker.cpp:277: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch.h:37,
from src/cutil.cpp:53:
./../common/inc/stopwatch_base.h:74: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_base.h:78: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch_base.h:91,
from ./../common/inc/stopwatch.h:37,
from src/cutil.cpp:53:
./../common/inc/stopwatch_base.inl:85: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_base.inl:96: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch.h:44,
from src/cutil.cpp:53:
./../common/inc/stopwatch_linux.h:64: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:68: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:144: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:161: warning: type qualifiers ignored on function return type
In file included from src/cutil.cpp:53:
./../common/inc/stopwatch.h:53: warning: type qualifiers ignored on function return type
In file included from src/cutil.cpp:54:
./../common/inc/bank_checker.h:52: warning: type qualifiers ignored on function return type
./../common/inc/bank_checker.h:238: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch.h:37,
from src/stopwatch.cpp:36:
./../common/inc/stopwatch_base.h:74: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_base.h:78: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch_base.h:91,
from ./../common/inc/stopwatch.h:37,
from src/stopwatch.cpp:36:
./../common/inc/stopwatch_base.inl:85: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_base.inl:96: warning: type qualifiers ignored on function return type
In file included from ./../common/inc/stopwatch.h:44,
from src/stopwatch.cpp:36:
./../common/inc/stopwatch_linux.h:64: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:68: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:144: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:161: warning: type qualifiers ignored on function return type
In file included from src/stopwatch.cpp:36:
./../common/inc/stopwatch.h:53: warning: type qualifiers ignored on function return type
src/stopwatch.cpp:89: warning: type qualifiers ignored on function return type
In file included from src/stopwatch_linux.cpp:34:
./../common/inc/stopwatch_linux.h:64: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:68: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:144: warning: type qualifiers ignored on function return type
./../common/inc/stopwatch_linux.h:161: warning: type qualifiers ignored on function return type
a - obj/release/bank_checker.cpp.o
a - obj/release/cmd_arg_reader.cpp.o
a - obj/release/cutil.cpp.o
a - obj/release/stopwatch.cpp.o
a - obj/release/stopwatch_linux.cpp.o
a - obj/release/multithreading.cpp.o
make[1]: Leaving directory `/root/NVIDIA_CUDA_SDK/common'
make[1]: Entering directory `/root/NVIDIA_CUDA_SDK/common'
make[1]: Leaving directory `/root/NVIDIA_CUDA_SDK/common'
make[1]: Entering directory `/root/NVIDIA_CUDA_SDK/common'
make[1]: Leaving directory `/root/NVIDIA_CUDA_SDK/common'
make -C projects/bicubicTexture/
make[1]: Entering directory `/root/NVIDIA_CUDA_SDK/projects/bicubicTexture'
bicubicTexture.cpp:106: warning: deprecated conversion from string constant to ‘char*’
bicubicTexture.cpp:136: warning: deprecated conversion from string constant to ‘char*’
bicubicTexture.cpp:703: warning: unused parameter ‘argc’
bicubicTexture.cpp:592: warning: ‘shaderCode’ defined but not used
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/bicubicTexture] Error 1
make[1]: Leaving directory `/root/NVIDIA_CUDA_SDK/projects/bicubicTexture'
make: *** [projects/bicubicTexture/Makefile.ph_build] Error 2
[root@farpoint NVIDIA_CUDA_SDK]#

then as root run

yum install freeglut-devel

If you get the following error message while trying to run deviceQuery:

[root@farpoint release]# ./deviceQuery
./deviceQuery: error while loading shared libraries: libcudart.so.2: cannot open shared object file: No such file or directory
[root@farpoint release]#

it implies that the LD_LIBRARY_PATH variable has not been set properly. Your .bash_profile should look like this:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH

Make necessary changes to it and log back in again. CUDA should work now.

Have fun!

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License