Code builds for device, but not for Emu

Hi there,

I have C++ class code that I’ve structured as .h and .cu files. I have no problem building the classes for the device, but when I build for emulation I get a bunch of errors like the following:

C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocinfo(78): error: support for exception handling is disabled

Now, I read that this was a problem with earlier versions of the NVCC compiler not supporting certain aspects of C++ that have since been fixed (I’m using the beta 2.2 toolkit). Is there a way to get this fix available in the emulation build also or is it better to just restructure the C++ code in .h .cpp and .cu code files?

Thanks,
Peter

I’m still seeing this issue in emulator builds with the newly released 2.2 toolkit. Anyone have an idea how to work around it, or is a file restructuring my only option?

Thanks,

Peter

I have a similar problem with the 2.2 toolkit. My .cu files use exceptions in host code (not in kernels), and I can’t compile it anymore. It worked fine with the 2.1 toolkit. It still works if I disable device emulation.

I’m using ArchLinux, 64bits, gcc 4.1. I tried adding “–host-compilation=C++” but it doesn’t change anything, cudafe is still called with --no_exceptions…

Under Windows I am also using the “–host-compilation=C++” flag with similar results in the Emu build. Any word on this, or do I need to start the restructuring?

Peter

Hi I’m encountering the exact same problem you had. Only in my case it complained about more files starting with “x” (sorry, don’t remember which ones, except “xmemory.h”).

I reverted back to 2.1 and all worked well.

Anybody know the cause, because I needed some features of 2.2.

Thanx

somebody want to post a repro?

Here is one (also on http://pastebin.com/f1e51fac3).

This is what I get with the 2.2 toolkit:

[codebox]

schnouki@odin % nvcc --compiler-bindir=gcc-4.1 repro.cu -c -o repro.o

schnouki@odin % g++ -o repro repro.o -lcudart -L/usr/local/cuda/lib

schnouki@odin % ./repro

Memory allocated!

schnouki@odin %

schnouki@odin % nvcc --compiler-bindir=gcc-4.1 repro.cu -c -o repro.o --device-emulation

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include/c++/bits/locale_classes.h(410): error: support for exception handling is disabled

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include/c++/bits/locale_classes.h(515): error: support for exception handling is disabled

repro.cu(11): error: support for exception handling is disabled

3 errors detected in the compilation of “/tmp/tmpxft_00006391_00000000-4_repro.cpp1.ii”.

schnouki@odin %

schnouki@odin % nvcc --version

nvcc: NVIDIA ® Cuda compiler driver

Copyright © 2005-2009 NVIDIA Corporation

Built on Thu_Apr__9_05:05:52_PDT_2009

Cuda compilation tools, release 2.2, V0.2.1221

[/codebox]

It works well with the 2.1 toolkit.

I compile and link separately because that’s what I do in my real-world project.

Hope it helps…
repro.zip (358 Bytes)

This started here too after upgrading to the 2.2 release, windows xp 64 pro, and also xp 32., with Visual Studio 2005 (both pro and express, with service packs installed).

I just tried compiling the repro, which fails as expected in device emulation, but is fine for other targets.

An even simpler repro would be:

#include

cheers
.ola

I’m having a similar problem. My .cu file includes a .h file which includes . It compiles fine under Release mode in Cuda 2.2, but in device emulation mode under 2.2 I get errors about exception handling not being supported. The errors are generated by nvcc and are originating in standard C++ include files. This all works fine under CUDA 2.1.

Hi tmurray,

Has NVIDIA been able to reproduce this problem? Is there a temporary workaround? Please, any information on this would be useful. I have been using interesting debugging techniques while waiting to hear what the resolution is. If this is just the way it’s going to be, I’ll start restructuring and live with it, but staying in this debug limbo is making development difficult.

Thanks,

Peter

Should be fixed in the next release–we disabled device emulation for C++ in 2.2 for various reasons but it will be re-enabled for the next version of the toolkit.

(really though, you should just run Linux and use cuda-gdb for now–it is so much better than -deviceemu)

Thanks for the update.

Can you use the board when running Linux through a Virtual Machine?

Also, do you have any timeframe for when the next version of the toolkit will be available? I know 2.2 just came out, so how about just a quick patch release?

Thanks,

Peter

No and no–the fix required more than a simple patch.

Based on your comments I’ve installed CentOS 5.3 in a dual boot partition, installed the driver, toolkit, SDK, and GDB. Is there any documentation on how to debug CUDA code using GDB? I haven’t used GDB since University.

Thanks,

Peter

bam: [url=“http://developer.download.nvidia.com/compute/cuda/2_2/toolkit/docs/CUDA_GDB_User_Manual_2.2beta.pdf”]http://developer.download.nvidia.com/compu...ual_2.2beta.pdf[/url]