What does it mean that "C++ MPI bindings are no longer part of the standard"?

I genuinely do not know what that means. What are "bindings"?

I've been working on a large computational physics program for several years now in C++. It uses MPI and it seems to work just fine. However I've been told (and read online) several times: "Uh oh, watch out! The C++ bindings are deprecated."

What does that mean? Does it mean you can no longer use MPI in C++ programs, and that I must re-write my project in plain C?

Thanks!

Edited to add:

"MPI" is Message Passing Interface, by the way, a library for performing parallel calculations on multiple processors.

Posted Sep 9, 2020, 4:37 PM UTC · edited

810
maxximillian•

I could be completely off on this but here is my attemptm. The software library youre using may be written in say Java but not everyone uses Java or they have existing code in C++. So the people that write the library made bindings in the library for C++. it lets you use access functionality of the library that may be written in Java with normal c++ code.

opencv comes to mind. I like using python but opencv is written natively in c++, but thanks to the python bindings I can use the library without calling thier c++ functions and just use python. but if something crashes I'll likely see a c++ stack trace.

so in this case if the bindings are deprecated that means that they might not be keeping them up to date with further releases or that they keep gut go away. its basically saying hey maybe don't count on this in the future

2
KnowsAboutMathOP•

The software library youre using may be written in say Java

Well, there's a header file (mpi.h) which I include that is clearly written in plain C, for whatever that's worth.

So the people that write the library made bindings in the library for C++.

What are bindings?

1
maxximillian•

basically an interface that software written in language X provides so programmers using language Y can use the library without having to do any code in language X

2
KnowsAboutMathOP•

OK, so a binding is like a wrapper function that provides a Y-like interface for an X function.

Since C is a subset of C++ I suppose I should be able to use the C bindings in a C++ program. How can I tell if I'm currently using the "C bindings" or the "C++ bindings"? I've searched and searched but all I can find are discussions about how the C++ bindings are deprecated, but nowhere does it say what the C/C++ bindings are.

1
BeezDragon•

Technically they are different languages, there's just a whole bunch of overlap. There's some C functionality that was added after C++ was defined and was never rolled in... but it is something kinda niche, I forget what it is.

Unfortunately the status-quo is to blend the languages, so somebody might have hidden the difference and added interoperability. For example, one of the mpi.h headers on my system contains the lines:

#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif

followed by, for example, a bunch of typedefs. So, it is saying to the C++ compiler that this helps define a C interface.

It also has a block near the bottom that includes a "mpicxx.h" if certain conditions are met. I don't use C++ so I'm not sure how to drill down any farther than that. I'm guessing that's where the C++ bindings live.

It looks like the C++ bindings were actually removed in 3, not just deprecated. Of course, any particular implementation can go and add extra functionality, and adding functionality like this to help with backwards compatibility is pretty common.

If you are on a Linux system, you should be able to type "locate mpi.h" to see where your mpi header lives, and then open it up and peek around.

1
BeezDragon•

Bindings are how you access functionality in one language from another. Just think of them as wrappers in this context.

The languages that are officially supported by MPI are defined in the standard. It looks like in MPI-2 they briefly decided to explicitly support C++. By MPI-3, I guess they decided it wasn't worth the effort.

It looks like they ported the MPI forums over to github, so here's the thread about it:

https://github.com/mpi-forum/mpi-forum-historic/issues/150

Takaways:

  • Not many people used the C++ bindings.

  • The C bindings can be called from C++ anyway. They didn't go all-in on C++ features, so you should be able to port your C++ MPI calls to C pretty easily.

  • If you want object oriented stuff in your MPI, boost.MPI exists and does a better job than they did at C++ifying the whole thing.

2
KnowsAboutMathOP•

Thanks for your response.

I guess I'm still confused about my main question: How can I tell if I am currently using the C++ bindings or the C bindings? What exactly are the C++/C bindings? What are some examples of MPI stuff that would actually be written in code for the C bindings vs. for the C++ bindings? This is the thing I haven't been able to find an answer to.

1
[deleted]•

[deleted]

1
KnowsAboutMathOP•

What's in an additional library?

1