Salome HOME
Doc: indicating how to pass MPI_Comm from mpi4py V9_11_0a1 V9_11_0a2
authorabn <adrien.bruneton@cea.fr>
Tue, 25 Apr 2023 19:23:08 +0000 (21:23 +0200)
committerabn <adrien.bruneton@cea.fr>
Tue, 25 Apr 2023 19:23:08 +0000 (21:23 +0200)
doc/developer/doxygen/doxfiles/reference/cpp/cpp.dox
doc/developer/doxygen/doxfiles/reference/misc/misc.dox
doc/developer/doxygen/doxfiles/reference/misc/swig_mpi.dox [new file with mode: 0644]

index 3b2e87c4502fe01f1c7733dbca3c20be259a6045..ef1d78da09c427eb71593df667bfcb3fd5513a77 100644 (file)
@@ -21,5 +21,8 @@ data or not.
 For advanced usage, one has to be aware of the stamping mechanism used internally to know
 whether an instance has been modified or not. This is described in the second page above:
  \ref MEDCouplingTimeLabelPage
+
+If your interested into wrapping your C++ code to Python with SWIG and intend to do this in a parallel context
+you might also want to check \ref swig_mpi.
   
   */
index 529c6fce28844960976d8d3afdee09effdf5d3fd..4532356779becf50e9b42ef9e6d8442eb7368d9a 100644 (file)
@@ -7,6 +7,6 @@ anywhere else in the documentation.
 - \subpage tools
 - \subpage icoco
 - \subpage MEDCouplingFieldTemplatesPage
-
+- \subpage swig_mpi
 
 */
diff --git a/doc/developer/doxygen/doxfiles/reference/misc/swig_mpi.dox b/doc/developer/doxygen/doxfiles/reference/misc/swig_mpi.dox
new file mode 100644 (file)
index 0000000..8400433
--- /dev/null
@@ -0,0 +1,24 @@
+/*!
+
+\page swig_mpi Passing a MPI communicator to a SWIG-ed interface
+
+This is not directly linked to MEDCoupling, but the following issue often
+arises when wrapping a C++ code to Python using the SWIG tool (for example, to be able
+to couple two codes in Python).
+
+If you want to be able to pass a communicator defined on the Python side (typically with the
+Python module mpi4py) to your C++ code (which you have wrapped with SWIG), the following
+magic lines need to be inserted into your ".i" file for this to work correctly:
+
+\code{.cpp}
+%include /usr/lib/python3/dist-packages/mpi4py/include/mpi4py/mpi4py.i
+%mpi4py_typemap(Comm, MPI_Comm);
+
+....
+void method_taking_a_MPI_Comm(MPI_Comm mpicomm);
+...
+\endcode
+
+where the path to mpi4py.i needs to be adapted to your configuration.
+
+*/