[Mpi-forum] C++ types inaccessible after #281

Jeff Squyres jsquyres at cisco.com
Wed Jun 27 15:10:20 CDT 2012


On Jun 27, 2012, at 3:59 PM, N.M. Maclaren wrote:

> Yes, this is an ungodly mess.  I don't agree with the forum's decision,
> but let's accept it.  The only reasonable approach is the one of having
> MPI types for C++'s types, which could still be used via the C interface
> from a C++ compiler.  I believe that is what you were referring to, and
> what is intended.


Thanks for the excellent summary.

Don't forget a few points:

- As Jim pointed out, all MPI datatypes are supposed to be available in all language bindings.  Hence, if we have (for example) MPI_CXX_COMPLEX, it needs to be available in both C and the various Fortran bindings.

- This is not as wonky as it sounds; you may have a C++ MPI process send an MPI_CXX_COMPLEX to a Fortran MPI process who simply receives that message into a buffer and doesn't try to interpret it.  The Fortran MPI process could then send that same MPI_CXX_COMPLEX process back to a C++ MPI process later, who could then rightfully interpret it properly (this example can be made for any language-specific type, actually).

- From an MPI implementation's perspective, we don't have to worry too much about the behavior and semantics of a given type -- we mainly only have to worry about the byte layout in memory.  Hence, getting the size of a given type (and sometimes its alignment) is all that is necessary for a C-based MPI implementation to be able to properly pack/unpack/send/receive MPI_CXX_COMPLEX.  (right?)

- That being said, handling reductions on MPI_CXX_COMPLEX from C-based MPI implementations may be a little problematic if the types are not equivalent between C and C++, for example...

-- 
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/





More information about the mpi-forum mailing list