template<typename T>
class Utilities::MPI::Future< T >
An object that acts like a std::future object except that it does not encode the operation of waiting for an operation to finish that may be happening on a different thread, but for an "immediate" MPI operation such as MPI_Isend
or MPI_Irecv
. An object of this kind is returned, for example, by the isend() and irecv() functions in this namespace.
If the operation being waited for produces a result (such as a receive operation, then the produced result is returned by the get() function and its type is indicated by the template argument T
. If the operation does not produce a result (such as waiting for a send operation to complete), then T=void
is the right choice for the template argument.
Implementation
Immediate MPI operations are typically associated with two additional actions. The first is that one has to be able to wait for them to finish. In many cases, this is done using a call to MPI_Wait
that is given an MPI_Request
object (in the case of send operations) or a call to MPI_Probe
or a variant of this function (in the case of receive operations). The wait operation may be called more than once and would immediately return once the first one has succeeded.
Secondly, immediate MPI operations often require clean-up actions that must be executed once the operation has finished. An example is releasing a buffer in which data has been stored (for an immediate send operation), or allocating a receive buffer, calling the MPI function that puts the received data into this buffer, calling the unpacking function for the data received, and releasing the receive buffer (for an immediate receive operation).
This class models these two steps by taking two constructor arguments that correspond to these two operations. It ensures that upon destruction of the current object, both the wait and clean-up functions are called. Because the clean-up function can only be called once, objects of the current class can not be copied, but they can be moved.
Definition at line 457 of file mpi.h.