Message Length



next up previous contents
Next: Address Function Up: Use of Derived Previous: Type Matching

Message Length

If a message was received using a user-defined datatype, then a subsequent call to MPI_GET_COUNT(status, datatype, count) (Section gif) will return the number of ``copies'' of datatype received (count). That is, if the receive operation was MPI_RECV(buff, count,datatype,...) then MPI_GET_COUNT may return any integer value k , where 0 <= k <= count . If MPI_GET_COUNT returns k , then the number of primitive elements received is n*k , where n is the number of primitive elements in the type map of datatype. The received message need not fill an integral number of ``copies'' of datatype. If the number of primitive elements received is not a multiple of n , that is, if the receive operation has not received an integral number of datatype ``copies,'' then MPI_GET_COUNT returns the value MPI_UNDEFINED. MPI_UNDEFINED

The function MPI_GET_ELEMENTS below can be used to determine the number of primitive elements received.

MPI_GET_ELEMENT(status, datatype, count)

  IN     status         status of receive
  IN     datatype       datatype used by receive operation
  OUT    count          number of primitive elements received
MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)

MPI_GET_ELEMENTS(STATUS, DATATYPE, COUNT, IERROR)INTEGER STATUS(MPI_STATUS_SIZE), DATATYPE, COUNT, IERROR

The function MPI_GET_ELEMENTS can also be used after a probe to find the number of primitive datatype elements in the probed message. Note that the two functions MPI_GET_COUNT and MPI_GET_ELEMENTS return the same values when they are used with primitive datatypes.



Jack Dongarra
Fri Sep 1 06:16:55 EDT 1995