Subject: Re: [Boost-mpi] Questions regarding MPI C++ bindings
From: Matthias Troyer (troyer_at_[hidden])
Date: 2012-11-26 09:27:03
On Nov 26, 2012, at 9:03 AM, Alain O Miniussi <alain.miniussi_at_oca.eu> wrote:
> Boost MPI is based on MPI C-bindings and does not use the C++ MPI
> binding at all (and those are going to be deprecated in MPI-3).
> Yet, on the platforms I use (and I guess on most platform) Boost MPI is
> likely to bring in a binary dependency on the MPI C++ binding/libraries.
> There are multiple reason for that, but eventually, if I consider, for
> example, Open MPI, the mpi.h header will detect that a C++ compiler is
> being used and will bring in the C++ headers. I suspect most
> implementations do the same.
> This bring an unnecessary dependency on the end user, who will need to
> link against an unused, maybe uninstalled, library. But removing it is
> unlikely to be trivial.
> Open MPI has a implementation specific flag to avoid that
> (OMPI_SKIP_MPICXX) but it is not easy (did a few tries) to pass it
> through the bjam configuration (it look like the "using mpi ... ;
> instruction allows you to specify the mpicxx command, or the
> compilations flags, but not both).
> One quick and dirty solution would be to put something along the lines
> #if defined(OPEN_MPI)
> #define OMPI_SKIP_MPICXX
> at the top of config.hpp (and extends with all possibles implementation
> specific flags) but that would be likely to prevent people to mix
> Boost.MPI and C++ MPI. Although that's the way MPI is aiming, it could
> be considered a little bit harsh for legacy code ?
> Or maybe we could use the same trick, but only for non header files ?
> Also, is it a problem that we should try to address, or should we
> consider it is an MPI implementation issue ?
> Also, that is the rationale for configuring Boost MPI out of mpi[CC|c++|
> cxx] instead of mpicc, since tha's the API that is used ?
> Best regards
You are raising a good point here and one reason for pushing Boost.MPI development again is the deprecation of the official C++ bindings. The motivation for configuring Boost.MPI out of out of mpi[CC|c++|cxx] was to allow users to mix and match Boost.MPI with the MPI C++ bindings. I myself don't use the C++ bindings and would thus be happy to just define OMPI_SKIP_MPICXX, but as you said there might be legacy code around that uses the C++ bindings.
Is the dependency on the OpenMPI C++ library really a problem for you? Have you tried building OpenMPI without C++ support (--disable-mpi-cxx). Does that solve your problem?
If not the cleanest solution might be to add an option to the ""using mpi ..." bjam command that enables or disables the C++ bindings. I have to admit that I'm not an expert in Boost.Build though. That part was done by Doug Gregor. Do we have a Boost.Build expert here or shall I try to find someone to help us?
Boost-Commit list run by troyer at boostpro.com