On 6 July 2014 10:36, Sébastien Brisard <
sebastie...@gmail.com> wrote:
>
> Thanks for the suggestion. I didn't now about uppercase versions of
> Gather(). Not sure about the differences between the two, I might need to
> get back to you ;-). I'll make sure to test your solution by the end of the
> day, and keep you posted.
>
See here for a executive description (and some examples) on the
difference between the lower/uppercase versions
https://pythonhosted.org/mpi4py/usrman/tutorial.html
In short, the lower-case methods use pickle under the hood to
serialize/deserialize Python objects. This is good because of its
generality and simplicity, but you also have to pay for the pickle
overhead. The upper-case methods are almost direct calls to MPI,
communicating the memory buffer of array-like objects, so you have no
other overhead than the usual Python function call. Using the
upper-case version is slightly more involved (e.g, you need to
preallocate arrays to receive messages), but at the same time its
usage is more similar to how you would use MPI from C/C++/Fortran.
>>
>> Eventually, for
>> messages with more of 2GB entries, you will need to split the
>> communication in two successive calls. Other approach is to employ
>> user defined datatypes (MPI.Datatype.Create_contiguous()) and use
>> these datatypes to perform the Gather() calls.
>
>
> That's a very interesting suggestion. mpy4py seems to be very rich in useful
> functionalities. What would you suggest to discover them all (appart from
> reading the sources...).
>
Well, mpi4py supports almost all of MPI, and follows closely the MPI-2
C++ bindings. So if you look at the MPI standard itself or any other
book/tutorial about MPI, you should easily find the corresponding
functionality in mpi4py. For example, I mentioned
MPI.Datatype.Create_contiguous(), that's the Python version of the
C/Fortran call MPI_Type_contiguous() (the MPI-2 C++ bindings, it is
MPI::Datatype::Create_contiguous()). And of course, you can ask here
any time.