From d070d7ccdf3d2c7c2c4c02f5e75c02c84d9f9596 Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Tue, 26 Sep 2023 14:39:09 +0200 Subject: [PATCH] bos #34671: [Windows] openturns and persalys integration --- products/PERSALYS.pyconf | 2 +- products/compil_scripts/openturns-1.21.bat | 2 +- products/openturns.pyconf | 2 +- products/patches/PERSALYS-v14.1-002.patch | 21 +++++++ products/patches/PERSALYS-v14.1-003.patch | 22 +++++++ products/patches/openturns-1.21.0003.patch | 71 ++++++++++++++++++++++ products/patches/openturns-1.21.0004.patch | 15 +++++ 7 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 products/patches/PERSALYS-v14.1-002.patch create mode 100644 products/patches/PERSALYS-v14.1-003.patch create mode 100644 products/patches/openturns-1.21.0003.patch create mode 100644 products/patches/openturns-1.21.0004.patch diff --git a/products/PERSALYS.pyconf b/products/PERSALYS.pyconf index 5e63f27..d87bc42 100644 --- a/products/PERSALYS.pyconf +++ b/products/PERSALYS.pyconf @@ -93,7 +93,7 @@ version_v14_1_win : 'openblas', 'pthreads' ] - patches : [] + patches : ['PERSALYS-v14.1-002.patch', 'PERSALYS-v14.1-003.patch'] } version_v14_0_1 : diff --git a/products/compil_scripts/openturns-1.21.bat b/products/compil_scripts/openturns-1.21.bat index 6887784..93547b5 100644 --- a/products/compil_scripts/openturns-1.21.bat +++ b/products/compil_scripts/openturns-1.21.bat @@ -284,7 +284,7 @@ mkdir otpod set CMAKE_OPTIONS_EXT=%CMAKE_OPTIONS% cd %BUILD_DIR%\otpod -xcopy %SOURCE_DIR%\otpod-0.6.9\* %BUILD_DIR%\otpod /E /I /Q +xcopy %SOURCE_DIR%\otpod-0.6.10\* %BUILD_DIR%\otpod /E /I /Q if NOT %ERRORLEVEL% == 0 ( echo ERROR on xcopy exit 3 diff --git a/products/openturns.pyconf b/products/openturns.pyconf index 20b8944..1edab05 100644 --- a/products/openturns.pyconf +++ b/products/openturns.pyconf @@ -52,7 +52,7 @@ version_1_21_win : build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name depend : ['Python', 'openblas', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib', 'fftw'] opt_depend : ['pandas', 'statsmodels', 'patsy'] - patches : [] + patches : ['openturns-1.21.0003.patch', 'openturns-1.21.0004.patch'] properties : { single_install_dir : "no" diff --git a/products/patches/PERSALYS-v14.1-002.patch b/products/patches/PERSALYS-v14.1-002.patch new file mode 100644 index 0000000..844f466 --- /dev/null +++ b/products/patches/PERSALYS-v14.1-002.patch @@ -0,0 +1,21 @@ +--- persalys-14.1_ref/CMakeLists.txt 2023-07-25 11:23:39.000000000 +0200 ++++ persalys-14.1_dev/CMakeLists.txt 2023-09-26 12:57:40.000000000 +0200 +@@ -64,9 +64,16 @@ + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") + endif () + ++SET(BOOST_ROOT_DIR $ENV{BOOST_ROOT_DIR} CACHE PATH "Path to the Boost") ++if(EXISTS "${BOOST_ROOT_DIR}") ++ set(BOOST_ROOT "${BOOST_ROOT_DIR}" CACHE PATH "Boost root directory" FORCE) ++endif() ++set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and ++set(Boost_USE_RELEASE_LIBS ON) # only find release libsfind_package (Boost COMPONENTS filesystem locale REQUIRED) + find_package (Boost COMPONENTS filesystem locale REQUIRED) +-list (APPEND PERSALYS_PRIVATE_LIBRARIES ${Boost_LIBRARIES}) +- ++if (TARGET Boost::filesystem) ++ set (Boost_LIBRARIES Boost::filesystem Boost::locale) ++ENDIF() + find_package (Python 3.5 COMPONENTS Interpreter Development REQUIRED) + list (APPEND PERSALYS_PUBLIC_LIBRARIES ${Python_LIBRARIES}) + diff --git a/products/patches/PERSALYS-v14.1-003.patch b/products/patches/PERSALYS-v14.1-003.patch new file mode 100644 index 0000000..6a815fb --- /dev/null +++ b/products/patches/PERSALYS-v14.1-003.patch @@ -0,0 +1,22 @@ +--- persalys-14.1_ref/lib/src/base/CMakeLists.txt 2023-07-25 11:23:39.000000000 +0200 ++++ persalys-14.1_dev/lib/src/base/CMakeLists.txt 2023-09-26 13:00:18.000000000 +0200 +@@ -203,7 +203,7 @@ + else () + target_compile_definitions (persalysbase PUBLIC PERSALYS_BASE_STATIC) + endif () +- ++target_compile_options(persalysbase PUBLIC -DBOOST_ALL_DYN_LINK) + target_include_directories (persalysbase PRIVATE ${Boost_INCLUDE_DIRS}) + target_include_directories (persalysbase PRIVATE ${Python_INCLUDE_DIRS}) + +@@ -220,8 +220,8 @@ + set_target_properties (persalysbase PROPERTIES VERSION ${LIB_VERSION}) + set_target_properties (persalysbase PROPERTIES SOVERSION ${LIB_SOVERSION}) + +-target_link_libraries (persalysbase PUBLIC ${PERSALYS_PUBLIC_LIBRARIES}) +-target_link_libraries (persalysbase PRIVATE ${PERSALYS_PRIVATE_LIBRARIES}) ++target_link_libraries (persalysbase PUBLIC "${PERSALYS_PUBLIC_LIBRARIES};${Boost_LIBRARIES};${Boost_FILESYSTEM_LIBRARY_RELEASE}") ++target_link_libraries (persalysbase PRIVATE "${PERSALYS_PRIVATE_LIBRARIES};${Boost_LIBRARIES};${Boost_FILESYSTEM_LIBRARY_RELEASE}") + + install (TARGETS persalysbase + RUNTIME DESTINATION ${PERSALYS_BIN_PATH} diff --git a/products/patches/openturns-1.21.0003.patch b/products/patches/openturns-1.21.0003.patch new file mode 100644 index 0000000..f5cb9b0 --- /dev/null +++ b/products/patches/openturns-1.21.0003.patch @@ -0,0 +1,71 @@ +--- otrobopt-0.12_ref/lib/src/MeasureEvaluation.cxx 2023-09-13 14:59:42.000000000 +0200 ++++ otrobopt-0.12_dev/lib/src/MeasureEvaluation.cxx 2023-09-26 12:11:25.339902064 +0200 +@@ -23,40 +23,20 @@ + #include + #include + #include ++#include + + using namespace OT; + + namespace OTROBOPT + { + +- +-static pthread_mutex_t OTRobOptResourceMap_InstanceMutex_; +-static UnsignedInteger OTRobOptResourceMap_initialized_ = 0; +- +-class OTRobOptResourceMap_init ++struct OTRobOptResourceMap_init + { +-public: + OTRobOptResourceMap_init() + { +- +- if (!OTRobOptResourceMap_initialized_) ++ static std::once_flag flag; ++ std::call_once(flag, [&]() + { +-#ifndef OT_MUTEXINIT_NOCHECK +- pthread_mutexattr_t attr; +- pthread_mutexattr_init( &attr ); +- pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); +- pthread_mutex_init(&OTRobOptResourceMap_InstanceMutex_, &attr); +-#else +- pthread_mutex_init(&OTRobOptResourceMap_InstanceMutex_, NULL); +-#endif +- // openturns<1.15 +-#ifndef OPENTURNS_VERSION +-#define AddAsScalar SetAsScalar +-#define AddAsUnsignedInteger SetAsUnsignedInteger +-#define AddAsBool SetAsBool +-#define AddAsScalar SetAsScalar +-#endif +- // SequentialMonteCarloRobustAlgorithm + ResourceMap::AddAsScalar("SequentialMonteCarloRobustAlgorithm-ConvergenceFactor", 1e-2); + ResourceMap::AddAsUnsignedInteger("SequentialMonteCarloRobustAlgorithm-DefaultInitialSamplingSize", 10); + +@@ -67,21 +47,11 @@ + + ResourceMap::AddAsUnsignedInteger("IndividualChanceMeasure-GaussKronrodRule", GaussKronrodRule::G7K15); + ResourceMap::AddAsUnsignedInteger("JointChanceMeasure-GaussKronrodRule", GaussKronrodRule::G7K15); +- OTRobOptResourceMap_initialized_ = 1; +- } +- assert(OTRobOptResourceMap_initialized_); ++ }); + } +- +- ~OTRobOptResourceMap_init() +- { +- if (OTRobOptResourceMap_initialized_) +- pthread_mutex_destroy(&OTRobOptResourceMap_InstanceMutex_); +- OTRobOptResourceMap_initialized_ = 0; +- } +- + }; + +-static const OTRobOptResourceMap_init static_initializer_OTRobOptResourceMap; ++static const OTRobOptResourceMap_init __OTRobOptResourceMap_initializer; + + CLASSNAMEINIT(MeasureEvaluation) + diff --git a/products/patches/openturns-1.21.0004.patch b/products/patches/openturns-1.21.0004.patch new file mode 100644 index 0000000..43eabb5 --- /dev/null +++ b/products/patches/openturns-1.21.0004.patch @@ -0,0 +1,15 @@ +--- openturns-1.21_ref/openturns-1.21/lib/src/Base/Common/openturns/Log.hxx 2023-09-13 14:59:40.000000000 +0200 ++++ openturns-1.21_dev/openturns-1.21/lib/src/Base/Common/openturns/Log.hxx 2023-09-26 14:28:12.567657677 +0200 +@@ -21,6 +21,12 @@ + #ifndef OPENTURNS_LOG_HXX + #define OPENTURNS_LOG_HXX + ++#ifdef WIN32 ++ #ifdef ERROR ++ #undef ERROR ++ #endif ++#endif ++ + #include + #include + #include "openturns/OTprivate.hxx" -- 2.39.2