Just a few points :-
1) Lloyd said
> I am afraid this answer may not be very acceptable to users. It
> clearly makes it difficult to write portable code.
I disagree with this. It is *not* difficult to write portable code with
MPI when you know the datatypes you will be dealing with (and this
must represent 99.9% of codes).
The thing which *is* hard is to handle receiving and understanding
data whose data types you didn't know at compile time. But this is
clearly hard anyway, aside from MPI. (How do you know what to do with
the data if you don't even know what format it is in ?).
The places where this might arise seem to be where the code is
actually an interpreter for some higher level thing, which does
understand the semantics of the data. (So, for instance a SQL
interpreter doesn't have the format of the data compiled in, but
has a separate description of the data format, the semantics comes
from the user).
Such applications seem to me to be few, and (I certainly hope) will be
written by competent people, to whom the MPI issues will be but one
very small part of the problem.
It's actually not even clear that the functionality we're discussing
is needed for something like a SQL interpreter, since it must know
both the type signature and type layout that it requires at run time,
even if it didn't know them at compile time (because it already has a
way of handling SQL tables). Therefore it can always construct a
suitable MPI datatype.
2) Richard says
> You have described the functionality I desire in an
> Step 3 is performed by
> A. compute the total of bytes
> i. for each type requested
> a. compute the local size
> b. multiply by the count requested
> ii. add them up.
> B. allocate (malloc) space
> C. compute the offsets (actually, this can be done in A.ii)
> D. call MPI_Datatype and MPI_type_commit
> This function would return a pointer to the object (contiguous memory
> area). It's internal components can only be manipulated by MPI,
> but this is as desired.
This last sentence really confuses me. (And makes me think we're
talking at cross purposes).
If the data can only be manipulated by MPI, why are we bothering to
convert it all ? Why aren't we just using MPI_Packed ?
I believe there should be no problem in sending MPI_Packed data via a
third party (Post Office) who doesn't need to understand the contents
of the data. (An English speaking Post Office can happily handle
letters written in Chinese without understanding them, provided the
envelope is written in English).
If the data aren't "to be manipulated only by MPI" (What does this
mean ?!?), then Richard's scheme doesn't work, since it omits any
alignmnent constraints on the data types. As we discussed previously
the MPI library cannot, in general, know what these are and is
therefore incapable of laying data out correctly. In any case, if the
user wants to look at the data, she better know where it is !
BBN UK Ltd
Phone : +44 117 9071438