Internal error compiling C++ code

Hi, I get the following error from CUDA 2.0 trying to compile my CUDA program which compiled fine in version 1.1:

I am using linux. The source file where this error occurs is the start of an inner class - eg.

class A {

public:

    class B {

    };

};

Any ideas? Also, are there any release notes for the 2.0 beta?

Thank you!

Andrew

The problem persists in toolkit 2.0 beta 2.

Andrew

I too am having this problem – it is also the start of an inner class for me. Any help would be much appreciated.

Thanks,
Michael

Technically nvcc doesn’t support C++, even though some things do seem to work.

I’m pretty sure nvcc does support C++ in the host code. Any host code is just handed off to the specified host C/C++ compiler, in my case g++. And that’s where this inner class is, way deep down buried inside of the host code for the framework I’m using (called ITK).

See the overview section in “The CUDA compiler driver NVCC” here: http://moss.csc.ncsu.edu/~mueller/cluster/…0/nvcc_2.0.pdf

I think I’m going to get around this problem by just compiling my host code separately into an object file, then compile my CUDA code (host cuda commands and device kernel) with nvcc, and link the two together after compilation. There’s an example of this in the SDK (look for cppIntegration I think).

Mike

cppIntegration compiles the c++ code with g++ directly, not through the nvcc translation.

“The CUDA compiler driver NVCC” does seem to indicate that c++ host code should work, but it does not. Sure, some things will pass through properly, but most things do not. For instance, write a class with a private member variable and try compiling in device emulation mode. It doesn’t work because the translated code tries to access the private member from outside the class. Or this nested class problem you have.

It doesn’t say in the current release notes, but in a previous version of CUDA the release notes mentioned that --host-compilation=c++ is considered an alpha feature.

Hi.

I have a class that contains host and device code - It uses vectors in the host code and was working previously with Cuda 2.1, now I have upgraded to Cuda 2.2, I get the errors mentioned above. What way do you suggest I get around this? I really don’t want to reorganise my code and have duplicates of everything :(

I got this problem, too. I use some boost code, and the compiling error is:

/usr/local/include/boost-1_37/boost/static_assert.hpp(53): internal error: assertion failed: lower_constant: bad kind (/home/buildmeister/nightly/rel/gpgpu/toolkit/r2.2/compiler/edg/EDG_3.9/src/lower_il.c, line 3991)

1 catastrophic error detected in the compilation of “/tmp/tmpxft_00005b8b_00000000-4_procedure.cpp1.ii”.
Compilation aborted.
Aborted (core dumped)
make: *** [obj/procedure.cu.o] Error 255

Does who know some workaround method? Thanks.

Put the Boost code in a .cpp file, and compile it with g++. You can then link everything together at the end.

I had the same problem. Notes: I didn’t have the problem when I compiled most of my c++ code using icpc in 32-bit architecture (code that ends up being linked), but rather, it only came up when switching to 64-bit. I found some info online about nvopencc (the 64 bit NVIDIA compiler as far as I can tell) and it said that NVIDIA officially does not support c++ in 64-bit code, only accepting C. Can anyone confirm this, or to the contrary, provide hope for C++ and 64-bit code compiled/linked with nvcc?