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
MPI.StatusRefFunction
StatusRef()

Construct an empty Ref{Status}. This can be passed to MPI Test/Wait operations.

source

Accessors

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 communication

MPI.SendFunction
Send(buf, comm::Comm; dest::Integer, tag::Integer=0)

Perform a blocking send from the buffer buf to MPI rank dest of communicator comm using the message tag tag.

Send(obj, comm::Comm; dest::Integer, tag::Integer=0)

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

External links

source
MPI.sendFunction
send(obj, comm::Comm; dest::Integer, tag::Integer=0)

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

source
MPI.Recv!Function
data = Recv!(recvbuf, comm::Comm;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)
data, status = Recv!(recvbuf, comm::Comm, MPI.Status;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)

Completes a blocking receive into the buffer recvbuf from MPI rank source of communicator comm using with the message tag tag.

recvbuf can be a Buffer, or any object for which Buffer(recvbuf) is defined.

Optionally returns the Status object of the receive.

See also

External links

source
MPI.RecvFunction
data = Recv(::Type{T}, comm::Comm;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)
data, status = Recv(::Type{T}, comm::Comm, MPI.Status;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)

Completes a blocking receive of a single isbits object of type T from MPI rank source of communicator comm using with the message tag tag.

Returns a tuple of the object of type T and optionally the Status of the receive.

See also

External links

source
MPI.recvFunction
obj = recv(comm::Comm;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)
obj, status = recv(comm::Comm, MPI.Status;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)

Completes a blocking receive of a serialized object from MPI rank source of communicator comm using with the message tag tag.

Returns the deserialized object and optionally the Status of the receive.

source
MPI.Sendrecv!Function
data = Sendrecv!(sendbuf, recvbuf, comm;
        dest::Integer, sendtag::Integer=0, source::Integer=MPI_ANY_SOURCE, recvtag::Integer=MPI_ANY_TAG)
data, status = Sendrecv!(sendbuf, recvbuf, comm, MPI.Status;
        dest::Integer, sendtag::Integer=0, source::Integer=MPI_ANY_SOURCE, recvtag::Integer=MPI_ANY_TAG)

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 communication

Initiation

MPI.IsendFunction
Isend(data, comm::Comm; dest::Integer, tag::Integer=0)

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

data can be a Buffer, or any object for which Buffer_send is defined.

Returns the Request object for the nonblocking send.

External links

source
MPI.isendFunction
isend(obj, comm::Comm; dest::Integer, tag::Integer=0)

Starts a nonblocking send of using a serialized version 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
req = Irecv!(recvbuf, comm::Comm;
        source::Integer=MPI_ANY_SOURCE, tag::Integer=MPI_ANY_TAG)

Starts a nonblocking receive into the buffer data from MPI rank source of communicator comm using with the message tag tag.

data can be a Buffer, or any object for which Buffer(data) is defined.

Returns the Request object for the nonblocking receive.

External links

source

Completion

MPI.TestFunction
flag = Test(req::Request)
flag, status = Test(req::Request, Status)

Check if the request req is complete. If so, the request is deallocated and flag = true is returned. Otherwise flag = false.

The Status argument additionally returns the Status of the completed request.

External links

source
MPI.TestallFunction
flag = Testall(reqs::AbstractVector{Request}[, statuses::Vector{Status}])
flag, statuses = Testall(reqs::AbstractVector{Request}, Status)

Check if all active requests in the array reqs are complete. If so, the requests are deallocated and true is returned. Otherwise no requests are modified, and false is returned.

The optional statuses or Status argument can be used to obtain the return Status of each request.

External links

source
MPI.TestanyFunction
flag, idx = Testany(reqs::AbstractVector{Request}[, status::Ref{Status}])
flag, idx, status = Testany(reqs::AbstractVector{Request}, Status)

Checks 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. flag = true and its (1-based) index idx is returned.

If there are no completed requests, then flag = false and idx = nothing is returned.

If there are no active requests, flag = true and idx = nothing.

The optional status argument can be used to obtain the return Status of the request.

External links

source
MPI.TestsomeFunction
inds = Testsome(reqs::AbstractVector{Request}[, statuses::Vector{Status}])

Similar to Waitsome except that if no operations have completed it will return an empty array.

If there are no active requests, then the function returns nothing.

The optional statuses argument can be used to obtain the return Status of each completed request.

External links

source
MPI.WaitFunction
Wait(req::Request)
status = Wait(req::Request, Status)

Block until the request req is complete and deallocated.

The Status argument returns the Status of the completed request.

External links

source
MPI.WaitallFunction
Waitall(reqs::AbstractVector{Request}[, statuses::Vector{Status}])
statuses = Waitall(reqs::AbstractVector{Request}, Status)

Block until all active requests in the array reqs are complete.

The optional statuses or Status argument can be used to obtain the return Status of each request.

External links

source
MPI.WaitanyFunction
i = Waitany(reqs::AbstractVector{Request}[, status::Ref{Status}])
i, status = Waitany(reqs::AbstractVector{Request}, Status)

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 the (1-based) index i of the completed request is returned.

If there are no active requests, then i = nothing.

The optional status argument can be used to obtain the return Status of the request.

External links

source
MPI.WaitsomeFunction
inds = Waitsome(reqs::AbstractVector{Request}[, statuses::Vector{Status}])

Block until at least one of the active requests in the array reqs is complete. The completed requests are deallocated, and an array inds of their indices in reqs is returned.

If there are no active requests, then inds = nothing.

The optional statuses argument can be used to obtain the return Status of each completed request.

External links

source

Probe/Cancel

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
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