]> SALOME platform Git repositories - tools/sat_salome.git/commitdiff
Salome HOME
spns #43007: fix petsc with mpi compilation on Fedora and CentOS
authorGuytri KASTANE <guytri.kastane@cea.fr>
Tue, 29 Oct 2024 11:53:04 +0000 (12:53 +0100)
committerGuytri KASTANE <guytri.kastane@cea.fr>
Tue, 29 Oct 2024 11:53:04 +0000 (12:53 +0100)
products/compil_scripts/petsc-3.16.0.sh
products/env_scripts/mpi4py.py

index 03ab48e58b7a3026cdf7eb42da2152e585bdcafb..af44d559e23cbdedc667ef6fd8981464c6719948 100755 (executable)
@@ -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}"
index 3957a96310238f45661e2d2e7487ce01870ce95e..bf741d3a7713b12d34052bab7acb00872d6de62e 100644 (file)
@@ -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)