Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost.MPI vs Boost.Asio

Good day!

What difference between these libraries?

I read MPI's docs and have small experience with asio. For me it's different implementations of network communication and no more.

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

When I should use one library or another? What I must to know for choosing right decision in each separate situation?

Yes, Asio is good for several nodes (and very generic framework in general), but why MPI is less better for such tasks? I don't think that dependency on MPI C library is restrictive or MPI is hard to understand and what about scalability? With Asio we can implement things like broadcasting and others and from another hand MPI doesn't forbid to write simple network applications. Is it conceptually difficult to rewrite Asio-specific logic with MPI if needed?

What about socket-like communications: if it's mandatory, we can encapsulate such one in module on Asio or any other framework and still use MPI for other communications.

For me sokets and MPI standart are different network services and it's not clear what is fundamental in real world, where distance from simple client-server pair to some medium computations is one step. Also I don't think that MPI has notable overhead in comparison with Asio.

Maybe it's bad question and all we need it's something like ICE (Internet Communications Engine)? Different languages support and again (as assures ZeroC) great performance.

And, of course, I never seen in any documentation topic like 'don't use this library for it!'.

I simply can't take such disunity: in one case it's sockets, in another - asynchronous messages and finally heavy middleware platform. Where is clarity in lifecycle of development? Maybe it's not fair question, but for starting to reduce this zoo we need some point.

like image 711
Iakov Minochkin Avatar asked Nov 06 '10 12:11

Iakov Minochkin


2 Answers

Each library solves different problems, they don't really overlap. It also depends 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 excels at collective operations: gather, scatter, broadcast, etc.

Use Boost.Asio for a socket abstraction layer if you only need a handful of nodes, such as a single server and some clients. I'd suggest using Boost.Asio if you aren't already using an MPI distribution in some fashion.

like image 152
Sam Miller Avatar answered Sep 29 '22 22:09

Sam Miller


I haven't used both of them, but Boost.ASIO is more an abstraction layer for networking on a low level, whereas Boost.MPI implements the MPI standard which let's you create distributed computing systems.

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

like image 20
Philipp Avatar answered Sep 29 '22 22:09

Philipp