user787267
user787267

Reputation: 3010

Using C MPI syntax in a C++ application

I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the code (or rewrite it in a cleaner C++ way) into my new program. Since the C++ interface to MPI is being deprecated (and it is much harder to find documentation), I am seriously considering using the C interface to MPI in my C++ application. Is it a god idea to mix the C MPI interface with a C++ MPI application, or do I really need to learn to use Boost?

Upvotes: 3

Views: 1851

Answers (1)

Stack Overflow is garbage
Stack Overflow is garbage

Reputation: 248269

There is no harm in using a C API from a C++ application. Many popular APIs are written in C (the Windows API comes to mind as an example. Or POSIX. Or SQLite, zlib, Python or dozens and dozens of others).

So if that seems like the most convenient solution, go ahead and use the C API. It should be fairly easy to write some thin rappers to C++'ify it a bit yourself.

But apart from this, it is always a good idea for a C++ developer to learn and use Boost. Since Boost has a MPI library, it may, at the very least, be worth checking it out.

And in the end, go with what seems easiest to use for you, in your situation.

Upvotes: 5

Related Questions