A datatype object has to be committed before it can be used in a communication. A committed datatype can still be used as a argument in datatype constructors. There is no need to commit basic datatypes. They are ``pre-committed.''
int MPI_Type_commit(MPI_Datatype *datatype)
MPI_TYPE_COMMIT(DATATYPE, IERROR)
INTEGER DATATYPE, IERROR
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.
int MPI_Type_free(MPI_Datatype *datatype)
MPI_TYPE_FREE(DATATYPE, IERROR)
INTEGER DATATYPE, IERROR
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. Derived datatypes that were defined from the freed datatype are not affected.
INTEGER type1, type2 CALL MPI_TYPE_CONTIGUOUS(5, MPI_REAL, type1, ierr) ! new type object created CALL MPI_TYPE_COMMIT(type1, ierr) ! now type1 can be used for communication type2 = type1 ! type2 can be used for communication ! (it is a handle to same object as type1) CALL MPI_TYPE_VECTOR(3, 5, 4, MPI_REAL, type1, ierr) ! new uncommitted type object created CALL MPI_TYPE_COMMIT(type1, ierr) ! now type1 can be used anew for communication
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.
MPI-Standard for MARMOT