Point-to-point communication
Types
MPI.Request — TypeMPI.RequestAn 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!.
MPI.Status — TypeMPI.StatusThe status of an MPI receive communication. It has 3 accessible fields
source: source of the received messagetag: tag of the received messageerror: 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.
Functions
Accessor
MPI.Get_count — FunctionMPI.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
Blocking
MPI.Send — FunctionSend(buf, [count::Integer, [datatype::Datatype,]]
dest::Integer, tag::Integer, comm::Comm) where TPerform 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
Send(obj::T, dest::Integer, tag::Integer, comm::Comm) where TComplete a blocking send of obj to MPI rank dest of communicator comm using with the message tag tag.
MPI.Recv! — FunctionRecv!(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
MPI.Sendrecv! — FunctionSendrecv!(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
Non-blocking
MPI.Isend — FunctionIsend(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
Isend(obj::T, dest::Integer, tag::Integer, comm::Comm) where TStarts 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.
MPI.Irecv! — FunctionIrecv!(buf, [count::Integer, [datatype::Datatype,]]
src::Integer, tag::Integer, comm::Comm) where TStarts 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
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
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
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
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
MPI.Wait! — Functionstatus = Wait!(req::Request)Block until the request req is complete and deallocated. Returns the Status of the request.
External links
MPI.Waitall! — Functionstatuses = 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
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
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
Probe and cancel
MPI.Iprobe — Functionismessage, (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
MPI.Probe — Functionstatus = 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
MPI.Cancel! — FunctionCancel!(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