[Mpi-forum] C++ types inaccessible after #281
Marc Snir
snir at mcs.anl.gov
Wed Jun 27 16:04:55 CDT 2012
The standard does not say much about datatypes that do not correspond to primitive datatypes of the host language. I would suggest that is we define an MPI_Complex type for a language that that does not have a primitive complex, then the implementation will decide how it defines a complex (e.g., two successive doubles) and perform reductions accordingly. A good quality implementation will make C++/C interaction easier.
On Jun 27, 2012, at 3:10 PM, Jeff Squyres wrote:
> 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/
>
>
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
More information about the mpi-forum
mailing list