Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BenWibking opened this issue Jul 2, 2024 · 0 comments
Open

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

BenWibking opened this issue Jul 2, 2024 · 0 comments

Comments

@BenWibking
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant