...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::mpi::request — A request for a non-blocking send or receive.
// In header: <boost/mpi/request.hpp> class request { public: // member classes/structs/unions class handler { public: // public member functions virtual ~handler() = 0; virtual status wait() = 0; virtual optional< status > test() = 0; virtual void cancel() = 0; virtual bool active() const = 0; virtual optional< MPI_Request & > trivial() = 0; }; template<typename T, typename A> class legacy_dynamic_primitive_array_handler { }; template<typename T> class legacy_serialized_array_handler { }; template<typename T> class legacy_serialized_handler { }; // public member functions request(); status wait(); optional< status > test(); void cancel(); optional< MPI_Request & > trivial(); bool active() const; void preserve(boost::shared_ptr< void >); // public static functions template<typename T> static request make_trivial_send(communicator const &, int, int, T const &); template<typename T> static request make_trivial_send(communicator const &, int, int, T const *, int); static request make_packed_send(communicator const &, int, int, void const *, std::size_t); static request make_bottom_send(communicator const &, int, int, MPI_Datatype); static request make_empty_send(communicator const &, int, int); template<typename T> static request make_trivial_recv(communicator const &, int, int, T &); template<typename T> static request make_trivial_recv(communicator const &, int, int, T *, int); static request make_bottom_recv(communicator const &, int, int, MPI_Datatype); static request make_empty_recv(communicator const &, int, int); static request make_dynamic(); template<typename T> static request make_serialized(communicator const &, int, int, T &); template<typename T> static request make_serialized_array(communicator const &, int, int, T *, int); template<typename T, typename A> static request make_dynamic_primitive_array_recv(communicator const &, int, int, std::vector< T, A > &); template<typename T, typename A> static request make_dynamic_primitive_array_send(communicator const &, int, int, std::vector< T, A > const &); // private member functions request(handler *); };
This structure contains information about a non-blocking send or receive and will be returned from isend
or irecv
, respectively.
request
public member functionsrequest();
Constructs a NULL request.
status wait();
Wait until the communication associated with this request has completed, then return a status
object describing the communication.
optional< status > test();
Determine whether the communication associated with this request has completed successfully. If so, returns the status
object describing the communication. Otherwise, returns an empty optional<>
to indicate that the communication has not completed yet. Note that once test()
returns a status
object, the request has completed and wait()
should not be called.
void cancel();
Cancel a pending communication, assuming it has not already been completed.
optional< MPI_Request & > trivial();
The trivial MPI requet implenting this request, provided it's trivial. Probably irrelevant to most users.
bool active() const;
Is this request potentialy pending ?
void preserve(boost::shared_ptr< void > d);
request
public static functionstemplate<typename T> static request make_trivial_send(communicator const & comm, int dest, int tag, T const & value);
Send a known number of primitive objects in one MPI request.
template<typename T> static request make_trivial_send(communicator const & comm, int dest, int tag, T const * values, int n);
static request make_packed_send(communicator const & comm, int dest, int tag, void const * values, std::size_t n);
static request make_bottom_send(communicator const & comm, int dest, int tag, MPI_Datatype tp);
static request make_empty_send(communicator const & comm, int dest, int tag);
template<typename T> static request make_trivial_recv(communicator const & comm, int dest, int tag, T & value);
Receive a known number of primitive objects in one MPI request.
template<typename T> static request make_trivial_recv(communicator const & comm, int dest, int tag, T * values, int n);
static request make_bottom_recv(communicator const & comm, int dest, int tag, MPI_Datatype tp);
static request make_empty_recv(communicator const & comm, int dest, int tag);
static request make_dynamic();
Construct request for simple data of unknown size.
template<typename T> static request make_serialized(communicator const & comm, int source, int tag, T & value);
Constructs request for serialized data.
template<typename T> static request make_serialized_array(communicator const & comm, int source, int tag, T * values, int n);
Constructs request for array of complex data.
template<typename T, typename A> static request make_dynamic_primitive_array_recv(communicator const & comm, int source, int tag, std::vector< T, A > & values);
Request to recv array of primitive data.
template<typename T, typename A> static request make_dynamic_primitive_array_send(communicator const & comm, int source, int tag, std::vector< T, A > const & values);
Request to send array of primitive data.