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>
This commit is contained in:
parent
16c07e6abd
commit
0c38c86403
@ -405,10 +405,7 @@ def setup_minimal_environment(self, env):
|
||||
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 @@ def patch(self):
|
||||
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 @@ def make_fujitsu_rules(self):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user