I am planning to use pure C MPI library in C++ application, I don't want to add unnecessary bloat by running eg. Boost MPI layer that wraps all stuff in the MPI::<func>
classes.
Is there anything I should be aware of?
I am planning to use pure C MPI library in C++ application, I don't want to add unnecessary bloat by running eg. Boost MPI layer that wraps all stuff in the MPI::<func>
classes.
Is there anything I should be aware of?
You should wrap all your includes for C-headers in an extern "C"
block in order to avoid problems with the name mangling of C++ compilers.
extern "C" {
// include C-headers
}
Read more here.
Not really, as most libraries are prepared to be included in a C++ compiler (if not, you can do as Space Cowboy above suggests). However, I would advice you (if you don't mind) on reconsidering boost MPI. It doesn't add unnecessary bloat, and gives you a more comprehensive interface to MPI in an object-oriented environment. It adds more semantics to types being transferred via MPI, and even gives you more "functional" operators, such as using functors for the calculation operations (e.g. reduce
), etc. The ammount of code they add is negligible, and most of the time, there is no run-time overhead, as abstractions are implemented via template metaprogramming.