summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMark Olesen <Mark.Olesen@gmx.net>2021-03-02 22:01:20 +0100
committerGitHub <noreply@github.com>2021-03-02 22:01:20 +0100
commit0c38c864033e5758a564e277e5ed41221ab6c8d0 (patch)
tree8773587badb1dcf95a5793d406db372896a8185e /var
parent16c07e6abdec3e3c500934d1b93841519226a752 (diff)
downloadspack-0c38c864033e5758a564e277e5ed41221ab6c8d0.tar.gz
spack-0c38c864033e5758a564e277e5ed41221ab6c8d0.tar.bz2
spack-0c38c864033e5758a564e277e5ed41221ab6c8d0.tar.xz
spack-0c38c864033e5758a564e277e5ed41221ab6c8d0.zip
openfoam: disable FPE handling for Fujitsu compiler (#21769)
- as outlined in merge-request #21336 some clang compilers can trigger erroneous floating point exceptions. OpenFOAM normally traps FPE, but disable this in the etc/controlDict for specific compilers: change "trapFpe digit;" -> "trapFpe 0;" Eliminate previous use of FOAM_SGIFPE env variable in favour of using the etc/controlDict setting - cleaner and robuster. Co-authored-by: Mark Olesen <Mark.Olesen@esi-group.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/openfoam/package.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/openfoam/package.py b/var/spack/repos/builtin/packages/openfoam/package.py
index 126de81f64..b2ae17610e 100644
--- a/var/spack/repos/builtin/packages/openfoam/package.py
+++ b/var/spack/repos/builtin/packages/openfoam/package.py
@@ -405,10 +405,7 @@ class Openfoam(Package):
def setup_build_environment(self, env):
"""Sets the build environment (prior to unpacking the sources).
"""
- # Avoid the exception that occurs at runtime
- # when building with the Fujitsu compiler.
- if self.spec.satisfies('%fj'):
- env.set('FOAM_SIGFPE', 'false')
+ pass
def setup_run_environment(self, env):
"""Sets the run environment (post-installation).
@@ -549,6 +546,16 @@ class Openfoam(Package):
rcfile,
backup=False)
+ def configure_trapFpe_off(self):
+ """Disable trapFpe handling.
+ Seems to be needed for several clang-derivatives.
+ """
+ # Set 'trapFpe 0' in etc/controlDict
+ controlDict = 'etc/controlDict'
+ if os.path.exists(controlDict):
+ filter_file(r'trapFpe\s+\d+\s*;', 'trapFpe 0;',
+ controlDict, backup=False)
+
@when('@1812: %fj')
@run_before('configure')
def make_fujitsu_rules(self):
@@ -560,6 +567,7 @@ class Openfoam(Package):
arch_rules = 'wmake/rules/linuxARM64' # self.arch
src = arch_rules + 'Clang'
dst = arch_rules + 'Fujitsu' # self.compiler
+ self.configure_trapFpe_off() # LLVM may falsely trigger FPE
if os.path.exists(dst):
return