After upgrading to Cuda 2.2 I have C++ problems !


I upgraded from 2.1 to 2.2 and got a problem when compiling my code.
Switching on the emulation mode nvcc says ‘support for exception handling is disabled’.
When compiling without “-deviceemu” the error messages disapear.
Everything worked fine with Cuda 2.1.
The statements raising execptions are in host code, I use Ubuntu 8.04.

Any hints ?

Greetings, Uwe


are you using classes at that point in the code?

As a rule of thumb, if I need to use any C++ classes or even C++ header files, I tend to separate that code out and compile it with the host compiler (gcc/g++ my case). At least check if you can avoid compiling that source file with/through nvcc. Basically the only thing you need nvcc for is the <<<>>> kernel calls, and the kernel code itself. And you want those in separate files, and not much else around them. I really like how GPUWorker / HOOMD organises code:

Hope that works for you

The rule about seperation is true. But sometimes it is nice if your launcher function can throw an exception in case of failure. Sadly this doesn’t work in -deviceemu for some reason, even though it works device mode.

I have similar problems in windows with 2.2 where it looks like the compiler was turning all host C++ code into C code in emulation mode only: This would make the “support for exception handling disabled” error make sense, since exceptions aren’t supported in C. It seems to be something strange happening in the compiler.

Difference is, that your error seems to disappear in linux, while this one doesn’t. Might have a similar cause, though.

I just formatted one of the lab computers where I work, and re installed everything from scratch including CUDA 2.2

The project I’m working on compiles fine on another machine thats still running 2.1 (installed about 1 month ago)

When I try to build it on my machine, I get a bunch of ‘support for exception handling is disabled’.

I tried reverting to 2.1, but now nvcc crashes when I build the project.

Other cuda projects work fine, including some that blend c++ and c. It’s only when I try to include or other std headers that I get the problem.

anyone know why reverting to 2.1 didn’t fix it? Did nVidia change it in the last month?

both computers are running XP, and the error happens in both emulation and non emulation build modes.

I also ran into this issue. For now I’ve #ifndef’ed myself out of the problems when running --deviceemu.