15
$\begingroup$

The thing I dislike most about MPI is dealing with datatypes (i.e. data maps/masks) because they don't fit that nicely with object oriented C++. boost::mpi only supports MPI 1.1, however, from their website:

boost::mpi is a C++ friendly interface to the standard Message Passing Interface… Boost.MPI can build MPI data types for user-defined types using the Boost.Serialization library

Has anyone had any experience with boost::mpi for serious scientific computing? Would you recommend it? Did you had any issues (scaling problems, compiler problems, errors, not implemented features, the need for some mpi 2.2 features)?

Can you comment on using boost::mpi instead of using the MPI C implementation from C++? Can you combine both (use boost::mpi when you can, C-MPI elsewhere)?

Do you know of any large scientific code using boost::mpi ?

$\endgroup$
  • $\begingroup$ You should also look at this page boost.org/doc/libs/1_50_0/doc/html/mpi/… in order to be sure that all functions that you need are supported. The possibility to implement them yourself should also be considered. $\endgroup$ – Alexander Aug 9 '12 at 9:24
  • $\begingroup$ The best reason I can think of to use Boost::MPI is that it supports serialization of C++ types automatically. The MPI C interface cannot do this on its own and you would have to create MPI datatypes for all of your C++ objects in order to pass them via Send/Recv, etc., unless you want to do your own serialization by some other means. $\endgroup$ – Jeff Mar 17 '13 at 1:32
  • $\begingroup$ The Elemental (libelemental.org) MPI interface (github.com/elemental/Elemental/blob/master/src/core/imports/…) does automatic type detection in an elegant way. However, it does not attempt to do many of the things that Boost::MPI does. $\endgroup$ – Jeff Sep 19 '14 at 5:14
11
$\begingroup$

I have always thought that we should use it in our own project, deal.II, because it is higher level than pure MPI and can save a few lines of code here and there. That said, what I learned over the years is that most high-level code doesn't actually have that much MPI code to begin with -- the 600,000 lines of code in deal.II have only ~50 calls to MPI. That's certainly much much less than a package such as PETSc, but I think it's nevertheless true that most code has fewer MPI codes than one would expect at first and that, consequently, the benefit of using something that's higher level is not as great as one may think at first glance.

What this then boils down to is for you to consider what the trade-offs are. How much MPI will you need to use, and how does that compare to the additional effort required to build and link with an external library.

$\endgroup$
6
$\begingroup$

As far as I know, boost::mpi is just a c++ wrapper around the C API. As such, you should be able to use boost::mpi and switch to the C API whenever some functionality is not implemented. Indeed, from their webpage:

The thin abstractions in Boost.MPI allow one to easily combine it with calls to the underlying C MPI library.

I have not used it myself, and do not know of a major library that does, but I'd expect it to be just a lightweight wrapper and as such one should not worry about the performance compared to C API.

$\endgroup$
  • 2
    $\begingroup$ Boost::MPI is a wrapper around a subset of MPI; as I recall, it supports only MPI 1.2, which is a far cry from the MPI-2.2 or MPI-3 standards in my respects. $\endgroup$ – Jeff Mar 17 '13 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.