MPI_TRUE_EXTENT

Dick Treumann (treumann@kgn.ibm.com)
Fri, 10 May 1996 09:37:07 -0400

Jim Cownie is correct about the information which must be returned
by MPI_TYPE_EXTENT. I had made a similar comment at the March
meeting. In my approach, I had suggested that MPI_TRUE_EXTENT
must return true extent and virtual origin. (Virtual origin is
the value calculated in Jim's example) As Jim says, the functions of
MPI1 which return LB and UB are unrelated to where data actually
begins and ends, if the datatype was created with MPI_UB or MPI_LB.
I still lean toward returning true_extent and virtual origin in a
function called MPI_TRUE_EXTENT but the two approaches give
exactly the same information.

One point that Jim makes is that a datatype containing actual
addresses is invalid for this function. I do see any reason for
the restriction. Absolute addresses are simply offsets from
MPI_BOTTOM and so the LB and UB values would tend to be large
(or in my version, the virtual origin would be a large negative number).
The true extent would still be (ub-lb) and a temp buffer could be
allocated and used.

An example with MPI_TRUE_EXTENT(dt,true_extent,virt_org) would be

MPI_True_extent(dt,&true_extent,&virt_org);
tempbuf = (char*) malloc(true_extent);
MPI_Recv(tempbuf+virt_org,.........);
... do whatever ....
free(tempbuf);

In the virtual origin approach, a datatype where true_lb is a
positive offset, virtual origin would be a negative number while
a datatype which had a negative true_lb would give a positive
virtual origin. 90% of datatypes (a guess) would return a
virtual origin of zero.

Dick Treumann