Skip to content

AMReX_FPE is not equivalent to amrex.fpe_trap_* options #4014

@BenWibking

Description

@BenWibking

Somewhat confusingly, setting AMReX_FPE=ON in the CMake options turns on compiler-specific flags that are not always equivalent to setting the amrex.fpe_trap_* ParmParse parameters.

For instance, when using gcc, AMReX_FPE=ON adds -ftrapv to the compile flags, which appears to only detect signed integer overflow (and also is broken in several gcc releases: https://blog.robertelder.org/gcc-signed-overflow-trapping-ftrapv-doesnt-work/)

$<${_cxx_gnu}:-ftrapv>

Whereas the runtime options change the FPU state explicitly for specified FPU exceptions:

if (invalid) { curr_fpe_excepts |= FE_INVALID; }

I think it would be more consistent to have AMReX_FPE change the defaults for the runtime parameters, so that the behavior is exactly consistent. Otherwise, the documentation (https://amrex-codes.github.io/amrex/docs_html/Debugging.html) should be changed to make it very clear that these two options are not equivalent.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions