Boost.MPI vs Boost.Asio

Good day!

What is the difference between these libraries?

I read MPI documents and have little experience with asio. For me, these are different implementations of network communication and no more.

But each of them introduces different abstractions (I'm not sure about the same level of these abstractions), which leads to a different application design.

When should I use one library or another? What should I know to choose the right decision in each individual situation?

Yes, Asio is good for several nodes (and generally general frameworks in general), but why is MPI less suitable for such tasks? I don’t think that the dependency on the MPI C library is restrictive or is MPI hard to understand and what is scalability? With Asio, we can implement such things as translation, and others, and on the other hand MPI does not prohibit writing simple network applications. Is it conceptually difficult to rewrite Asio dependency logic with MPI if necessary?

What about socket-like communications: if necessary, we can encapsulate such a module into a module on Asio or any other infrastructure and still use MPI for other communications.

For me, the socket and the MPI standard are different network services, and it is not clear what is fundamental in the real world, where there is one step from the distance from a simple client-server pair to some average computing. Also, I don't think MPI has any noticeable overhead compared to Asio.

Maybe this is a bad question, and all we need is something like ICE (Internet Communications Engine)? Various languages ​​support and again (as ZeroC assures) excellent performance.

And, of course, I have never seen any documentation, for example, "do not use this library for it!".

I just can’t take such disunity: in one case these are sockets, in the other - asynchronous messages and, finally, a heavy middleware platform. Where is clarity in the development life cycle? Maybe this is not a fair question, but in order to begin to reduce this zoo, we need a certain point.

+7
boost boost-asio boost-mpi
source share
2 answers

Each library solves different problems, they actually do not overlap. It also depends on what you are trying to solve, and the communication patterns of your application. Use Boost.MPI for scalability, such as scaling to thousands or tens of thousands of nodes. Depending on the underlying network architecture, MPI also stands out in collective operations: collection, scatter, broadcast, etc.

Use Boost.Asio for the socket abstraction layer if you need only a few nodes, such as one server and some clients. I would suggest using Boost.Asio if you are not already using the MPI distribution.

+5
source share

I did not use both of them, but Boost.ASIO is a more abstraction layer for organizing work at a low level, while Boost.MPI implements the MPI standard, which allows you to create distributed computing systems.

So, if you need some, say, socket-like messages, I would go with ASIO. If you want to do distributed computing and maybe even interact with MPI programs written in other languages ​​/ for other platforms, go to Boost.MPI.

+3
source share

All Articles