From dc1f8c6bf5f295c793d11451bdac294ac690ea0e Mon Sep 17 00:00:00 2001 From: Guytri KASTANE Date: Mon, 15 Apr 2024 14:21:46 +0200 Subject: [PATCH] Add patch of cblas; use nlopt system for native build; --- applications/SALOME-master-native.pyconf | 10 +++---- applications/SALOME-master.pyconf | 3 ++ products/compil_scripts/openturns-1.22.sh | 12 +++++--- products/env_scripts/nlopt.py | 25 ++++++++++++++++- products/nlopt.pyconf | 7 +++++ products/openturns.pyconf | 32 ++++++++++++++++++++++ products/patches/openturns-1.22.0001.patch | 14 ++++++++++ 7 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 products/patches/openturns-1.22.0001.patch diff --git a/applications/SALOME-master-native.pyconf b/applications/SALOME-master-native.pyconf index b46b7ad..9ae3045 100644 --- a/applications/SALOME-master-native.pyconf +++ b/applications/SALOME-master-native.pyconf @@ -83,7 +83,7 @@ APPLICATION : # comment out line above and uncomment the line below to use Netgen 6. #netgen : '6.2.2101' netcdf : 'native' - nlopt : '2.4.2' + nlopt : 'native' nose: 'native' numpy : 'native' numpydoc : 'native' @@ -222,7 +222,6 @@ __overwrite__ : 'APPLICATION.rm_products' : ['TTK'] # causes crashes 'APPLICATION.products.cmake' : 'native' # TTK requires cmake > 3.21 'APPLICATION.products.opencv' : '3.2.0' - 'APPLICATION.products.nlopt' : '2.5.0' 'APPLICATION.products.cminpack' : 'native' 'APPLICATION.products.netcdf' : '4.6.2' 'APPLICATION.products.omniORB' : '4.2.5' @@ -268,7 +267,6 @@ __overwrite__ : 'APPLICATION.products.swig' : '4.0.2' 'APPLICATION.products.tbb' : '2021.9.0' 'APPLICATION.products.PyFMI' : {tag: '2.6', base: 'no', section: 'version_2_6_DB12' } - 'APPLICATION.products.nlopt' : '2.5.0' 'APPLICATION.products.ParaView' : {tag: '5.11.0', base: 'no', section: 'version_5_11_0_MPI_DB12', hpc: 'yes' } } { @@ -277,6 +275,8 @@ __overwrite__ : __condition__ : "VARS.dist in ['CO8']" 'APPLICATION.products.sphinxintl' : {tag: '0.9.10', base: 'no', section: 'version_0_9_10_no_pip' } 'APPLICATION.products.cminpack' : '1.3.6' + 'APPLICATION.products.nlopt' : '2.4.2' + 'APPLICATION.products.openturns' : {tag: '1.22', base: 'no', section: 'version_1_22_CO8' } 'APPLICATION.products.PyFMI' : {tag: '2.6', base: 'no', section: 'version_2_6_no_pip' } 'APPLICATION.products.statsmodels' : {tag: '0.6.1', base: 'no', section: 'version_0_6_1_no_pip' } 'APPLICATION.products.gdal' : {tag:'2.4.0', base: 'no', section: 'version_2_4_0_CO8' } # spns #29324 @@ -284,6 +284,7 @@ __overwrite__ : } { __condition__ : "VARS.dist in ['CO9']" + 'APPLICATION.products.nlopt' : '2.4.2' 'APPLICATION.products.cminpack' : '1.3.6' 'APPLICATION.products.qwt' : '6.1.2' 'APPLICATION.products.PyQt' : '5.15.3' @@ -327,7 +328,6 @@ __overwrite__ : 'APPLICATION.products.omniORB' : '4.2.5' 'APPLICATION.products.omniORBpy' : '4.2.5' 'APPLICATION.products.qwt' : '6.1.6' - 'APPLICATION.products.nlopt' : '2.6.0' 'APPLICATION.products.netcdf' : '4.6.2' 'APPLICATION.products.numpy' : {tag: '1.22.2', base: 'no', section: 'version_1_22_2' } 'APPLICATION.products.PyFMI' : {tag: '2.6', base: 'no', section: 'version_2_6_no_pip' } @@ -343,7 +343,6 @@ __overwrite__ : 'APPLICATION.products.omniORB' : '4.2.5' 'APPLICATION.products.omniORBpy' : '4.2.5' 'APPLICATION.products.qwt' : '6.1.6' - 'APPLICATION.products.nlopt' : '2.6.0' 'APPLICATION.products.netcdf' : '4.6.2' 'APPLICATION.products.numpy' : {tag: '1.22.2', base: 'no', section: 'version_1_22_2' } 'APPLICATION.products.PyFMI' : {tag: '2.6', base: 'no', section: 'version_2_6_FD37' } @@ -359,7 +358,6 @@ __overwrite__ : 'APPLICATION.products.omniORB' : '4.2.5' 'APPLICATION.products.omniORBpy' : '4.2.5' 'APPLICATION.products.qwt' : '6.1.6' - 'APPLICATION.products.nlopt' : '2.6.0' 'APPLICATION.products.netcdf' : '4.6.2' 'APPLICATION.products.swig' : '4.0.2' 'APPLICATION.products.petsc' : {tag: '3.16.0', base: 'no', section: 'version_3_16_0_FD38' } diff --git a/applications/SALOME-master.pyconf b/applications/SALOME-master.pyconf index 35c1991..6f7c18b 100644 --- a/applications/SALOME-master.pyconf +++ b/applications/SALOME-master.pyconf @@ -224,11 +224,13 @@ __overwrite__ : { __condition__ : "VARS.dist in ['CO7']" 'APPLICATION.rm_products' : ['gcc', 'gmp', 'mpc', 'mpfr'] + 'APPLICATION.products.openturns' : {tag:'1.22', base:'no', section:'version_1_22_CO7'} } { __condition__ : "VARS.dist in ['CO8']" 'APPLICATION.rm_products' : ['gcc', 'gmp', 'mpc', 'mpfr', 'zeromq'] 'APPLICATION.products.gdal' : {tag:'2.4.0', base: 'no', section: 'version_2_4_0_CO8' } # spns #29324 + 'APPLICATION.products.openturns' : {tag:'1.22', base:'no', section:'version_1_22_CO8'} 'APPLICATION.products.ParaView' : {tag: '5.11.0', base: 'no', section: 'version_5_11_0_MPI_CO8', hpc: 'yes'} } { @@ -238,6 +240,7 @@ __overwrite__ : } { __condition__ : "VARS.dist in ['DB09']" + 'APPLICATION.products.openturns' : {tag:'1.22', base:'no', section:'version_1_22_DB09'} 'APPLICATION.products.MEDCOUPLING' : {tag:'master', base: 'no', section: 'default_MPI', hpc: 'yes'} } { diff --git a/products/compil_scripts/openturns-1.22.sh b/products/compil_scripts/openturns-1.22.sh index d8895ef..ced175d 100755 --- a/products/compil_scripts/openturns-1.22.sh +++ b/products/compil_scripts/openturns-1.22.sh @@ -4,6 +4,7 @@ echo "########################################################################## echo "openturns" $VERSION echo "##########################################################################" +LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" export PATH=$(pwd)/bin:$PATH export PYTHONPATH=$(pwd):$PYTHONPATH @@ -21,6 +22,10 @@ CMAKE_OPTIONS+=" -DCMAKE_INSTALL_LIBDIR:STRING=lib" CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE:STRING=Release" CMAKE_OPTIONS+=" -DPYTHON_EXECUTABLE=${PYTHONBIN}" +if [ "$SAT_Python_IS_NATIVE" == "1" ] && [ "$LINUX_DISTRIBUTION" == "CO8" ] ; then + CMAKE_OPTIONS+=" -DPython_EXECUTABLE=${PYTHONBIN}" +fi + if [ -n "$SWIG_ROOT_DIR" ] && [ "$SAT_swig_IS_NATIVE" != "1" ]; then CMAKE_OPTIONS+=" -DSWIG_EXECUTABLE=${SWIG_ROOT_DIR}/bin/swig" fi @@ -31,7 +36,6 @@ if [ -n "$TBB_ROOT_DIR" ] && [ "$SAT_tbb_IS_NATIVE" != "1" ]; then fi # https://github.com/persalys/persalys/issues/745 -LINUX_DISTRIBUTION="$DIST_NAME$DIST_VERSION" case $LINUX_DISTRIBUTION in UB22*|CO8*|CO9*|FD36|FD37|FD38) echo "WARNING: switching OFF TBB support" @@ -99,8 +103,8 @@ fi ## nlopt if [ -n "$NLOPT_ROOT_DIR" ] && [ "$SAT_nlopt_IS_NATIVE" != "1" ]; then - CMAKE_OPTIONS+=" -DNLOPT_INCLUDE_DIRS:STRING=${NLOPT_ROOT_DIR}/include" - CMAKE_OPTIONS+=" -DNLOPT_LIBRARIES:STRING=${NLOPT_ROOT_DIR}/lib" + CMAKE_OPTIONS+=" -DNLOPT_INCLUDE_DIR:STRING=${NLOPT_ROOT_DIR}/include" + CMAKE_OPTIONS+=" -DNLOPT_LIBRARY:STRING=${NLOPT_ROOT_DIR}/lib/libnlopt.so" CMAKE_OPTIONS+=" -DNLOPT_DIR:STRING=${NLOPT_ROOT_DIR}" fi @@ -408,7 +412,7 @@ if [[ -d "$SOURCE_DIR/otfftw-0.14" ]]; then ${PYTHONBIN} -m pip install --cache-dir=$BUILD_DIR/cache/pip $SOURCE_DIR/dill-0.3.4/dill-0.3.4-py2.py3-none-any.whl --no-deps if [ $? -ne 0 ] then - echo "FATAL: could not install dikk-0.3.4" + echo "FATAL: could not install dill-0.3.4" exit 5 fi elif [[ $k == "otpod" ]]; then diff --git a/products/env_scripts/nlopt.py b/products/env_scripts/nlopt.py index fc95c33..4e98f17 100644 --- a/products/env_scripts/nlopt.py +++ b/products/env_scripts/nlopt.py @@ -13,4 +13,27 @@ def set_env(env, prereq_dir, version): env.prepend('PYTHONPATH', os.path.join(prereq_dir, 'lib', pyver, 'site-packages')) def set_nativ_env(env): - pass + prereq_dir='/usr' + prereq_bin='/usr/bin' + prereq_inc='/usr/include' + try: + import distro + if any(distribution in distro.name().lower() for distribution in ["rocky", "centos", "fedora"]) : + prereq_dir='/usr/' + prereq_bin='/usr/bin' + prereq_inc='/usr/include' + elif any(distribution in distro.name().lower() for distribution in ["debian", "ubuntu"]) : + prereq_dir='/usr' + prereq_inc='/usr/include' + except: + import platform + if any(distribution in platform.linux_distribution()[0].lower() for distribution in ["rocky", "centos", "fedora"]) : + prereq_dir='/usr' + prereq_bin='/usr/bin' + prereq_inc='/usr/include' + + env.set('NLOPT_ROOT_DIR', prereq_dir) + env.set('NLOPT_INCLUDE_DIR', prereq_inc) + if prereq_bin != "/usr/bin": + env.prepend('PATH', prereq_bin) + env.prepend('LD_LIBRARY_PATH', os.path.join(prereq_dir,'lib')) diff --git a/products/nlopt.pyconf b/products/nlopt.pyconf index eb3ac1b..3567784 100644 --- a/products/nlopt.pyconf +++ b/products/nlopt.pyconf @@ -4,6 +4,13 @@ default : build_source : "script" compil_script : $name + $VARS.scriptExtension get_source : "archive" + system_info : + { + rpm : ["NLopt"] + rpm_dev : ["NLopt-devel"] + apt : ["libnlopt0","libnlopt-cxx0"] + apt_dev : ["libnlopt-dev","libnlopt-cxx-dev" ] + } environ : { env_script : $name + ".py" diff --git a/products/openturns.pyconf b/products/openturns.pyconf index 9d9fd6d..5983286 100644 --- a/products/openturns.pyconf +++ b/products/openturns.pyconf @@ -44,6 +44,38 @@ version_1_22 : opt_depend : ['pandas', 'statsmodels', 'patsy'] } +version_1_22_CO7 : +{ + compil_script : "openturns-1.22.sh" + patches : ['openturns-1.22.0001.patch'] + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib', 'cminpack', 'FMILibrary', 'PyFMI', 'boost'] + opt_depend : ['pandas', 'statsmodels', 'patsy'] +} + +version_1_22_CO7 : +{ + compil_script : "openturns-1.22.sh" + patches : ['openturns-1.22.0001.patch'] + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib', 'cminpack', 'FMILibrary', 'PyFMI', 'boost'] + opt_depend : ['pandas', 'statsmodels', 'patsy'] +} + +version_1_22_CO8 : +{ + compil_script : "openturns-1.22.sh" + patches : ['openturns-1.22.0001.patch'] + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib', 'cminpack', 'FMILibrary', 'PyFMI', 'boost'] + opt_depend : ['pandas', 'statsmodels', 'patsy'] +} + +version_1_22_DB09 : +{ + compil_script : "openturns-1.22.sh" + patches : ['openturns-1.22.0001.patch'] + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'matplotlib', 'cminpack', 'FMILibrary', 'PyFMI', 'boost'] + opt_depend : ['pandas', 'statsmodels', 'patsy'] +} + version_1_22_win : { name : "OT" diff --git a/products/patches/openturns-1.22.0001.patch b/products/patches/openturns-1.22.0001.patch new file mode 100644 index 0000000..087c47a --- /dev/null +++ b/products/patches/openturns-1.22.0001.patch @@ -0,0 +1,14 @@ +diff -Naur -Naur openturns/openturns-1.22/CMakeLists.txt openturns_dev/openturns-1.22/CMakeLists.txt +--- openturns/openturns-1.22/CMakeLists.txt 2024-04-03 11:52:49.000000000 +0000 ++++ openturns_dev/openturns-1.22/CMakeLists.txt 2024-04-05 08:17:28.143471039 +0000 +@@ -129,6 +129,10 @@ + find_package (LAPACK REQUIRED) + endif () + list (APPEND OPENTURNS_PRIVATE_LIBRARIES ${LAPACK_LIBRARIES}) ++IF (DEFINED CBLAS_LIBRARIES) ++ MESSAGE(STATUS "CBLAS_LIBRARIES is defined... adding to the list of libraries ${CBLAS_LIBRARIES}") ++ LIST (APPEND OPENTURNS_PRIVATE_LIBRARIES ${CBLAS_LIBRARIES}) ++ENDIF() + + if (USE_SPECTRA) + find_package (Spectra 1.0 CONFIG) -- 2.39.2