View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000631 | OpenFOAM | Bug | public | 2012-08-20 14:14 | 2012-08-20 18:05 |
Reporter | Assigned To | ||||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Summary | 0000631: The floating point exception handling in scotchDecomp.C is broken | ||||
Description | The current implementation checks first whether one of linux, linuxAMD64, linuxIA64 is defined and then defines LINUX. Next, it checks whether LINUX and __GNUC__ are defined, and then defines LINUX_GNUC. Finally, if LINUX_GNUC is defined it defines __USE_GNU and includes fenv.h. This is broken on x86_64 because checking for linuxAMD64 is wrong, it should be linux64. What saves the day when using a Linux kernel, however, is that linux is actually also a built-in macro, and everything is fine and dandy. When using a more exotic flavour of linux, e.g. Debian GNU/Hurd or Debian GNU/kFreeBSD this utterly fails, despite the fact that the system actually does use glibc and hence offers the required capabilities. Further, defining __USE_GNU is relying on the internal implementation of glibc. The proper way of requesting the definitions of the GNU FE handling extensions is to define _GNU_SOURCE (see fenv(3)). Fixing this is easy, just replace the whole charade with #ifdef __GLIBC__ # define _GNU_SOURCE # include <fenv.h> #endif and further down replace the checks for LINUX_GNUC with e.g. a check for FE_NOMASK_ENV which is only defined if the GNU FE handling extensions are available. | ||||
Additional Information | Attached patch fixes this in the above described way. | ||||
Tags | No tags attached. | ||||
2012-08-20 14:14
|
0001-Fix-FE-handling-in-scotchDecomp.C.patch (1,559 bytes)
From a6f19ecf5f8ef742f91a4573f97cd1f30167c621 Mon Sep 17 00:00:00 2001 From: Michael Wild <themiwi@users.sourceforge.net> Date: Mon, 20 Aug 2012 14:48:34 +0200 Subject: [PATCH] Fix FE handling in scotchDecomp.C Signed-off-by: Michael Wild <themiwi@users.sourceforge.net> --- src/parallel/decompose/scotchDecomp/scotchDecomp.C | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index ecfde10..27e5f00 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -135,18 +135,8 @@ extern "C" // Hack: scotch generates floating point errors so need to switch of error // trapping! -#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) -# define LINUX -#endif - -#if defined(LINUX) && defined(__GNUC__) -# define LINUX_GNUC -#endif - -#ifdef LINUX_GNUC -# ifndef __USE_GNU -# define __USE_GNU -# endif +#ifdef __GLIBC__ +# define _GNU_SOURCE # include <fenv.h> #endif @@ -503,7 +493,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc // Hack:switch off fpu error trapping -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV int oldExcepts = fedisableexcept ( FE_DIVBYZERO @@ -526,7 +516,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc "SCOTCH_graphMap" ); -# ifdef LINUX_GNUC +# ifdef FE_NOMASK_ENV feenableexcept(oldExcepts); # endif -- 1.7.9.5 |
|
Added in 276d31f755c4ed1bb61f318ffd6f48b7e5bed210 (also ptscotch) Thanks! |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-08-20 14:14 |
|
New Issue | |
2012-08-20 14:14 |
|
File Added: 0001-Fix-FE-handling-in-scotchDecomp.C.patch | |
2012-08-20 18:05 |
|
Note Added: 0001618 | |
2012-08-20 18:05 |
|
Status | new => resolved |
2012-08-20 18:05 |
|
Fixed in Version | => 2.1.x |
2012-08-20 18:05 |
|
Resolution | open => fixed |
2012-08-20 18:05 |
|
Assigned To | => user4 |