The wikis are now using the new authentication system.
If you did not migrate your account yet, visit https://idp-portal-info.suse.com/

SDB:CUDA50

Jump to: navigation, search

This article describes how to install NVIDIA's GPU SDK "CUDA 5.0" on openSUSE 12.3.

Two workarounds are needed that are both related to the fact that gcc/g++ 4.7 is (yet) not supported by NVIDIA:

  • for installing the kit
  • for fixing the include files and compiling the samples

Preliminaries:

  • have a GPU that is supported by CUDA
  • have installed all packages needed for build
  • have installed the nvidia-computeG0?, x11-video-nvidiaG0? and nvidia-gfxG0?-kmp-$flavour from ftp://download.nvidia.com/opensuse/12.3/

forcing installation of the toolkit

Download the CUDA 5.0 run file for openSUSE 12.1 (latest version available at the time of writing this) and run it like this:

 bash ~/Downloads/cuda_5.0.35_linux_64_suse12.1-1.run -override compiler

That will make the installer ignore the compiler mismatch.

When asked for installation of the drivers answer *NO* as the available drivers in the SUSE repo above are already good enough (and are frequently updated by NVIDIA and tested by SUSE QA).

I have been using the default paths for installation. Depending on where *YOU* installed it you have to adopt the rest of the documentation below.

Set the library search path using

cat <<'EOF' > /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64
/usr/local/cuda/lib
EOF

and update the library index using

 ldconfig

patch the include and sample source

 cd /usr/local/cuda

Then paste the following on console to fix the remaining incompatibilities:

cat <<'EOF' | patch -b -p0 
diff -Nur include.orig/gcc47_cuda_compat.h include/gcc47_cuda_compat.h
--- include.orig/gcc47_cuda_compat.h	1970-01-01 01:00:00.000000000 +0100
+++ include/gcc47_cuda_compat.h	2013-07-09 00:22:30.581994816 +0200
@@ -0,0 +1,16 @@
+
+/*
+   work around gcc 4.7 incompatibilities 
+
+   /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
+
+   see https://www.udacity.com/wiki/cs344/troubleshoot_gcc47
+*/
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
+
+#undef _GLIBCXX_ATOMIC_BUILTINS
+#undef _GLIBCXX_USE_INT128
+
+#endif
diff -Nur include.orig/host_config.h include/host_config.h
--- include.orig/host_config.h	2013-07-08 23:55:12.339180082 +0200
+++ include/host_config.h	2013-07-08 23:55:28.964595126 +0200
@@ -79,7 +79,7 @@
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
 
-#error -- unsupported GNU version! gcc 4.7 and up are not supported!
+#warning -- unsupported GNU version! gcc 4.7 and up are not supported!
 
 #endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) */
 
diff -Nur samples.orig/Makefile samples/Makefile
--- samples.orig/Makefile	2013-07-08 23:14:07.643193585 +0200
+++ samples/Makefile	2013-07-08 23:19:24.822620682 +0200
@@ -40,7 +40,7 @@
 PROJECTS := $(shell find 0_Simple 1_Utilities 2_Graphics 3_Imaging 4_Finance 5_Simulations 6_Advanced 7_CUDALibraries -name Makefile)
 
 %.ph_build :
-	+@$(MAKE) -C $(dir $*) $(MAKECMDGOALS)
+	+@$(MAKE) -C $(dir $*) EXTRA_NVCCFLAGS="--pre-include gcc47_cuda_compat.h" $(MAKECMDGOALS)
 
 %.ph_clean : 
 	+@$(MAKE) -C $(dir $*) clean $(USE_DEVICE)
EOF

force build

 cd /usr/local/cuda/samples
 make -k

This will *NOT* build simpleMPI unless you have manually installed mpicxx from 3rd party repos on your system.

To take advantage of a multi-cpu/multi-core system:

 make -j $numberofcores -k

On a AMD FX(tm)-4100 Quad-Core Processor this decreased compile time down to 6 minutes (instead of 24 minutes).