Skip to content

Clarify restrictions on heterogeneous derived datatypes #328

Open
@hzhou

Description

@hzhou

Problem

It is not clear from the current text whether a heterogeneous datatype has restrictions, such as whether its displacements have to be multiple of the element size, or just multiple of alignment, or maybe it can be arbitrary. From implementation point of view, we certainly like some restrictions. For example, if we can assume displacements of multiple element size, then we can directly calculate element address, reaching optimum performance. Otherwise, we will be forced to add branches and worst, make temporary copies.

For example, can we MPI_TYPE_CREATE_HINDEXED_BLOCK(4, 1, {0, 20, 40, 60}, MPI_LONG_DOUBLE, &new_type)? Note that on typical 32-bit system, sizeof(long double) = 12 and alignof(long double) = 4.

Without restrictions, it seems even a displacement of {1, 21, 41, 61} should be allowed.

We internally had a debate and is currently having opposing views. We would like forum to clarify and give us a verdict.

Proposal

Clarify the text in MPI_TYPE_CREATE_HINDEXED, MPI_TYPE_CREATE_HINDEXED_BLOCK, MPI_TYPE_CREATE_HVECTOR, and MPI_TYPE_CREATE_STRUCT on any restrictions (or lack of) on the parameters. Add rationales if there is potential for controversy.

Changes to the Text

See Proposal

Impact on Implementations

Opportunity for better performances.

Impact on Users

For applications of basic datatype that sizeof(type) == alignof(type) and all user buffers are observing correct alignment, no impact. For applications exploiting mis-aligned data, they need be fixed. If we require displacement always be multiple of basic element size, some "legitimate" use cases may need work around.

References

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    chap-datatypesDatatypes Chapter Committeempi-6For inclusion in the MPI 5.1 or 6.0 standard

    Type

    No type

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions