E3SM-Project / E3SM-Project/EKAT

Floating point exception handling test fails in Mac build with AppleClang compiler.

Open
#23 2 comments 0 reactions 1 assignee Claimed by @jeff-cohere View on GitHub
bug mac
Dominant language
C++
Stars
22
Forks
12
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

The `debug_tools_ut_np1_omp1` test in the title fails when building EKAT on a Mac using Apple's Clang C/C++ compilers. The failure is related to a problem in the way we handle floating point exceptions on Macs. This compiler doesn't include OpenMP support, which is probably why there aren't more failures like this.

```
make test
...
Start 105: debug_tools_ut_np1_omp1
105/107 Test #105: debug_tools_ut_np1_omp1 ..........Child aborted***Exception: 0.23 sec
...
```

From the testing logs:

```
105/107 Testing: debug_tools_ut_np1_omp1
105/107 Test: debug_tools_ut_np1_omp1
Command: "/bin/sh" "-c" "./debug_tools"
Directory: /Users/jeff/projects/sandia/EKAT/build/tests/utils
"debug_tools_ut_np1_omp1" start time: Aug 28 10:10 PDT
Output:
----------------------------------------------------------
ExecSpace name: Serial
ExecSpace initialized: yes
avx compiler GCC default FPE mask 0 (NONE)
#host threads 1
ExecSpace name: Serial
ExecSpace initialized: yes
avx compiler GCC default FPE mask 0 (NONE)
#host threads 1
*) testing default fpes...
tests mask: 63
has FE_DIVBYZERO: 1
has FE_INVALID: 1
has FE_OVERFLOW: 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
debug_tools is a Catch v2.9.2 host application.
Run with -? for options

-------------------------------------------------------------------------------
fpes
default-fpes
-------------------------------------------------------------------------------
/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:128
...............................................................................

/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:135: FAILED:
REQUIRE( run_fpe_tests () == num_expected_fpes )
with expansion:
0 == 4

*) testing user-enabled fpes...
tests mask: 59
has FE_DIVBYZERO: 0
has FE_INVALID: 1
has FE_OVERFLOW: 1
-------------------------------------------------------------------------------
fpes
user-requested-fpes
-------------------------------------------------------------------------------
/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:144
...............................................................................

/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:65: FAILED:
REQUIRE( gSignalStatus==has_fe_divbyzero(mask) )
with expansion:
1 == 0

/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:153: FAILED:
REQUIRE( run_fpe_tests () == num_expected_fpes )
due to unexpected exception with message:
Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE

*) testing user-disabled fpes...
tests mask: 4
has FE_DIVBYZERO: 1
has FE_INVALID: 0
has FE_OVERFLOW: 0
- 0/0 threw.
- Invalid arg threw.
- Overflow threw.
-------------------------------------------------------------------------------
fpes
user-requested-fpes
-------------------------------------------------------------------------------
/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:162
...............................................................................

/Users/jeff/projects/sandia/EKAT/tests/utils/debug_tools_tests.cpp:171: FAILED:
REQUIRE( run_fpe_tests () == num_expected_fpes )
with expansion:
3 == 1

Test time = 0.23 sec
----------------------------------------------------------
Test Failed.
"debug_tools_ut_np1_omp1" end time: Aug 28 10:10 PDT
"debug_tools_ut_np1_omp1" time elapsed: 00:00:00
----------------------------------------------------------
```

This is not urgent at all--I'm just logging it here so we don't forget about it.

**To Reproduce**
Steps to reproduce the behavior:
1. Make your way into Apple's walled garden.
2. Configure your EKAT build as usual, enabling tests. See script below.
3. Type `make -j` to build EKAT.
4. Type `make test` to see the fireworks.

**Expected behavior**
In a perfect world, this test would pass!

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: MacOS Catalina (10.15.6)

**Additional context**
Here's a script for configuring EKAT:

```
#!/bin/sh
PROJ_DIR=/Users/myname/where/I/work
SRC_DIR=${PROJ_DIR}/EKAT
KOKKOS_DIR=${PROJ_DIR}/scream/externals/kokkos
YAMLCPP_DIR=${PROJ_DIR}/scream/externals/yaml-cpp
rm -rf CMakeFiles
rm -f CMakeCache.txt
cmake \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \
-D CMAKE_CXX_COMPILER:STRING=mpicxx \
-D CMAKE_Fortran_COMPILER:STRING=mpifort \
\
-D EKAT_DISABLE_TPL_WARNINGS:BOOL=ON \
-D EKAT_ENABLE_TESTS:BOOL=ON \
-D EKAT_TEST_DOUBLE_PRECISION:BOOL=ON \
-D EKAT_TEST_SINGLE_PRECISION:BOOL=ON \
\
-D Kokkos_SOURCE_DIR:PATH=${KOKKOS_DIR} \
-D YAMLCPP_SOURCE_DIR:PATH=${YAMLCPP_DIR} \
\
-D KOKKOS_ENABLE_DEPRECATED_CODE:BOOL=OFF \
${SRC_DIR}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.