gcc 4.4 support anytime soon?

I’ve just installed Fedora 11 on one of my development machines (x84_64), along with the 185.18.14 drivers and the Cuda 2.2 toolkits and sdks. Unfortunately, most of the example targets in the sdk fail because of an error:

/usr/local/cuda/bin/…/include/math_functions.h:404: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:409: error: inline function ‘int __signbitf(float)’ cannot be declared weak

Fedora 11 comes with gcc 4.4, which I think is the problem - I actually installed the Fedora 10 versions of the toolkit & SDK because those appeared to be the most recent.

I understand from a forum post back in March 30, 2009 in these forums that GCC 4.4 is not supported yet. Can I get some information about plans to support the newer compiler? I’d be happy to help out with testing, etc.

Thanks for your help,
Jason

It took us a while to support gcc 4.3, so I imagine gcc 4.4 will take a while too. (the idea that people would deploy on gcc 4.4 right now boggles me a little)

Fedora 11 will be supported two releases from now (not in the next release).

Using the nvcc’s --compiler-bindir option and compat-gcc-34 package, it is possible to build the SDK. But the cuda device detection always fail. Is it the expected result on fedora 11 or a problem with my configuration?

Regards.

While Fedora 11 has not received any official testing with CUDA, it seems unlikely that device detection would fail if the driver were correctly installed. I’m guessing that something more fundamental isn’t setup correctly on your system. Generating and attaching an nvidia-bug-report.log.gz would be helpful.

Someone’s got to test it out :)

Anyway, I built gcc 4.3.3 (which takes a while, BTW) and coered nvcc to use it, and everything works fine. I don’t need to use any gcc 4.4 features right now, especially in my CUDA programs…

Jason

Ok, thank you. Here it is. I use drivers from the rpmfusion repository and cudatoolkit2.1. Launching ./deviceQuery returns:

cudaSafeCall() Runtime API error in file <deviceQuery.cu>, line 59 : feature is not yet implemented.

I have tried with cuda2.2 and rpmfusion testing which has 185 drivers and this program returns emulation only device.
xorg.conf.gz (251 Bytes)
nvidia_bug_report.log.gz (32.2 KB)

After investigation, cudart try to dlopen libcuda.so but because I didn’t install xorg-x11-drv-nvidia-devel.x86_64 (which provides libcuda.so) it gives me this strange error. Maybe a more obvious error message could be used.

It leads to another question: cudart is looking for libcuda.so which is the name used at linking time (by convention) whereas libcuda.so.1 is the runtime library name. Maybe it should use libcuda.so.1? (and thus being compatible with rpmfusion packaging standards)

I’m not an expert in library naming, so I may miss something.

Thank you for your help anyway!

libcuda is the actual CUDA driver. If you’re opting not to use the official NVIDIA driver package (which provides all the drivers), then you’re at the whim of how the 3rd party packagers choose to put things together.

Yeah I found that the version in Fusion wasn’t new enough to be supported by the latest Cuda toolkit - I installed the newest drivers from the nvidia website and it works fine (with gcc 4.3)

Hi,

can you tell me how to do that? I am trying to compile the SDK with F11 but I am missing something…

Thanks,

GiP

To compile the sample-projects on F11 w/gcc34 you can change the VIDIA_CUDA_SDK/common/common.mk lines:
CXX := g++34
CC := gcc34
LINK := g++34 -fPIC
and
NVCCFLAGS := --compiler-bindir /tmp

Then create a symbolic link in /tmp:
ln -s /usr/bin/gcc34 gcc

Remember to fetch the freeglut packages

Regards
Lars Ole Belhage

Thanks , I’ll try that.

GiP

I will like to know how is the support for gcc 4.4 going, since at the CUDA Getting started guide says:

but I am getting an error that seems created by using 4.4

/usr/include/c++/4.4/ext/atomicity.h(50): error: identifier "__sync_fetch_and_add" is undefined

Thanks!

as was advised - this worked nearly for all examples ::

To compile the sample-projects on F11 w/gcc34 you can change the VIDIA_CUDA_SDK/common/common.mk lines:
CXX := g++34
CC := gcc34
LINK := g++34 -fPIC
and
NVCCFLAGS := --compiler-bindir /tmp

Then create a symbolic link in /tmp:
ln -s /usr/bin/gcc34 /tmp/gcc

yum install compat-gcc-34-c++ compat-gcc-34 freeglut freeglut-devel

because of: undefined reference to `std::basic_ostream
mv src/smokeParticles/Makefile src/smokeParticles/0makefile
mv src/particles/Makefile src/particles/0makefile
mv src/nbody/Makefile src/nbody/0Makefile

make

somebody advised using -lstdc++, but it did not work for me

Here’s how I got it to work with gcc4.4 in ubuntu 9.10 and Fedora 11 x64

  1. Comment lines 422, 427 and 440 in /usr/local/cuda/include/math_functions.h

  2. Replace line 387 in NVIDIA_GPU_Computing_SDK/C/common/common.mk:

$(VERBOSE)$(NVCC) $(NVCCFLAGS) $(SMVERSIONFLAGS) $(GENCODE_ARCH) -o $@ -c $<

with

$(VERBOSE)$(NVCC) --compiler-options -E $(NVCCFLAGS) $(SMVERSIONFLAGS) $(GENCODE_ARCH) -o tmpfile.cpp -c $<
perl -pi -e ‘s/__builtin_stdarg_start/__builtin_va_start/g’ tmpfile.cpp
$(VERBOSE)$(CXX) $(CXXFLAGS) -o $@ -c tmpfile.cpp

It will generate a lot of warnings but everything seems to be working.

N.

#17 above has several problems:

1- It does not fix the [font=“Courier New”]“__sync_fetch_and_add is undefined”[/font] problem. If you read the messages in order, it might be interpreted that it will.

2- The changes are done against the cuda3.0beta release. The line numbers mentioned do not correspond to CUDA 2.3. The “1.” step is just the commenting out of the __signbit* calls mentioned elsewhere. The “2.” step is the modification of the make rule to find and replace those functions…

I am still waiting for the __sync_fetch_and_add fix, but it seems like a fundamental gcc 4.4 assembly implementation issue.

CUDA on GCC 4.4 is easy. I did a full article about this a little while ago here: CUDA in GCC 4.4 solved

The summary of the post is this though, it’s easily do-able with some small modifications to the SDK code. Here’s the quicky on it:

In math_functions.h comment out (please excuse to poor copy and paste formatting):

in common_functions.h comment out:

You might get another library error though. Hopefully not. Good luck though! Though I’m not 100% sure that the line numbers are exact. I got them from my install on Kubunty 9.10 … so I don’t really know what changes if anything. The line numbers aren’t as important as the code you have to comment out.

Anyway, after commenting out that code in those two files it should compile.

This patch worked pretty well for openSUSE 11.2 as well. It’s a hack, and not everything works perfectly, but it gets the basic issues out of the way.

It’s unfortunate that the CUDA SDK is lagging gcc.