A datatype object has to be committed before it can be used in a communication. As an argument in datatype constructors, uncommitted and also committed datatypes can be used. There is no need to commit basic datatypes. They are ``pre-committed.''
MPI_TYPE_COMMIT(datatype) | |
INOUT datatype | datatype that is committed (handle) |
The commit operation commits the datatype, that is, the formal description of a communication buffer, not the content of that buffer. Thus, after a datatype has been committed, it can be repeatedly reused to communicate the changing content of a buffer or, indeed, the content of different buffers, with different starting addresses.
Advice
to implementors.
The system may ``compile'' at commit time an internal representation for the datatype that facilitates communication, e.g., change from a compacted representation to a flat representation of the datatype, and select the most convenient transfer mechanism.
The optimizations chosen during MPI_TYPE_COMMIT may no longer be optimal
if a session (or the World Model) is initialized or finalized.
( End of advice to implementors.)
MPI_TYPE_COMMIT
will accept a committed datatype;
in this case, it is equivalent to a no-op.
Example
The following code fragment gives examples of using
MPI_TYPE_COMMIT.
MPI_TYPE_FREE(datatype) | |
INOUT datatype | datatype that is freed (handle) |
Marks the datatype object associated with datatype for deallocation and sets datatype to MPI_DATATYPE_NULL. Any communication that is currently using this datatype will complete normally. Freeing a datatype does not affect any other datatype that was built from the freed datatype. The system behaves as if input datatype arguments to derived datatype constructors are passed by value.
Advice
to implementors.
The implementation may keep a reference count of active communications
that use the datatype, in order to decide when to free it.
Also, one may implement constructors of derived datatypes so that they keep
pointers to their datatype arguments, rather than copying them. In this
case, one needs to keep track of active datatype definition references in order
to know when a datatype object can be freed.
( End of advice to implementors.)