Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Exceptions not being caught

don_a_smith
Beginner
284 Views

I am having problems with my C++ exceptions not being caught when I use MPI; instead the progam crashes. Here's a test application that illustrates the problem:

#include

#include

using

namespace std;

int

main( int argc, char **argv )

{

cout <<

"Starting to play toss..." << endl;

try

{

throw(7);

}

catch(int x)

{

cout <<

"x= " << x << endl;

}

catch(...)

{

cout <<

"Hit the backstop" << endl;

}

cout <<

"Press to continue." << endl;

//cin.get();

}

If I build with icc, everything works fine. If I build with MPI,

(/opt/vltmpi/OPENIB/mpi.icc.rsh/bin/mpicxx), the program dies on the throw.

I am using the version 9.1 C++ compiler for EM64T-based applications and

gcc version 3.4.6 20060404 (Red Hat 3.4.6-3).

Here's the ldd output from the icc build:

libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000002a9566c000)
libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a9585c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000002a959e3000)
libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95aee000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000002a95d22000)
/lib64/ld-linux-x86-64.so.2 (0x0000002a95556000)

Here's the ldd output from the mpicxx build:

libcxa.so.5 => /usr/local/intel/lib/libcxa.so.5 (0x0000002a9566c000)
libunwind.so.5 => /usr/local/intel/lib/libunwind.so.5 (0x0000002a9579e000)
libpmpich++.so.1.0 => /opt/vltmpi/OPENIB/mpi.icc.rsh/lib/shared/libpmpich++.so.1.0 (0x0000002a958a8000)
&nbs p; libmpich.so.1.0 => /opt/vltmpi/OPENIB/mpi.icc.rsh/lib/shared/libmpich.so.1.0 (0x0000002a959d8000)
libmpichfstub.so.1.0 => /opt/vltmpi/OPENIB/mpi.icc.rsh/lib/shared/libmpichfstub.so.1.0 (0x0000002a95bd1000)
libibverbs.so.1 => /usr/local/ofed/lib64/libibverbs.so.1 (0x0000002a95cd2000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000002a95dfb000)
libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a95f11000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000002a96097000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000002a96287000)
libcxaguard.so.5 => /usr/local/intel/lib/libcxaguard.so.5 (0x0000002a96393000)
libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a96494000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000002a966c8000)
libsvml.so => /usr/local/intel/lib/libsvml.so (0x0000002a967cc000)
libimf.so => /usr/local/intel/lib/libimf.so (0x0000002a9690f000)
libirc.so => /usr/local/intel/lib/libirc.so (0x0000002a96c78000)
libsysfs.so.1 => /usr/lib64/libsysfs.so.1 (0x0000002a96db9000)
/lib64/ld-linux-x86-64.so.2 (0x0000002a95556000)

Any help is greatly appreciated.

Don

0 Kudos
4 Replies
pbkenned1
Employee
284 Views

Hello Don,

The problem is that your version built with mpicxx is using libraries that are not compatible with you icc build.

The mpicxx build has dependencies on these runtime libraries:

libcxa.so.5 => /usr/local/intel/lib/libcxa.so.5 (0x0000002a9566c000)
libunwind.so.5 => /usr/local/intel/lib/libunwind.so.5 (0x0000002a9579e000)

These are Intel C++ library components, rather than the GNU counterparts found in libgcc.

So, it appears the mpicxx libraries have been built with -cxxlib-icc (uses the Intel C++ libs), or on a system where -cxxlib-icc

was the default (gcc version < 3.2). Current 9.1 versions of icc on systems where the version of gcc is >= 3.2

default to using the GNU C++ libraries -- which corresponds to -cxxlib-gcc. In version 10.0 icc, we have removed the

Intel C++ libs altogether, and so a compatible gcc (gcc 3.2, 3.3, 3.4, 4.0, 4.1or 4.2 )must be installed on the system to

compile at all with icc v10.0

There is no icc defect here. I compiled your program with icc 9.1.051, and linked against my own MPICH libs built

with icc 9.1.045 (both of these versions of icc are using the GNU C++ libs on my test system):

$ ./bin/mpiCC -V

Intel C++ Compiler for Intel EM64T-based applications, Version 9.1 Build 20070510 Package ID: l_cc_c_9.1.051

$ ./bin/mpiCC test.cpp

$ ./bin/mpirun -np 1 a.out

Starting to play toss...

x= 7

Press to continue.

$

Best Regards,

Patrick Kennedy

Intel Compiler Lab

0 Kudos
don_a_smith
Beginner
284 Views

Thanks very much for looking into this. I suspected I must somehow have incompatible libraries. Your response will be helpful in getting this corrected.

Thanks again,

Don

0 Kudos
jwobrya
Beginner
284 Views

Hello Patrick,

I am one of the admins supporting the system that Don works on and I have fowarded your reply to Voltaire. Just for clarification, I understand your note to say that Voltaire should be using GNU gcc libraries in place of the two Intel libraries you mentioned. This use of GNU librariesis necessary since the 9.1 level of Intel compilers expect to find gcc libaries instead of the two Intel libraries mentioned. Is this summary correct?

Thanks,

Pat

P.S. Registration for the site does not honor e-mail addresses with a quote ('). My correct e-mail is pat.o'bryant@eexonmobil.com. When I registered as a new user I had to eliminate the quote in order to reply.

0 Kudos
pbkenned1
Employee
284 Views

Hello Pat,

Thank you for forwarding my message to Voltaire. The problem that Don experienced was because his version of icc 9.1 defaulted to using the GNU C++ libraries and headers on his development system, probably becausethe version ofgcc was >= 3.2. However, he was linking against MPICH libraries apparently built on a system where the version of icc being used defaulted to using the Intel version of the C++ libraries and headers. So when Don linked against these libraries, he got both the GNU and Intel C++ runtimes linked into the mpicxx executable -- and that is not supported. SIGSEGVs are a common symptom of this problem.

icc v9.1 is the last version of the Intel Linux compiler that supports both the GNU C++headers/libs (-cxxlib-gcc) and the Intel C++ headers/libs (-cxxlib-icc). The default behaviour of icc regarding which C++ system to link against is based on the version of gcc installed on the system. If the gcc version is < 3.2, then the Intel C++ system is used. If the gcc version is >= 3.2, then the GNU C++ is used. If one wishes to change the default behaviour, then either -cxxlib-gcc or -cxxlib-icc must be explicitly provided to link against the desired C++ system.

Finally, in icc 10., we have removed the Intel C++ headers/libs, and so the only option is to link against the GNU versions. The compiler switch for linking against the Intel C++ system, -cxxlib-icc, has also been removed from 10.0. The minimum supported version of gcc is 3.2 as well. With this change, we increase compatibility with GNU C++ and simplify linking with 3rd party libraries. The problem that Don experienced inlinking multiple C++ runtimes is exactly the type of problem we have eliminated starting with icc v10.0

Best Regards,

Patrick Kennedy

Intel Compiler Lab

0 Kudos
Reply