Yet another CUDA 3.1 confusion Can't compile examples under CUDA 3.1 cannot find -lrendercheckgl

Hi everybody,

I just installed CUDA 3.1 on Fedora 13 the following way:

yum install gcc kernel-devel eclipse-jdt eclipse-cdt freeglut freeglut-devel mesa-libGLU-devel libXmu-devel libXi-devel

Alt+Ctrl+F2 /sbin/init 3

./devdriver_3.1_linux_64_256.35.run

shutdown -r now

#I did yum remove kmod-nvidia previously, nouveau is blacklisted

cudatoolkit_3.1_linux_64_fedora12.run

echo "PATH=\$PATH:/usr/local/cuda/bin

LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/cuda/lib:/usr/local/cuda/lib64

export PATH

export LD_LIBRARY_PATH" >> ~/.bashrc

gpucomputingsdk_3.1_linux.run

However,

cd /home/user/NVIDIA_GPU_Computing_SDK/C/src/fluidsGL/

make

gives me:

/usr/bin/ld: cannot find -lrendercheckgl_x86_64

collect2: ld returned 1 exit status

make: *** [../../bin/linux/release/fluidsGL] Error 1

and the other examples fail in a similar way with the same error.

Just typing nvcc gives:

nvcc �%6X: No input files specified; use option --help for more information

which seems fine to me.

I could post my /var/log/nvidia-installer.log on demand, but it’s very long and ends with

-> Driver file installation is complete.

-> Running post-install sanity check:

-> done.

-> Post-install sanity check passed.

-> Shared memory test passed.

-> Running runtime sanity check:

-> done.

-> Runtime sanity check passed.

-> Would you like to run the nvidia-xconfig utility to automatically update you

   r X configuration file so that the NVIDIA X driver will be used when you res

   tart X?  Any pre-existing X configuration file will be backed up. (Answer: Y

   es)

-> Your X configuration file has been successfully updated.  Installation of

   the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 256.35) is

   now complete.

cat /proc/driver/nvidia/cards/0 prints

Model:		   Quadro NVS 140M

IRQ:			 16

Video BIOS:	  60.86.3e.00.00

Card Type:	   PCI-E

DMA Size:		40 bits

DMA Mask:		0xffffffffff

Bus Location:	0000:01.00.0

More important cat /proc/driver/nvidia/version:

NVRM version: NVIDIA UNIX x86_64 Kernel Module  256.35  Wed Jun 16 18:42:44 PDT 2010

GCC version:  gcc version 4.4.4 20100503 (Red Hat 4.4.4-2) (GCC)

Besides other stuff my /etc/X11/xorg.conf contains

Section "Files"

	ModulePath	  "/usr/lib64/xorg/modules/extensions/nvidia"

	ModulePath	  "/usr/lib64/xorg/modules"

EndSection

Section "ServerFlags"

	Option		 "AIGLX" "on"

EndSection

Section "Device"

	Identifier	 "Videocard0"

	Driver		 "nvidia"

EndSection

Section "Screen"

	Identifier	 "Default Screen"

	Device		 "Videocard0"

	Option		 "AddARGBGLXVisuals" "True"

	SubSection	 "Display"

		Modes	  "nvidia-auto-select"

	EndSubSection

EndSection

Any suggestions are highly appreciated. Thank you in advance.

Keep in mind that these are my first steps using CUDA, so I might be very naive and overlook a simple problem.

Best regards,

djjxkz2

Do the following in the command line:

cd /home/user/NVIDIA_GPU_Computing_SDK/C

make

cd src

for i in *; do cd $i; make; cd ..; done

You should now have most of the samples built and placed in the binary directory under /home/user/NVIDIA_GPU_Computing_SDK/C/bin/linux/release

Hi,

thanks for the suggestion. However, make produces the following error:

/usr/bin/ld: obj/x86_64/release/bandwidthTest.cu.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'

/usr/bin/ld: note: 'pthread_cancel@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line

/lib64/libpthread.so.0: could not read symbols: Invalid operation

collect2: ld returned 1 exit status

As far as I can tell this seems to be caused by Fedora 13 changes regarding DSO links: https://fedoraproject.org/wiki/UnderstandingDSOLinkChange They want me to link the implicit .so explicitly as well (see “What do I do?” section). Now what do I do? This is certainly easy to add, but I’m too inexperienced with CUDA and Makefiles to see the solution.

My first attempt was to add file and directory to the Makefile:

LIBS		:= -lpthread

LDFLAGS		:= -L/lib64

LIBDIRS		:= -L/lib64

CFLAGS		:= -pthread

(as well as LD_LIBRARY_PATH and LIBRARY_PATH in my .bashrc out of frustration) to no avail. So I removed it again.

OK, so I have to add libpthread.so.0 in /lib64 (I verified it’s there) to my linker command line. This should be pretty easy. Could you help me out?

Best regards,

djjxkz2

PS:

