From b359e872093ca89589d03ba70fc98959c92ea642 Mon Sep 17 00:00:00 2001 From: Christopher Sherman Date: Thu, 29 Dec 2022 15:37:16 -0800 Subject: [PATCH 1/2] Testing approach for managing xml features with xml inputs --- host-configs/LLNL/lassen-gcc@8.3.1.cmake | 4 ++++ src/coreComponents/functions/CMakeLists.txt | 4 ++-- src/coreComponents/functions/SymbolicFunction.cpp | 14 ++++++++++++-- src/coreComponents/functions/SymbolicFunction.hpp | 10 +++++++++- src/docs/doxygen/GeosxConfig.hpp | 2 +- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/host-configs/LLNL/lassen-gcc@8.3.1.cmake b/host-configs/LLNL/lassen-gcc@8.3.1.cmake index 4d38f8094d9..b1f704fcaee 100644 --- a/host-configs/LLNL/lassen-gcc@8.3.1.cmake +++ b/host-configs/LLNL/lassen-gcc@8.3.1.cmake @@ -14,4 +14,8 @@ set(FORTRAN_MANGLE_NO_UNDERSCORE OFF CACHE BOOL "") set(MPI_HOME /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1 CACHE PATH "") set(MPI_Fortran_COMPILER ${MPI_HOME}/bin/mpifort CACHE PATH "") +# PYGEOSX +set(ENABLE_PYGEOSX ON CACHE BOOL "") +set(Python3_EXECUTABLE /usr/gapps/GEOSX/thirdPartyLibs/python/python3-lassen/python/bin/python CACHE PATH "") + include(${CMAKE_CURRENT_LIST_DIR}/lassen-base.cmake) diff --git a/src/coreComponents/functions/CMakeLists.txt b/src/coreComponents/functions/CMakeLists.txt index 8ba02c4962a..d518c45266d 100644 --- a/src/coreComponents/functions/CMakeLists.txt +++ b/src/coreComponents/functions/CMakeLists.txt @@ -5,6 +5,7 @@ set( functions_headers FunctionBase.hpp FunctionManager.hpp TableFunction.hpp + SymbolicFunction.hpp ) # @@ -14,15 +15,14 @@ set( functions_sources FunctionBase.cpp FunctionManager.cpp TableFunction.cpp + SymbolicFunction.cpp MultivariableTableFunction.cpp ) if( ENABLE_MATHPRESSO ) list( APPEND functions_headers - SymbolicFunction.hpp CompositeFunction.hpp ) list( APPEND functions_sources - SymbolicFunction.cpp CompositeFunction.cpp ) endif() diff --git a/src/coreComponents/functions/SymbolicFunction.cpp b/src/coreComponents/functions/SymbolicFunction.cpp index 32c13cd0a93..681b2948e1f 100644 --- a/src/coreComponents/functions/SymbolicFunction.cpp +++ b/src/coreComponents/functions/SymbolicFunction.cpp @@ -35,9 +35,12 @@ using namespace dataRepository; SymbolicFunction::SymbolicFunction( const string & name, Group * const parent ): - FunctionBase( name, parent ), + FunctionBase( name, parent ) + #ifdef GEOSX_USE_MATHPRESSO + , parserContext(), - parserExpression() + parserExpression(), + #endif { registerWrapper( keys::variableNames, &m_variableNames ). setInputFlag( InputFlags::REQUIRED ). @@ -54,6 +57,8 @@ SymbolicFunction::SymbolicFunction( const string & name, SymbolicFunction::~SymbolicFunction() {} + +#ifdef GEOSX_USE_MATHPRESSO class GeosxMathpressoLogger : public mathpresso::OutputLog { public: @@ -104,9 +109,11 @@ class GeosxMathpressoLogger : public mathpresso::OutputLog std::ostringstream m_stream; }; +#endif void SymbolicFunction::initializeFunction() { + #ifdef GEOSX_USE_MATHPRESSO // Register variables for( localIndex ii=0; ii +#endif namespace geosx { @@ -71,7 +72,12 @@ class SymbolicFunction : public FunctionBase */ inline real64 evaluate( real64 const * const input ) const override final { + #ifdef GEOSX_USE_MATHPRESSO return parserExpression.evaluate( reinterpret_cast< void * >( const_cast< real64 * >(input) ) ); + #else + GEOSX_ERROR( "SymbolicFunction evaluation is not enabled in this build of GEOSX" ); + return 0.0; + #endif } @@ -90,9 +96,11 @@ class SymbolicFunction : public FunctionBase private: + #ifdef GEOSX_USE_MATHPRESSO // Symbolic math driver objects mathpresso::Context parserContext; mathpresso::Expression parserExpression; + #endif /// Symbolic expression variable names string_array m_variableNames; diff --git a/src/docs/doxygen/GeosxConfig.hpp b/src/docs/doxygen/GeosxConfig.hpp index 7e88fdb09ae..c396abaf1a4 100644 --- a/src/docs/doxygen/GeosxConfig.hpp +++ b/src/docs/doxygen/GeosxConfig.hpp @@ -141,7 +141,7 @@ #define fmt_VERSION 8.0.1 /// Version information for python -/* #undef Python3_VERSION */ +#define Python3_VERSION 3.7.2 /// Version information for CUDAToolkit /* #undef CUDAToolkit_VERSION */ From c7064807bdbe635bd7d98a5975d3651dd91d63e8 Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Tue, 17 Dec 2024 12:07:02 -0800 Subject: [PATCH 2/2] merge cleanup --- host-configs/LLNL/lassen-gcc-8-cuda-11.cmake | 5 ++++- src/coreComponents/functions/SymbolicFunction.cpp | 10 +++++----- src/docs/doxygen/GeosxConfig.hpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/host-configs/LLNL/lassen-gcc-8-cuda-11.cmake b/host-configs/LLNL/lassen-gcc-8-cuda-11.cmake index 908e4138d53..571f7b15632 100644 --- a/host-configs/LLNL/lassen-gcc-8-cuda-11.cmake +++ b/host-configs/LLNL/lassen-gcc-8-cuda-11.cmake @@ -16,5 +16,8 @@ set(MPI_Fortran_COMPILER ${MPI_HOME}/bin/mpifort CACHE PATH "") set(ENABLE_CUDA_NVTOOLSEXT ON CACHE BOOL "") -include(${CMAKE_CURRENT_LIST_DIR}/lassen-base.cmake) +# PYGEOSX +set(ENABLE_PYGEOSX ON CACHE BOOL "") +set(Python3_EXECUTABLE /usr/gapps/GEOSX/thirdPartyLibs/python/python3-lassen/python/bin/python CACHE PATH "") +include(${CMAKE_CURRENT_LIST_DIR}/lassen-base.cmake) diff --git a/src/coreComponents/functions/SymbolicFunction.cpp b/src/coreComponents/functions/SymbolicFunction.cpp index 2d6b94729d6..70614b32db3 100644 --- a/src/coreComponents/functions/SymbolicFunction.cpp +++ b/src/coreComponents/functions/SymbolicFunction.cpp @@ -37,7 +37,7 @@ using namespace dataRepository; SymbolicFunction::SymbolicFunction( const string & name, Group * const parent ): FunctionBase( name, parent ) - #ifdef GEOSX_USE_MATHPRESSO + #ifdef GEOS_USE_MATHPRESSO , parserContext(), parserExpression(), @@ -60,7 +60,7 @@ SymbolicFunction::~SymbolicFunction() {} -#ifdef GEOSX_USE_MATHPRESSO +#ifdef GEOS_USE_MATHPRESSO class GeosxMathpressoLogger : public mathpresso::OutputLog { public: @@ -115,7 +115,7 @@ class GeosxMathpressoLogger : public mathpresso::OutputLog void SymbolicFunction::initializeFunction() { - #ifdef GEOSX_USE_MATHPRESSO + #ifdef GEOS_USE_MATHPRESSO // Register variables for( localIndex ii=0; ii