MPI Data type accessors -- proposal

David Taylor (taylor@Think.COM)
Thu, 20 Jul 95 20:00:00 EDT

There are useful packages that could be implemented to "supplement" or
"fill out" MPI which currently require access to internals of the MPI
implementation.

This proposal attempts to specify some of the MPI interfaces needed to
implement a portable version of the MPI-IO draft 0.3 specification.

There are three sets of additional MPI interfaces needed to implement an
MPI-IO which is independent of any specific implementation of MPI:

. those needed to do any I/O -- e.g., access to type maps
. those needed for efficiency -- e.g. knowing when a type is free'd
. those needed for 'immediate' i/o (the 'i' calls in MPI-IO)

The following proposed additions to MPI attempt to address the first two
of the three categories above.

[I believe that Section 3.7 "April Proposal of Steve Huss-Lederman" of
the June 8, 1995 draft of "MPI-2: Extensions to the Message-Passing
Interface" provides the functionality needed for the third category
above.]

MPI Data type accessors:
========================
MPI_Type_count(MPI_Datatype datatype, /* IN */
int *count) /* OUT */

Returns the number of entries in the datatype.
[i.e., as per MPI spec 1.0 except for the deletion of the words
"top-level".]

Whether this function returns the number of "top-level" entries or
"bottom-level" entries is implementation dependent. However, it
must be the same as for MPI_Type_elements (below).

int
MPI_Type_elements(MPI_Datatype datatype, /* IN */
int count, /* IN */
int *array_of_blocklengths, /* OUT */
MPI_Aint *array_of_displacements, /* OUT */
MPI_Datatype *array_of_types) /* OUT */

Given an MPI_Datatype 'datatype', returns the first 'count'
block lengths, displacements, and types that make it up. The
return value is the number of items filled in (<= count).

For each fundamental type, the type itself is returned.

Whether this function returns information about the "top-level"
entries or "bottom-level" entries is implementation dependent.
However, it must be same as for MPI_Type_count (above).

The intent here is to allow you to use the 'count' returned by
MPI_Type_count when malloc'ing the array to pass to MPI_Type_elements.

Whether you are done decomposing 'datatype' after one call to
MPI_Type_elements or you have to iterate to get to the fundamental types
is implementation dependent -- thus a correct program must iterate until
nothing is left except fundamental types.

MPI_Type_free Handler:
======================

Additionally, for efficiency, we need a way of knowing during an
i/o call whether a datatype with the same value as was presented
earlier is in fact the same datatype as is being presented now.
We would also like to know when we can throw away the cached
information.

typedef void (MPI_Type_handler_function)(MPI_Datatype);

int
MPI_Type_free_handler(MPI_Type_handler_function *function) /* IN */

Registers the user routine 'function' to be called whenever an MPI data
type is freed. Thus if a package caches information about a type, it
can know when the information is outdated.

[Other methods of storing and retrieving the information, such as the
Proposal for Datatype and Request Caching by doss@ERC.MsState.Edu would
also work.]