Boost logo

Boost :

Subject: Re: [boost] [Boost-users] What's so cool about Boost.MPI?
From: Matthias Troyer (troyer_at_[hidden])
Date: 2010-11-06 06:37:36


On 5 Nov 2010, at 20:04, Riccardo Murri wrote:

> On Fri, Nov 5, 2010 at 3:51 PM, Peter Foelsche <foelsche_at_[hidden]> wrote:
>> Can somebody explain to me, what is so great about mpi or boost/mpi?
>
> Daunting task, but I'll give it a try :-)
>
> MPI is a library interface[1] to ease some common communication
> patterns in scientific/HPC software. In particular, MPI provides
> library functions for:
>
> 1. Reliable delivery of messages between two concurrent processes;
> there are functions for both synchronous and asynchronous
> communication.
>
> 2. Collective communication of the running processes: e.g., one
> process broadcasting a message to all others; all processes
> broadcasting to all; scattering a large array to all running
> processes, etc.
>
> 3. "Remote shared memory": a process can expose a memory buffer that
> all others can directly read/write.
>
> 4. Parallel I/O, where many processes access (possibly interleaved)
> portions of a file independently.
>
> Despite being non-trivial features to implement on top of a standard
> TCP socket interface, MPI implementations are mostly into performance:
> they can usually take advantage of special hardware (e.g., Infiniband
> or Myrinet interconnects) and use the native protocols (instead of
> TCP/IP) to provide faster communication speed.
>
> A "message" in usual socket programming is just a flat array of bytes.
> A "message" in MPI is a (potentially non-contiguous portion) of a C or
> FORTRAN data structure; MPI can handle C structures and
> multi-dimensional C-style arrays, and multi-dimensional arrays of C
> structures (containing multi-dimensional arrays, etc.). However,
> since MPI is implemented as a library, you have to tdescribe to MPI
> the in-memory layout of the data structures you want to send as a
> message; thus "duplicating" work that is done by the compiler. You
> can imagine that this quickly gets tedious and unwieldy once you start
> having non-trivial data structures, possibly with members of unknown
> length (e.g., a list).
>
> This is where Boost.MPI comes to the rescue: if you can provide
> Boost.Serialization support for your classes, you can send them as MPI
> messages with no extra effort: no need for lengthy calls to
> MPI_Type_create_struct() etc. And it does this with minimal or even
> no overhead! (Plus you also get a nice C++ interface to MPI
> functionality, whereas the MPI C calls are quite low-level.)
>
>
> .. [1] MPI proper is a specification; there are several
> implementations of the spec (e.g., OpenMPI, MPICH, MVAPICH, plus
> many vendor/proprietary one), but they are all compatible at the
> source level.
>
> Best regards,
> Riccardo

Nice summary!

Matthias


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk