Point-to-point communication

Types

MPI.RequestType
MPI.Request

An MPI Request object, representing a non-blocking communication. This also contains a reference to the buffer used in the communication to ensure it isn't garbage-collected during communication.

The status of a Request can be checked by the Wait! and Test! functions or their multiple-request variants, which will deallocate the request once it is determined to be complete. Alternatively, it will be deallocated at finalization, meaning that it is safe to ignore the request objects if the status of the communication can be checked by other means.

See also Cancel!.

source
MPI.StatusType
MPI.Status

The status of an MPI receive communication. It has 3 accessible fields

  • source: source of the received message
  • tag: tag of the received message
  • error: error code. This is only set if a function returns multiple statuses.

Additionally, the accessor function MPI.Get_count can be used to determine the number of entries received.

source

Functions

Accessor

MPI.Get_countFunction
MPI.Get_count(status::Status, T)

The number of entries received. T should match the argument provided by the receive call that set the status variable.

If the number of entries received exceeds the limits of the count parameter, then it returns MPI_UNDEFINED.

External links

source

Blocking

MPI.SendFunction
Send(buf, [count::Integer, [datatype::Datatype,]]
     dest::Integer, tag::Integer, comm::Comm) where T

Perform a blocking send of count elements of type datatype from buf to MPI rank dest of communicator comm using the message tag tag

If not provided, datatype and count are derived from the element type and length of buf, respectively.

External links

source
Send(obj::T, dest::Integer, tag::Integer, comm::Comm) where T

Complete a blocking send of obj to MPI rank dest of communicator comm using with the message tag tag.

source
MPI.Recv!Function
Recv!(buf, [count::Integer, [datatype::Datatype,]]
      src::Integer, tag::Integer, comm::Comm)

Completes a blocking receive of up to count elements of type datatype into buf from MPI rank src of communicator comm using with the message tag tag

If not provided, datatype and count are derived from the element type and length of buf, respectively.

Returns the Status of the receive.

External links

source
MPI.Sendrecv!Function
Sendrecv!(sendbuf, [sendcount::Integer, [sendtype::Union{Datatype, MPI_Datatype}]],
         dest::Integer, sendtag::Integer,
         recvbuf, [recvcount::Integer, [recvtype::Union{Datatype, MPI_Datatype}]],
         source::Integer, recvtag::Integer,
         comm::Comm)

Complete a blocking send-receive operation over the MPI communicator comm. Send sendcount elements of type sendtype from sendbuf to the MPI rank dest using message tag tag, and receive recvcount elements of type recvtype from MPI rank source into the buffer recvbuf using message tag tag. Return a Status object.

If not provided, sendtype/recvtype and sendcount/recvcount are derived from the element type and length of sendbuf/recvbuf, respectively.

External links

source

Non-blocking

MPI.IsendFunction
Isend(buf, [count::Integer, [datatype::Datatype,]]
      dest::Integer, tag::Integer, comm::Comm)

Starts a nonblocking send of count elements of type datatype from buf to MPI rank dest of communicator comm using with the message tag tag

If not provided, datatype and count are derived from the element type and length of buf, respectively.

Returns the Request object for the nonblocking send.

External links

source
Isend(obj::T, dest::Integer, tag::Integer, comm::Comm) where T

Starts a nonblocking send of obj to MPI rank dest of communicator comm using with the message tag tag.

Returns the commication Request for the nonblocking send.

source
MPI.Irecv!Function
Irecv!(buf, [count::Integer, [datatype::Datatype,]]
       src::Integer, tag::Integer, comm::Comm) where T

Starts a nonblocking receive of up to count elements of type datatype into buf from MPI rank src of communicator comm using with the message tag tag

Returns the Request for the nonblocking receive.

External links

source
MPI.Test!Function
(flag, status) = Test!(req::Request)

Check if the request req is complete. If so, the request is deallocated and flag is returned true and status as the Status of the request. Otherwise flag is returned false and status is nothing.

External links

source
MPI.Testall!Function
(flag, statuses) = Testall!(reqs::Vector{Request})

Check if all active requests in the array reqs are complete. If so, the requests are deallocated and flag is returned as true and statuses is an array of the Status objects corresponding to each request is returned. Otherwise no requests are modified a tuple of false, nothing is returned.

External links

source
MPI.Testany!Function
(flag, index, status) = Testany!(reqs::Vector{Request})

Check if any one of the requests in the array reqs is complete.

If one or more requests are complete, then one is chosen arbitrarily, deallocated and flag is returned as true, along with the index and the Status of the request.

Otherwise, if there are no complete requests, then index is returned as 0, status as nothing, and flag as true if there are no active requests and false otherwise.

External links

source
MPI.Testsome!Function
(indices, statuses) = Testsome!(reqs::Vector{Request})

Similar to Waitsome! except that it returns immediately: if no operations have completed then indices and statuses will be empty.

External links

source
MPI.Wait!Function
status = Wait!(req::Request)

Block until the request req is complete and deallocated. Returns the Status of the request.

External links

source
MPI.Waitall!Function
statuses = Waitall!(reqs::Vector{Request})

Block until all active requests in the array reqs are complete. Returns an array of the Status objects corresponding to each request.

External links

source
MPI.Waitany!Function
(index, status) = Waitany!(reqs::Vector{Request})

Blocks until one of the requests in the array reqs is complete: if more than one is complete, one is chosen arbitrarily. The request is deallocated and a tuple of the index of the completed request and its Status is returned. If there are no active requests, then index is returned as 0.

External links

source
MPI.Waitsome!Function
(indices, statuses) = Waitsome!(reqs::Vector{Request})

Block until at least one of the active requests in the array reqs is complete. The completed requests are deallocated, and a tuple of their indices in reqs and their corresponding Status objects are returned. If there are no active requests, then the function returns immediately and indices and statuses are empty.

External links

source

Probe and cancel

MPI.IprobeFunction
ismessage, (status|nothing) = Iprobe(src::Integer, tag::Integer, comm::Comm)

Checks if there is a message that can be received matching src, tag and comm. If so, returns a tuple true and a Status object, otherwise returns a tuple false, nothing.

External links

source
MPI.ProbeFunction
status = Probe(src::Integer, tag::Integer, comm::Comm)

Blocks until there is a message that can be received matching src, tag and comm. Returns the corresponding Status object.

External links

source
MPI.Cancel!Function
Cancel!(req::Request)

Marks a pending Irecv! operation for cancellation (cancelling a Isend, while supported in some implementations, is deprecated as of MPI 3.1). Note that the request is not deallocated, and can still be queried using the test or wait functions.

External links

source