I also followed nasask8r’s “Compiling CUDA SDK examples on Ubuntu 10.04, without downgrading GCC” (http://forums.nvidia.com/index.php?showtopic=171590) - is this relevant for Fedora users?

In the following I’ll add what I did as briefly as possible. This is probably irrelevant (you might want to skip it), but I do so for completion:

groupadd cuda

gpasswd -a <user> cuda

chgrp -R cuda /usr/local/cuda

chmod -R 775 /usr/local/cuda

yum install libXext-devel libXi-devel libICE-devel libSM-devel libXt-devel libXmu-devel freeglut freeglut-devel

were all installed. However, afaik there are no packages 

x11proto-xext-devel, libxmu-headers and libglut3-devel available. The last three should be included in libXmu-devel and freeglut-devel, whereas the first one is simply unknown to me. Maybe it refers to libXext-devel or xorg-x11-proto-devel, but both are installed as well.

Then emacs /home/Dorfmeister/.bashrc

where I added

export CPLUS_INCLUDE_PATH="/usr/local/cuda/include"

export LIBRARY_PATH="/usr/lib/nvidia-current"

to the two lines mentioned above.

Since my SDK-common.mk is found in /home/user/NVIDIA_GPU_Computing_SDK/C/common (default installation), I did the following:

#backup

cp /home/Dorfmeister/NVIDIA_GPU_Computing_SDK/C/common/common.mk /home/Dorfmeister/NVIDIA_GPU_Computing_SDK/C/common/common.mk.orig

emacs /home/Dorfmeister/NVIDIA_GPU_Computing_SDK/C/common/common.mk

changed line 92 NVCCFLAGS := to NVCCFLAGS += --compiler-options -fno-inline

(same as in tutorial)

The CXXFLAGS look different, though. They are in line 152, not 158 and are: CXXFLAGS  += $(CXXWARN_FLAGS) $(CXX_ARCH_FLAGS)

CFLAGS	+= $(CWARN_FLAGS) $(CXX_ARCH_FLAGS)

So I made them:

CXXFLAGS  += $(CXXWARN_FLAGS) $(CXX_ARCH_FLAGS) -D_DEBUG -fno-strict-aliasing

CFLAGS	+= $(CWARN_FLAGS) $(CXX_ARCH_FLAGS) -D_DEBUG -fno-strict-aliasing

At this point I tried make again - without success.

So I copied common.mk to common.mk.ubuntudude and took the old one again.

I only bothered fixing that issue now (I was too busy and most of the examples built for me anyway) and here’s what you have to do:

/home/user/NVIDIA_GPU_Computing_SDK/C/common/common.mk and then add LIB += -lpthread in the area below

OBJS += $(patsubst %.cu,$(OBJDIR)/%.cu_$(1).o,$(notdir $(CUFILES_sm_$(1))))

$(OBJDIR)/%.cu_$(1).o : $(SRCDIR)%.cu $(CU_DEPS)

#	   $(VERBOSE)$(NVCC) -o $$@ -c $$< $(NVCCFLAGS)  $(1)

   # if we have noinline enabled, we only turn this enable this for SM 2.x architectures

   ifeq ($(noinline),1)

		$(VERBOSE)$(NVCC) $(GENCODE_SM20) -o $$@ -c $$< $(NVCCFLAGS)

   else

		$(VERBOSE)$(NVCC) -gencode=arch=compute_$(1),code=\"sm_$(1),compute_$(1)\" $(GENCODE_SM20) -o $$@ -c $$< $(NVCCFLAGS)

   endif

endef

#ADD THIS LINE HERE

LIB += -lpthread

# This line invokes the above template for each arch version stored in

# SM_VERSIONS.  The call funtion invokes the template, and the eval

# function interprets it as make commands.

$(foreach smver,$(SM_VERSIONS),$(eval $(call SMVERSION_template,$(smver))))

$(TARGET): makedirectories $(OBJS) $(CUBINS) $(PTXBINS) Makefile

		$(VERBOSE)$(LINKLINE)

Forgot to mention, that’s no longer relevant for Fedora users as CUDA apps now compile nicely with gcc 4.4.x

Hi,

thank you very much for your suggestion, it solved the issue. [Darn, I was so close ^^]

However, now I get:

../../../shared//inc/shrUtils.h:55: warning: ‘nGpuArchCoresPerSM’ defined but not used

/usr/local/cuda/include/surface_functions.h: In function ‘void surf1Dread(T*, surface<void, 1>, int, int, cudaSurfaceBoundaryMode)’:

/usr/local/cuda/include/surface_functions.h:100: error: there are no arguments to ‘__surf1Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadc1’ must be available

/usr/local/cuda/include/surface_functions.h:100: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)

/usr/local/cuda/include/surface_functions.h:101: error: there are no arguments to ‘__surf1Dreads1’ that depend on a template parameter, so a declaration of ‘__surf1Dreads1’ must be available

/usr/local/cuda/include/surface_functions.h:102: error: there are no arguments to ‘__surf1Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu1’ must be available

