
Ian McCulloch wrote:
You need to construct an MPI 'datatype', which is conceptually a record of how the type is laid out as a sequence of (offset, nested_datatype) pairs.
...
The 'usual' way (if there is such a thing; datatypes seem to be not used much in MPI) of constructing datatypes is using offsetof(), or just knowing what the layout is for compiler X, and constructing the datatype by hand.
...
I don't know what mechanism Dave is thinking of to construct the datatype, it sounds unlikely that it could be done via a usual serialization function (but maybe if you could do member pointer arithmetic to replace offsetof() ?). I don't understand the restriction to PODs with no pointers though, as pointers are no problem - at least in principle - you just recursively follow the pointer when constructing the typemap. There is a difference though, as a datatype for an object without nested pointers has fixed offsets, whereas for a type containing pointers a new datatype needs to be constructed for each object that is serialized.
Sounds like a lot of work. But if one want's to use all this stuff - then what's the point of using the serialization library at all? I mean I can see using one or the other - but what is the point of both? Robert Ramey