Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29252 Discussions

Mixed C++/FORTRAN code and Haswell-Cores

Tobias_Loew
Novice
638 Views

Hi

I'm building static FORTRAN libs that are linked into C++ Dlls.

When running my programs on Haswell-core-machines I get crashes in calls to DEXP which are reproducable in release and debug mode but do not happen on every call to DEXP only under certain preconditions.

The crashes happen on Haswell-Cores. But not on Sandy-Bridge (I don't have any Ivy-Bridge at hand).

Are there any alignment issues wrt. arguments/stack that are more strict for Haswell (and not obeyed by MSVC) ???

regards

Tobias

0 Kudos
5 Replies
Steven_L_Intel1
Employee
638 Views

I'm not aware of any such thing. If you have a test case we could look at, we'd appreciate it. The math library does "auto-CPU dispatch", so it may well execute different code paths on a Haswell processor. Please also tell us the compile options you are using.

You might want to try using /Qimf-arch-consistency:true and see if it changes the behavior.

0 Kudos
Tobias_Loew
Novice
638 Views

Hi Steve,

I do not have a test-project (yet) but a colleague discovered the following: the crash only happens when running inside OMP parallel code, furthermore the crash ONLY seams to occurs for arguments to DEXP below -500.0D0 or above 500.0D0 (our code sometimes tried to calculate DEXP for values between -800.0D0 and -1200.0D0, that's when the crashes happened)

maybe that helps

Tobias

0 Kudos
John_Campbell
New Contributor II
638 Views

DEXP for < -708 or > +708 could lead to underflow or overflow for real(8) values. ( e^-708 ~ 10^-308 is the limit for real(8) ) I'm not sure if looking for values for between DEXP(-800d0) and DEXP(-1200d0) is a valid test.

John

0 Kudos
Steven_L_Intel1
Employee
638 Views

Do note that the math library does auto-CPU-dispatch, so it may execute different instructions on Haswell vs. older processors. You might try compiling with /Qimf-arch-consistency and see if the error goes away. This will reduce performance somewhat.

A test case we can look at would be appreciated.

0 Kudos
FortranFan
Honored Contributor III
638 Views

Tobias Loew wrote:

Hi Steve,

I do not have a test-project (yet) but a colleague discovered the following: the crash only happens when running inside OMP parallel code, furthermore the crash ONLY seams to occurs for arguments to DEXP below -500.0D0 or above 500.0D0 (our code sometimes tried to calculate DEXP for values between -800.0D0 and -1200.0D0, that's when the crashes happened)

maybe that helps

Tobias

Have you considered using the generic intrinsic functions of HUGE(x) and TINY(x) [for the kinds representation you use for real numbers] along with IEEE exceptions module to check your computations?

0 Kudos
Reply