There is a number of difficulties installing NVIDIA CUDA SDK 5.0 onto OpenSUSE 12.3. The major reason that it does not support gcc 4.7.2 compiler that is distribution's default. There is a number of ways to overcome it.
1. install drivers. You may use packages from OpenSUSE's NVidia repository or use the ones that come with cuda-sdk package. Both cases work fine, just make sure your driver's version maches the requirement.
I guess the same steps may apply to other Linux distributions with gcc 4.7, like Ubuntu 12.10 and etc, that it How to make nVidia cuda sdk 5.0 to work with gcc 4.7
1. install drivers. You may use packages from OpenSUSE's NVidia repository or use the ones that come with cuda-sdk package. Both cases work fine, just make sure your driver's version maches the requirement.
There may be a problem with missing libraries, like libglut.so, just fix them with appropriate symlinks in your /usr/lib64 .
2. install cuda-sdk. Get the package from https://developer.nvidia.com/cuda-downloads. I used version for openSuSE 12.1. Install as superuser it with the following options:
su -
./cuda_5.0.35_linux_64_suse12.1-1.bin -toolkit -samples -override
These options disable installation of NVidia drivers and skip the dependency checks.
Consider you've installed it into its default directory, i.e. /usr/local/cuda-5.0.
(for other options see ./cuda_5.0.35_linux_64_suse12.1-1.bin --help)
Go to this directory, and do the following
3. disable GCC version check:
open /usr/local/cuda-5.0/include/host_config.h
find
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
and replace it with
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
That alone won't help, and if you try to compile the samples you'll most likely get compile time errors like:
/usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined
/usr/include/c++/4.7/ext/atomicity.h(52): error: identifier "__atomic_fetch_add" is undefined
4. To disable there "__atomic_fetch_add is undefined" compiler errors:
You have to include commands like
#undef _GLIBCXX_ATOMIC_BUILTINS
#undef _GLIBCXX_USE_INT128
into beginning of you .cu file or put them into a separate include file. Lets put them into
/usr/local/cuda-5.0/include/__cuda_gcc47_fix.h
or other name you like. Now you may compile a hello world application with
nvcc --pre-include __cuda_gcc47_fix.h command
in order to have the whole "samples" directory compile with default makefiles, lets do a little trick.
save nvcc binary into a separate file, and create a small wrapper script with the following commands:
cd /usr/local/cuda-5.0
mv bin/nvcc bin/nvcc.bin
echo '#!/bin/sh
$0.bin --pre-include __cuda_gcc47_fix.h $@' > bin/nvcc
chmod +x bin/nvcc
After that the whole samples directory should compile without errors. (check for mpicxx to work in order to build some samples). Warnings on delegating contructors may be ignored.
I guess the same steps may apply to other Linux distributions with gcc 4.7, like Ubuntu 12.10 and etc, that it How to make nVidia cuda sdk 5.0 to work with gcc 4.7
22 comments:
Thanks for this...saved me a lot of time. One thing though..$@' should be $@...spurious "'".
Dave
Hi Dave,
I didnot get your rectification on $@'
Can you please mention it once again.
I tried with
echo '#!/bin/sh $0.bin --pre-include __cuda_gcc47_fix.h $@' > bin/nvcc
It is showing error that
/bin/sh $0.bin --pre-include __cuda_gcc47_fix.h $@: No such file or directory
Kindly rectify me.
Chandan
supposed to result in creating a file $CUDA_HOME/bin/nvcc with this content:
#!/bin/sh
$0.bin --pre-include __cuda_gcc47_fix.h $@
Thanks SHiFT!
It dit compile the programs in sample directory.
I should have realized it.
Hi !!
I have installed the CUDA-5.0.
Here are the steps which I followed.
1. DRIVER INSTALLATION
Downlaoded the latest driver from NVIDIA (NVIDIA-Linux-x86_64-310.40.run) and installed.
2. SAMPLES & TOOLKIT
sh cuda_5.0.35_linux_64_suse12.1-1.run -toolkit -samples -override
Then I compiled one of the samples located in /usr/local/cuda-5.0/samples/0_Simple/matrixMul
Compilation was successful.
Then I wanted to verify my CUDA installation.
I followed http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html
There is a instruction to run the binaries.
"After compilation, go to ~/NVIDIA_CUDA-5.0_Samples/C/bin/linux/release and run deviceQuery."
I could not locate deviceQuery on my installation. Am I missing something?
Kinldy guide me.
I'm not sure, i aready deleted the samples to free some space :-)
Just run some of the compiled samples to verify that it works, that should do. dont forget to add /usr/local/cuda-5.0/lib64 (or whatever) to LD_LIBRARY_PATH
sh cuda_5.0.35_linux_64_suse12.1-1.run -toolkit -samples -override
Is only showing a readme file?
Is this howto still working for opensuse 12.3 (juli2013)
Well, it's been a long time since i installed it. try reading it carefully - that might have been a licensing info that could had asked for "accept" or something like that -- i dont remember already.
Also, check the /usr/local/cuda-5.0 directory -- the installation runs pretty fast and silent.
Yes ESC :wq and then trype accept was working.
Next error :
linux-c681:/usr/local/cuda-5.0/include # nvcc --pre-include __cuda_gcc47_fix.h
nvcc fatal : No input files specified; use option --help for more information
How to solve this?
did you do everything from step 4 ?
also nvcc requires some files to work. like "nvcc sourcefile.cu"
or try running "make" in some of the samples.
Yes followed step 4
Where to find nvcc sourcefile.cu
What is nvcc ?
Cannot find it in the software list.
Figured out that nvcc is the cuda compiler driver.
Can you show all the text to make a :
__cuda_gcc47_fix.h file.
sorry I quit this manual its not clear enough from point (missing howto compile)
sorry I quit this manual its not clear enough from point4 (missing howto compile)
that file should look like
#undef _GLIBCXX_ATOMIC_BUILTINS
#undef _GLIBCXX_USE_INT128
Think IM got it working just one problem to fix?
linux-c681:/usr/local/cuda-5.0/samples/0_Simple/clock # make
/usr/local/cuda-5.0/bin/nvcc -m64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -I/usr/local/cuda-5.0/include -I. -I.. -I../../common/inc -o clock.o -c clock.cu
g++ -m64 -o clock clock.o -L/usr/local/cuda-5.0/lib64 -lcudart
g++: error: clock.o: Bestand of map bestaat niet
make: *** [clock] Fout 1
i dont understant the language of the compiler message. try
env LANG=C make
inux-c681:/usr/local/cuda/samples/0_Simple/clock # env LANG=C make
/usr/local/cuda-5.0/bin/nvcc -m64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -I/usr/local/cuda-5.0/include -I. -I.. -I../../common/inc -o clock.o -c clock.cu
g++ -m64 -o clock clock.o -L/usr/local/cuda-5.0/lib64 -lcudart
g++: error: clock.o: No such file or directory
make: *** [clock] Error 1
looks like the nvcc script did not work, and clock.o was not created.
check the original nvcc binary (is it there?), and the script permissions (chmod +x /path/to/nvcc) and syntax
yes but nvcc has only one rule
#!/bin/sh
and nvcc.bin looks like
!/bin/sh
$0.bin --pre-include __cuda_gcc47_fix.h $@
Yes nvcc was wrong problem solved.
Post a Comment