/usr/local/cuda/include/surface_functions.h:103: error: there are no arguments to ‘__surf1Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu2’ must be available

/usr/local/cuda/include/surface_functions.h:104: error: there are no arguments to ‘__surf1Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu4’ must be available

/usr/local/cuda/include/surface_functions.h: In function ‘void surf2Dread(T*, surface<void, 2>, int, int, int, cudaSurfaceBoundaryMode)’:

/usr/local/cuda/include/surface_functions.h:460: error: there are no arguments to ‘__surf2Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadc1’ must be available

/usr/local/cuda/include/surface_functions.h:461: error: there are no arguments to ‘__surf2Dreads1’ that depend on a template parameter, so a declaration of ‘__surf2Dreads1’ must be available

/usr/local/cuda/include/surface_functions.h:462: error: there are no arguments to ‘__surf2Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu1’ must be available

/usr/local/cuda/include/surface_functions.h:463: error: there are no arguments to ‘__surf2Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu2’ must be available

/usr/local/cuda/include/surface_functions.h:464: error: there are no arguments to ‘__surf2Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu4’ must be available

make[1]: *** [obj/x86_64/release/scan.cu.o] Error 1

This error is known, cmp. http://www.agapow.net/programming/cpp/no-a…plate-parameter and http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html

It occurs in convolutionTexture, eigenvalues, marchingCubes, MonteCarloMultiGPU, nbody, oceanFFT, quasirandomGenerator, scan, simpleMultiCopy and probably many more examples. I won’t try to fix all those issues. Could anybody please verify my suspicion that this is exactly the problem described in the links? Then some Nvidia developers could fix the examples to work well with the newest GCC. Or is there another solution I haven’t taken into consideration yet?

The whole problem is very unfortunate since some good examples are the best kick start for a beginner. I hope the issue will be fixed soon.

Thanks in advance.

Best regards,

djjxkz2

Weird, I never got that issue despite the fact that we’re using the same OS and architecture. Can you check what version of gcc/g++ you’re using? This is the output I get from gcc --version

gcc (GCC) 4.4.4 20100503 (Red Hat 4.4.4-2)

Copyright (C) 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thank you. This is highly interesting. Same here:

gcc (GCC) 4.4.4 20100503 (Red Hat 4.4.4-2)

Copyright © 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

How can this possibly happen? Do you also already use CUDA 3.1? I installed CUDA 3.0 one day before 3.1 was released - Is it possible I didn’t remove it properly?

I would really like to be able to compile this stuff as well. Any further ideas?

Best regards,

djjxkz2

EDIT:

I just removed (=deleted) and reinstalled the SDK, which didn’t help regarding the C programs. It is interesting to note that I can compile all OpenCL programs, even though all I tested crashed with CL_OUT_OF_RESOURCES. For example:

!!! Error # -5 (CL_OUT_OF_RESOURCES) at line 48 , in file src/oclManager.cpp !!!

I’ll install Fedora and the CUDA stuff on my main computer and see whether my GTX 275 throws the same errors.

I’m also using CUDA 3.1 and I was using 3.0 for quite a while prior to that. The way I installed the stuff was by simply running the .run files and allowing them to uninstall the previous version on their own. Given that, I doubt it’s an issue with not removing it properly. Just a thing you can try though, run this as root:

ldconfig

Then try compiling the stuff again.

Thanks again. I tried it, but to no avail - still the same error. I have installed Fedora 13 on my other machine, but haven’t had time for the CUDA stuff. If any further suggestions should arise please tell me.

Best regards,
djjxkz2

Not sure what other things we can try for this :/

I just installed Fedora 12 again (after two additional tries with 13 DVD & Live CD - same error), performed the very same commands and everything worked perfectly right from the beginning. Is it possible that you had CUDA on Fedora 12 before and then upgraded both? In any case: Problem solved, thank you so much. Gonna start programming some Machine Learning stuff right away ^^
[If anybody wants to track the bug I experienced before: I use a T61 and x86_64 Fedora, the installation steps I performed are given above.]

Glad to know that it worked for you.

Indeed I had CUDA installed in F12 previously, but I doubt that would have meant anything because I always wipe out my root partition for every new release (my home partition is the only thing that gets preserved).

Hi,

I have installed cuda toolkit-3.2 on my PC. But while compiling simple cuda programs following error is coming. I tried 4.4, 4.6 and 4.8 versions of the gcc, g++ and cpp but error is still there. This error will go if I use –compiler-options -fpermissive in nvcc command but is there any permanant solution other than this because for adding this option I have to change many files in my simulator manually.

/home/rakesh/cuda/include/surface_functions.h: In function ‘void surf2Dread(T*, surface<void, 2>, int, int, int, cudaSurfaceBoundaryMode)’:

/home/rakesh/cuda/include/surface_functions.h:460:98: error: there are no arguments to ‘__surf2Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadc1’ must be available [-fpermissive]
(s == 1) ? (void)(*(uchar1 *)res = __surfModeSwitch(surf, x, y, mode, c1)) :