From: Guytri KASTANE Date: Tue, 29 Oct 2024 11:53:04 +0000 (+0100) Subject: spns #43007: fix petsc with mpi compilation on Fedora and CentOS X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=83df95c1ed42e8a5568ab316ec9d5ba55f79c25f;p=tools%2Fsat_salome.git spns #43007: fix petsc with mpi compilation on Fedora and CentOS --- diff --git a/products/compil_scripts/petsc-3.16.0.sh b/products/compil_scripts/petsc-3.16.0.sh index 03ab48e..af44d55 100755 --- a/products/compil_scripts/petsc-3.16.0.sh +++ b/products/compil_scripts/petsc-3.16.0.sh @@ -44,12 +44,12 @@ then else CONFIGURE_FLAGS+=" --download-mpi4py=ext/mpi4py-3.0.3.tar.gz" fi - echo "*** configure --prefix=${PRODUCT_INSTALL} --with-mpi-dir=${MPI_ROOT_DIR} ${CONFIGURE_FLAGS}" - if [ "$SAT_openmpi_IS_NATIVE" == "1" ]; then + if [ "$SAT_openmpi_IS_NATIVE" == "1" ] && [[ "DB UB" =~ "$DIST_NAME" ]]; then CONFIGURE_FLAGS+=" --with-cc=${MPI_C_COMPILER}" CONFIGURE_FLAGS+=" --with-cxx=${MPI_CXX_COMPILER}" CONFIGURE_FLAGS+=" --with-fc=${MPI_FC_COMPILER}" fi + echo "*** configure --prefix=${PRODUCT_INSTALL} --with-mpi-dir=${MPI_ROOT_DIR} ${CONFIGURE_FLAGS}" ./configure --prefix=${PRODUCT_INSTALL} --with-mpi-dir=${MPI_ROOT_DIR} ${CONFIGURE_FLAGS} else echo "*** configure --prefix=${PRODUCT_INSTALL} --with-mpi=0 ${CONFIGURE_FLAGS}" diff --git a/products/env_scripts/mpi4py.py b/products/env_scripts/mpi4py.py index 3957a96..bf741d3 100644 --- a/products/env_scripts/mpi4py.py +++ b/products/env_scripts/mpi4py.py @@ -12,7 +12,20 @@ def set_env(env, prereq_dir, version): env.prepend("PYTHONPATH",os.path.join(prereq_dir, 'lib', 'python' + versionPython, 'site-packages')) def set_nativ_env(env): - import mpi4py - MPI4PY_ROOT_DIR=os.path.join('/',*mpi4py.__path__[0].split('/')[:-1]) - env.set("MPI4PY_ROOT_DIR", MPI4PY_ROOT_DIR) + try: + import distro + if any(distribution in distro.name().lower() for distribution in ["rocky", "centos", "fedora"]) : + import openmpi.mpi4py as mpi4py + MPI4PY_ROOT_DIR=os.path.join('/',*mpi4py.__path__[0].split('/')[:-1]) + env.set("MPI4PY_ROOT_DIR", MPI4PY_ROOT_DIR) + elif any(distribution in distro.name().lower() for distribution in ["debian", "ubuntu", "tuxedo os", "linux mint"]) : + import mpi4py + MPI4PY_ROOT_DIR=os.path.join('/',*mpi4py.__path__[0].split('/')[:-1]) + env.set("MPI4PY_ROOT_DIR", MPI4PY_ROOT_DIR) + except: + import platform + if any(distribution in platform.linux_distribution()[0].lower() for distribution in ["rocky", "centos", "fedora"]) : + import openmpi.mpi4py as mpi4py + MPI4PY_ROOT_DIR=os.path.join('/',*mpi4py.__path__[0].split('/')[:-1]) + env.set("MPI4PY_ROOT_DIR", MPI4PY_ROOT_DIR)