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

fix: reenable floating point exceptions #3300

Merged
merged 23 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c91b10f
reintroduce GEOS_ENABLE_FPE to GeosxOptions.cmake
rrsettgast Aug 22, 2024
8c8f25e
give CompositionalMultiphaseBase::m_maxRelativeCompDensChange a usabl…
rrsettgast Aug 23, 2024
a44164a
some modifications for fpe on testFlowStatistics
rrsettgast Aug 26, 2024
76e5fec
remove cmake debugging
rrsettgast Aug 26, 2024
18df975
update TPL paths. more fixes for CO2SolubilityDuanSun.cpp
rrsettgast Aug 26, 2024
5c756a2
Merge branch 'develop' into bugfix/reenableFPE
rrsettgast Aug 26, 2024
6d77b5c
uncrustify
rrsettgast Aug 27, 2024
3d47509
update submodule for LC paths update
rrsettgast Aug 27, 2024
1616395
Merge branch 'develop' into bugfix/reenableFPE
rrsettgast Aug 27, 2024
ccaed5f
Merge branch 'bugfix/reenableFPE' of github.com:GEOS-DEV/GEOS into bu…
rrsettgast Aug 27, 2024
6edb9ba
error in fpe workaround
rrsettgast Aug 27, 2024
6f9a746
update tpl tag
rrsettgast Aug 27, 2024
18da630
change clang15 build to streak....because it passes on streak, and I …
rrsettgast Aug 27, 2024
737da60
change clang15 build to streak....because it passes on streak, and I …
rrsettgast Aug 27, 2024
ac54e0d
just disable FPE for testVTKImport
rrsettgast Aug 28, 2024
efe1119
put the disableFPE in the correct place
rrsettgast Aug 28, 2024
11a861f
Merge branch 'develop' into bugfix/reenableFPE
rrsettgast Aug 28, 2024
7ba53b3
uncrustify
rrsettgast Aug 28, 2024
0560c23
Merge branch 'bugfix/reenableFPE' of github.com:GEOS-DEV/GEOS into bu…
rrsettgast Aug 28, 2024
1277f18
avoid another FPE
rrsettgast Aug 28, 2024
6ec4dcd
update integratedTest baselines
rrsettgast Aug 28, 2024
a76c249
Apply suggestions from code review
rrsettgast Aug 28, 2024
f5ec4c4
allow failure of SeismicityRate_poromechanics_1d_smoke_01,SeismicityR…
rrsettgast Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"GEOS_TPL_TAG": "278-500"
"GEOS_TPL_TAG": "280-510"
}
},
"runArgs": [
Expand Down
4 changes: 2 additions & 2 deletions .integrated_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
baselines:
bucket: geosx
baseline: integratedTests/baseline_integratedTests-pr3283-6949-4ee437f
baseline: integratedTests/baseline_integratedTests-pr3300-7077-1277f18

allow_fail:
all: ''
streak: pennyShapedToughnessDominated_smoke_01,pennyShapedViscosityDominated_smoke_01,pknViscosityDominated_smoke_01
streak: pennyShapedToughnessDominated_smoke_01,pennyShapedViscosityDominated_smoke_01,pknViscosityDominated_smoke_01,SeismicityRate_poromechanics_1d_smoke_01,SeismicityRate_poromechanics_1d_smoke_02,elas3D_Q3_abc_smoke_01,elas3D_Q3_abc_smoke_08,elas3D_Q3_abc_fs_smoke_01,elas3D_Q3_abc_fs_smoke_08
4 changes: 4 additions & 0 deletions BASELINE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines.
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).

PR #3300 (2024-08-28)
======================
Re-enable floating point exceptions. Rebaseline due to minor changing default value of maxRelativeCompDensChange from 1.7976931348623157e+308 to 1.7976931348623157e+208.


