Overview
Teaching: 10 min
Exercises: 0 minQuestions
What are the other important aspects of mpi4py?
Objectives
Learn about how mpi4py can handle different types of data.
When using the upper case version of the methods (Send
, Irecv
, Gather
, etc.) the data object must support the single-segment buffer interface.
This interface is a standard Python mechanism provided by some types (e.g., strings and numeric arrays), which is why we have been using NumPy
arrays in the examples.
It is also possible to transmit an arbitrary Python data type using the lower case version of the methods (send
, irecv
, gather
, etc.)
mpi4py will serialize the data type, send it to the remote process, then deserialize it back to the original data type (a process known as pickling
and unpickling). While this is simple, it also adds significant overhead to the MPI operation.
There are many other MPI operations available that we have not touched on here. Please refer to the mpi4py documentation for more information if you are interested.
Key Points
mpi4py provides different methods to handle buffer-like and generic objects.