]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
[mpi4py] New CMake option MEDCOUPLING_MPI4PY_DIR to specify mpi4py installation for...
authorabn <adrien.bruneton@cea.fr>
Fri, 12 May 2023 13:10:52 +0000 (15:10 +0200)
committerabn <adrien.bruneton@cea.fr>
Fri, 12 May 2023 13:10:52 +0000 (15:10 +0200)
CMakeLists.txt
src/MEDCoupling_Swig/CMakeLists.txt
src/ParaMEDMEM_Swig/CMakeLists.txt
src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i
src/PyWrapping/CMakeLists.txt

index f130ad150c9a29b58633af258113af565d75a12f..181e98cb3f98d151bda11bf7a2ce0f85247096f7 100644 (file)
@@ -220,6 +220,14 @@ IF(MEDCOUPLING_ENABLE_PYTHON)
   IF(MEDCOUPLING_SWIG4_COMPAT)
     LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT")
   ENDIF()
+
+  # Possibility to specify a mpi4py installation
+  SET(MEDCOUPLING_MPI4PY_DIR "" CACHE PATH "Path to the mpi4py installation")
+  IF(MEDCOUPLING_MPI4PY_DIR)
+     MESSAGE(STATUS "Using mpi4py directory: ${MEDCOUPLING_MPI4PY_DIR}")
+     SET(MEDCOUPLING_MPI4PY_INCLUDE_DIR "${MEDCOUPLING_MPI4PY_DIR}/include")
+     SET(MEDCOUPLING_MPI4PY_I_FILE "${MEDCOUPLING_MPI4PY_DIR}/include/mpi4py/mpi4py.i")
+  ENDIF()
 ENDIF(MEDCOUPLING_ENABLE_PYTHON)
 
 IF(MEDCOUPLING_BUILD_DOC)
@@ -231,6 +239,7 @@ IF(MEDCOUPLING_BUILD_DOC)
   SALOME_LOG_OPTIONAL_PACKAGE(Sphinx MEDCOUPLING_BUILD_DOC)
 ENDIF(MEDCOUPLING_BUILD_DOC)
 
+
 # Detection report
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
index 125dda076ed3ee61f812049677ad1805cad49821..387a34a08bf834794e7f46271cf691eb0c3d9637 100644 (file)
@@ -37,7 +37,7 @@ ENDIF()
 SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
 IF(MEDCOUPLING_USE_64BIT_IDS)
   STRING(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
-ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+ENDIF()
 
 SET (MEDCoupling_SWIG_DPYS_FILES
     MEDCouplingCommon.i
index 47320923d5cba54972c064cec4f977660ba2986d..28a11ad5ef4891c7373ede50a65ffdffe22997b0 100644 (file)
@@ -36,6 +36,10 @@ SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS
 IF(MEDCOUPLING_USE_64BIT_IDS)
   STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
 ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+IF(MEDCOUPLING_MPI4PY_DIR)
+  INCLUDE_DIRECTORIES(${MEDCOUPLING_MPI4PY_INCLUDE_DIR})
+  STRING(APPEND SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ";-DMEDCOUPLING_MPI4PY_I_FILE=${MEDCOUPLING_MPI4PY_I_FILE}")
+ENDIF()
 
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIRS}
index 290da2a8a008e39bbe4787b4bec22efad6ced024..e8d1cf11401b1381d81dda34444e4381bb43699e 100644 (file)
 
 %template() std::set<int>;
 
+// Include mpi4py typemap if present:
+#ifdef MEDCOUPLING_MPI4PY_I_FILE
+%include MEDCOUPLING_MPI4PY_I_FILE
+%mpi4py_typemap(Comm, MPI_Comm);
+#endif
+
 %{
 #include "CommInterface.hxx"
 #include "ProcessorGroup.hxx"
index 5bf9f8181c7991d357afe35b5cc43657e768674b..94ab53ebd7d4dfe3905314bdbdad4dc05097c8e2 100644 (file)
@@ -36,6 +36,10 @@ SET(SWIG_MODULE_medcoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITION
 IF(MEDCOUPLING_USE_64BIT_IDS)
   STRING(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
 ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+IF(MEDCOUPLING_MPI4PY_DIR)
+  INCLUDE_DIRECTORIES(${MEDCOUPLING_MPI4PY_INCLUDE_DIR})
+  STRING(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS ";-DMEDCOUPLING_MPI4PY_I_FILE=${MEDCOUPLING_MPI4PY_I_FILE}")
+ENDIF()
 
 SET(medcoupling_SWIG_DPYS_FILES medcoupling.i)