![]() |
fpmas 1.6
|
#include <communication.h>
Public Types | |
typedef PackType | pack_type |
Public Member Functions | |
TypedMpi (api::communication::MpiCommunicator &comm) | |
std::unordered_map< int, std::vector< T > > | migrate (std::unordered_map< int, std::vector< T > > export_map) override |
std::unordered_map< int, T > | allToAll (std::unordered_map< int, T > export_map) override |
std::vector< T > | gather (const T &, int root) override |
std::vector< T > | allGather (const T &) override |
T | bcast (const T &, int root) override |
void | send (const T &, int, int) override |
void | Isend (const T &, int, int, Request &) override |
void | Issend (const T &, int, int, Request &) override |
void | probe (int source, int tag, Status &status) override |
bool | Iprobe (int source, int tag, Status &status) override |
T | recv (int source, int tag, Status &status=Status::IGNORE) override |
virtual std::unordered_map< int, std::vector< T > > | migrate (std::unordered_map< int, std::vector< T > > export_map)=0 |
virtual std::unordered_map< int, T > | allToAll (std::unordered_map< int, T > export_map)=0 |
virtual std::vector< T > | gather (const T &data, int root)=0 |
virtual std::vector< T > | allGather (const T &data)=0 |
virtual T | bcast (const T &data, int root)=0 |
virtual void | send (const T &data, int destination, int tag)=0 |
virtual void | Isend (const T &data, int destination, int tag, Request &req)=0 |
virtual void | Issend (const T &data, int destination, int tag, Request &req)=0 |
virtual void | probe (int source, int tag, Status &status)=0 |
virtual bool | Iprobe (int source, int tag, Status &status)=0 |
virtual T | recv (int source, int tag, Status &status=Status::IGNORE)=0 |
An fpmas::io::datapack::BasicObjectPack based fpmas::api::communication::TypedMpi implementation.
Each T
instance is serialized as a DataPack using the specified PackType, and sent as MPI_CHAR using the provided api::communication::MpiCommunicator.
This means that ANY TYPE that can be serialized / unserialized as PackType can be easily sent across processors through MPI using this class, preventing users from struggling with low-level MPI issues and custom MPI_Datatype definitions.
T | data to transmit, serializable into a PackType |
PackType | BasicObjectPack implementation (e.g.: fpmas::io::datapack::JsonPack, fpmas::io::datapack::ObjectPack, fpmas::io::datapack::LightObjectPack...) |
typedef PackType fpmas::communication::detail::TypedMpi< T, PackType >::pack_type |
BasicObjectPack implementation used to serialize data.
|
inline |
TypedMpi constructor.
The specified MPI communicator will be used to perform actual message sending between processors.
To sum up, the role of this class is to serialize / unserialize input / output data, and transmit it to / from the underlying api::communication::MpiCommunicator instance.
comm | reference to an MPI communicator instance |
|
overridevirtual |
Performs a migration of data across all processors.
The "migration" operation follows the same rules as MpiCommunicator::allToAll, except that vectors of T instances can be used, for convenience.
export_map | vectors of data to send to each process |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Performs a complete exchange of T
instances among processor.
Follows the same rules as MpiCommunicator::allToAll().
export_map | data to export to each process |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Gathers T
instances at root
.
Follows the same rules as MpiCommunicator::gather().
data | data to send to root |
root | rank of the root process |
rank == root
, a vector containing gathered T
objects, else an empty vector. Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Gathers T
instances on all processes.
Follows the same rules as MpiCommunicator::allGather().
data | to send to all processes |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Broadcasts a T
instance to all processes.
Follows the same rules as MpiCommunicator::bcast().
data | data to broadcast |
root | rank of the process from which data is sent |
root
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Sends a T
instance to destination
(blocking).
Follows the same rules as MpiCommunicator::send().
data | reference to the T object to send to destination |
destination | rank of the destination process |
tag | message tag |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Sends a T
instance to destination
(non-blocking).
Follows the same rules as MpiCommunicator::Isend().
data | reference to the T object to send to destination |
destination | rank of the destination process |
tag | message tag |
req | output Request |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Sends a T
instance to destination
(non-blocking, synchronous).
Follows the same rules as MpiCommunicator::Issend().
data | reference to the T object to send to destination |
destination | rank of the destination process |
tag | message tag |
req | output Request |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Blocking probe.
Blocks until a message with the specified tag is received from source.
Upon return, the output status
contains information about the size of the message to receive.
source | source rank |
tag | recv tag |
status | MPI status |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Non-blocking probe.
Returns true if and only if a message with the specified tag can be received from source.
Upon return, the output status
contains information about the size of the message to receive.
source | source rank |
tag | recv tag |
status | MPI status |
Implements fpmas::api::communication::TypedMpi< T >.
|
overridevirtual |
Receives a T
object from source
.
source | rank of the process to receive from |
tag | message tag |
status | output MPI status |
Implements fpmas::api::communication::TypedMpi< T >.