PR #3283 (2024-08-22)
======================
Expand Down
3 changes: 3 additions & 0 deletions host-configs/LLNL/dane-gcc-12.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ set(MPI_HOME /usr/tce/packages/mvapich2/mvapich2-2.3.7-gcc-12.1.1-magic CACHE PA
# ATS
set(ATS_ARGUMENTS "--machine slurm112" CACHE STRING "")

# This is here to note the required flags for using valgrind. These will have to be propagated to the TPL's
#set( CMAKE_CXX_FLAGS "-march=x86-64-v2 -mno-avx512f" CACHE STRING "" FORCE)
rrsettgast marked this conversation as resolved.
Show resolved Hide resolved

include(${CMAKE_CURRENT_LIST_DIR}/llnl-cpu-base.cmake)
4 changes: 4 additions & 0 deletions host-configs/LLNL/ruby-clang-14.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../src/coreComponents/LvArray/host-configs/

# MPI
set(MPI_HOME /usr/tce/packages/mvapich2/mvapich2-2.3.7-clang-14.0.6-magic CACHE PATH "")
# This is here to note the required flags for using valgrind. These will have to be propagated to the TPL's
#set( CMAKE_CXX_FLAGS "-march=x86-64-v2 -mno-avx512f" CACHE STRING "" FORCE)
corbett5 marked this conversation as resolved.
Show resolved Hide resolved
rrsettgast marked this conversation as resolved.
Show resolved Hide resolved
# This is what is required for using address sanitizer. This should be put into GeosxOptions.cmake when it is incorporated into the build options.
#set( CMAKE_CXX_FLAGS "-g -O2 -fno-omit-frame-pointer -fsanitize=address" CACHE STRING "" FORCE)
rrsettgast marked this conversation as resolved.
Show resolved Hide resolved

include(${CMAKE_CURRENT_LIST_DIR}/llnl-cpu-base.cmake)
3 changes: 2 additions & 1 deletion src/cmake/GeosxOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ message( "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" )
message( "CMAKE_HOST_APPLE = ${CMAKE_HOST_APPLE}" )

### OPTIONS ###
option( GEOS_ENABLE_TESTS "" ON )
option( GEOS_ENABLE_FPE "Enables floating point exceptions" ON )
option( GEOS_ENABLE_TESTS "Enables unit tests" ON )
option( ENABLE_CALIPER "Enables Caliper instrumentation" OFF )

option( ENABLE_MATHPRESSO "" ON )
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/LvArray
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ namespace PVTProps
namespace
{

constexpr real64 P_Pa_f = 1e+5;
constexpr real64 P_c = 73.773 * P_Pa_f;
constexpr real64 T_c = 304.1282;
constexpr real64 Rgas = constants::gasConstant;
constexpr real64 V_c = Rgas*T_c/P_c;
inline constexpr real64 P_Pa_f = 1e+5;
inline constexpr real64 P_c = 73.773 * P_Pa_f;
inline constexpr real64 T_c = 304.1282;
inline constexpr real64 Rgas = constants::gasConstant;
inline constexpr real64 V_c = Rgas*T_c/P_c;

// these coefficients are in Table (A1) of Duan and Sun (2003)
constexpr real64 acoef[] =
inline constexpr real64 acoef[15] =
{ 8.99288497e-2, -4.94783127e-1, 4.77922245e-2, 1.03808883e-2, -2.82516861e-2, 9.49887563e-2, 5.20600880e-4,
-2.93540971e-4, -1.77265112e-3, -2.51101973e-5, 8.93353441e-5, 7.88998563e-5, -1.66727022e-2, 1.398, 2.96e-2 };

Expand All @@ -65,7 +65,7 @@ real64 co2EOS( real64 const & T, real64 const & P, real64 const & V_r )
real64 PWater( real64 const & T )
{
// these coefficients are defined in Table (B1) of Duan and Sun (2003)
constexpr real64 ccoef[] = { -38.640844, 5.8948420, 59.876516, 26.654627, 10.637097 };
static constexpr real64 ccoef[5] = { -38.640844, 5.8948420, 59.876516, 26.654627, 10.637097 };

// H2O critical pressure (bars)
real64 const P_c_w = 220.85;
Expand All @@ -92,18 +92,36 @@ real64 logF( real64 const & T, real64 const & P, real64 const & V_r )
real64 const T_r = units::convertCToK( T ) / T_c;
real64 const Z = P_r * V_r/T_r;

real64 const inv_T_r = 1.0/T_r;
real64 const inv_T_r2 = inv_T_r*inv_T_r;
real64 const inv_T_r3 = inv_T_r2*inv_T_r;
real64 const inv_V_r = 1.0/V_r;
real64 const inv_V_r2 = inv_V_r*inv_V_r;
real64 const inv_V_r3 = inv_V_r2*inv_V_r;
real64 const inv_V_r4 = inv_V_r3*inv_V_r;
real64 const inv_V_r5 = inv_V_r4*inv_V_r;

// fugacity coefficient of CO2, equation (A6) of Duan and Sun (2003)
real64 const log_f = Z - 1 - log( Z ) +
( acoef[0] + acoef[1]/T_r/T_r + acoef[2]/T_r/T_r/T_r )/V_r
+ ( acoef[3] + acoef[4]/T_r/T_r + acoef[5]/T_r/T_r/T_r )/2.0/V_r/V_r
+ ( acoef[6] + acoef[7]/T_r/T_r + acoef[8]/T_r/T_r/T_r )/4.0/V_r/V_r/V_r/V_r
+ ( acoef[9] + acoef[10]/T_r/T_r + acoef[11]/T_r/T_r/T_r )/5.0/V_r/V_r/V_r/V_r/V_r
+ acoef[12]/2.0/T_r/T_r/T_r/acoef[14] * ( acoef[13] + 1.0 - (acoef[13] + 1.0 + acoef[14]/V_r/V_r) * exp( -acoef[14]/V_r/V_r ) );
( acoef[0] + acoef[1]*inv_T_r2 + acoef[2]*inv_T_r3 )*inv_V_r
+ ( acoef[3] + acoef[4]*inv_T_r2 + acoef[5]*inv_T_r3 )*0.5*inv_V_r2
+ ( acoef[6] + acoef[7]*inv_T_r2 + acoef[8]*inv_T_r3 )*0.25*inv_V_r4
+ ( acoef[9] + acoef[10]*inv_T_r2 + acoef[11]*inv_T_r3 )*0.2*inv_V_r5
+ acoef[12]*0.5*inv_T_r3/acoef[14] * ( acoef[13] + 1.0 - (acoef[13] + 1.0 + acoef[14]*inv_V_r2) * exp( -acoef[14]*inv_V_r2 ) );
//This causes a divide by zero FPE when using clang14 on ruby
// real64 const log_f = Z - 1 - log( Z ) +
// ( acoef[0] + acoef[1]/T_r/T_r + acoef[2]/T_r/T_r/T_r )/V_r
// + ( acoef[3] + acoef[4]/T_r/T_r + acoef[5]/T_r/T_r/T_r )/2.0/V_r/V_r
// + ( acoef[6] + acoef[7]/T_r/T_r + acoef[8]/T_r/T_r/T_r )/4.0/V_r/V_r/V_r/V_r
// + ( acoef[9] + acoef[10]/T_r/T_r + acoef[11]/T_r/T_r/T_r )/5.0/V_r/V_r/V_r/V_r/V_r
// + acoef[12]/2.0/T_r/T_r/T_r/acoef[14] * ( acoef[13] + 1.0 - (acoef[13] + 1.0 + acoef[14]/V_r/V_r) * exp(
// -acoef[14]/V_r/V_r ) );


return log_f;
}

real64 Par( real64 const & T, real64 const & P, real64 const * cc )
real64 Par( real64 const & T, real64 const & P, real64 const (&cc)[11] )
{
// "equation for the parameters", see equation (7) of Duan and Sun (2003)
real64 x = cc[0]
Expand Down Expand Up @@ -162,11 +180,11 @@ void calculateCO2Solubility( string const & functionName,
array1d< real64 > const & values )
{
// Interaction parameters, see Table 2 of Duan and Sun (2003)
constexpr real64 mu[] =
static constexpr real64 mu[11] =
{ 28.9447706, -0.0354581768, -4770.67077, 1.02782768e-5, 33.8126098, 9.04037140e-3,
-1.14934031e-3, -0.307405726, -0.0907301486, 9.32713393e-4, 0 };
constexpr real64 lambda[] = { -0.411370585, 6.07632013e-4, 97.5347708, 0, 0, 0, 0, -0.0237622469, 0.0170656236, 0, 1.41335834e-5 };
constexpr real64 zeta[] = { 3.36389723e-4, -1.98298980e-5, 0, 0, 0, 0, 0, 2.12220830e-3, -5.24873303e-3, 0, 0 };
static constexpr real64 lambda[11] = { -0.411370585, 6.07632013e-4, 97.5347708, 0, 0, 0, 0, -0.0237622469, 0.0170656236, 0, 1.41335834e-5 };
static constexpr real64 zeta[11] = { 3.36389723e-4, -1.98298980e-5, 0, 0, 0, 0, 0, 2.12220830e-3, -5.24873303e-3, 0, 0 };

localIndex const nPressures = tableCoords.nPressures();
localIndex const nTemperatures = tableCoords.nTemperatures();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ namespace geos

void HypreInterface::initialize()
{
#ifdef GEOS_USE_OPENMP
GEOS_LOG_RANK_0_IF( omp_get_max_threads()>1,
"OMP_NUM_THREADS > 1 may not be optimal for certain hypre preconditioning options. " );
#endif

HYPRE_Init();
#if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
HYPRE_SetExecutionPolicy( HYPRE_EXEC_DEVICE );
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/mainInterface/ProblemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ ProblemManager::ProblemManager( conduit::Node & root ):
setRestartFlags( RestartFlags::WRITE ).
setDescription( "Whether to disallow using pinned memory allocations for MPI communication buffers." );

chai::ArrayManager::getInstance()->disableCallbacks();
wrtobin marked this conversation as resolved.
Show resolved Hide resolved
corbett5 marked this conversation as resolved.
Show resolved Hide resolved

}

ProblemManager::~ProblemManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ CompositionalMultiphaseBase::CompositionalMultiphaseBase( const string & name,
this->registerWrapper( viewKeyStruct::maxRelativeCompDensChangeString(), &m_maxRelativeCompDensChange ).
setSizedFromParent( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( LvArray::NumericLimits< real64 >::max ). // disabled by default
setApplyDefaultValue( LvArray::NumericLimits< real64 >::max/1.0e100 ). // disabled by default
setDescription( "Maximum (relative) change in a component density in a Newton iteration" );

this->registerWrapper( viewKeyStruct::allowLocalCompDensChoppingString(), &m_allowCompDensChopping ).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CompositionalMultiphaseWell::CompositionalMultiphaseWell( const string & name,
this->registerWrapper( viewKeyStruct::maxRelativeCompDensChangeString(), &m_maxRelativeCompDensChange ).
setSizedFromParent( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( LvArray::NumericLimits< real64 >::max ). // disabled by default
setApplyDefaultValue( LvArray::NumericLimits< real64 >::max/1.0e100 ). // disabled by default
setDescription( "Maximum (relative) change in a component density between two Newton iterations" );

this->registerWrapper( viewKeyStruct::maxRelativePresChangeString(), &m_maxRelativePresChange ).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ kappaminDBC real64
logLevel integer 0 Log level
maxAbsolutePressureChange real64 -1 Maximum (absolute) pressure change in a Newton iteration
maxCompFractionChange real64 0.5 Maximum (absolute) change in a component fraction in a Newton iteration
maxRelativeCompDensChange real64 1.79769e+308 Maximum (relative) change in a component density in a Newton iteration
maxRelativeCompDensChange real64 1.79769e+208 Maximum (relative) change in a component density in a Newton iteration
maxRelativePressureChange real64 0.5 Maximum (relative) change in pressure in a Newton iteration
maxRelativeTemperatureChange real64 0.5 Maximum (relative) change in temperature in a Newton iteration
maxSequentialCompDensChange real64 1 Maximum (absolute) component density change in a sequential iteration, used for outer loop convergence check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ isThermal integer 0 Flag i
logLevel integer 0 Log level
maxAbsolutePressureChange real64 -1 Maximum (absolute) pressure change in a Newton iteration
maxCompFractionChange real64 0.5 Maximum (absolute) change in a component fraction in a Newton iteration
maxRelativeCompDensChange real64 1.79769e+308 Maximum (relative) change in a component density in a Newton iteration
maxRelativeCompDensChange real64 1.79769e+208 Maximum (relative) change in a component density in a Newton iteration
maxRelativePressureChange real64 0.5 Maximum (relative) change in pressure in a Newton iteration
maxRelativeTemperatureChange real64 0.5 Maximum (relative) change in temperature in a Newton iteration
maxSequentialCompDensChange real64 1 Maximum (absolute) component density change in a sequential iteration, used for outer loop convergence check
Expand Down
4 changes: 2 additions & 2 deletions src/coreComponents/schema/schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ the relative residual norm satisfies:
<!--maxCompFractionChange => Maximum (absolute) change in a component fraction in a Newton iteration-->
<xsd:attribute name="maxCompFractionChange" type="real64" default="0.5" />
<!--maxRelativeCompDensChange => Maximum (relative) change in a component density in a Newton iteration-->
<xsd:attribute name="maxRelativeCompDensChange" type="real64" default="1.79769e+308" />
<xsd:attribute name="maxRelativeCompDensChange" type="real64" default="1.79769e+208" />
<!--maxRelativePressureChange => Maximum (relative) change in pressure in a Newton iteration-->
<xsd:attribute name="maxRelativePressureChange" type="real64" default="0.5" />
<!--maxRelativeTemperatureChange => Maximum (relative) change in temperature in a Newton iteration-->
Expand Down Expand Up @@ -2536,7 +2536,7 @@ the relative residual norm satisfies:
<!--maxCompFractionChange => Maximum (absolute) change in a component fraction in a Newton iteration-->
<xsd:attribute name="maxCompFractionChange" type="real64" default="0.5" />
<!--maxRelativeCompDensChange => Maximum (relative) change in a component density in a Newton iteration-->
<xsd:attribute name="maxRelativeCompDensChange" type="real64" default="1.79769e+308" />
<xsd:attribute name="maxRelativeCompDensChange" type="real64" default="1.79769e+208" />
<!--maxRelativePressureChange => Maximum (relative) change in pressure in a Newton iteration-->
<xsd:attribute name="maxRelativePressureChange" type="real64" default="0.5" />
<!--maxRelativeTemperatureChange => Maximum (relative) change in temperature in a Newton iteration-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ foreach(test ${gtest_geosx_tests})
SOURCES ${test}
OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY}
DEPENDS_ON ${decoratedDependencies} ${tplDependencyList} )

blt_print_target_properties( TARGET ${test_name} )
geos_add_test( NAME ${test_name}
COMMAND ${test_name} )

Expand Down
6 changes: 6 additions & 0 deletions src/coreComponents/unitTests/meshTests/testVTKImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// Source includes
#include "codingUtilities/UnitTestUtilities.hpp"
#include "dataRepository/xmlWrapper.hpp"
#include "LvArray/src/system.hpp"
#include "mainInterface/GeosxState.hpp"
#include "mainInterface/initialization.hpp"
#include "mesh/MeshManager.hpp"
Expand All @@ -41,6 +42,8 @@

#include <filesystem>

#include <fenv.h>


using namespace geos;
using namespace geos::testing;
Expand Down Expand Up @@ -97,6 +100,9 @@ class TestFractureImport : public ::testing::Test

void SetUp() override
{
// Disable floating point exceptions for the tests.
// clang15 on x86_64 does throws an FPE.
LvArray::system::disableFloatingPointExceptions( FE_ALL_EXCEPT );
if( MpiWrapper::commRank() == 0 )
{
namespace fs = std::filesystem;
Expand Down