Thrill
0.1
|
Virtual MPI connection class.
As MPI has no real connections, this class is just the integer which selected an MPI peer. Additionally, it contains the group tag used to separate communication into groups.
#include <group.hpp>
Public Member Functions | |
void | Initialize (Group *group, int peer) |
construct from group tag and MPI peer More... | |
Base Status Functions | |
bool | IsValid () const final |
check whether the connection is (still) valid. More... | |
int | peer () const |
return the MPI peer number More... | |
std::string | ToString () const final |
mpi::Connection More... | |
std::ostream & | OutputOstream (std::ostream &os) const final |
virtual method to output to a std::ostream More... | |
Send Functions | |
void | SyncSend (const void *data, size_t size, Flags=NoFlags) final |
ssize_t | SendOne (const void *data, size_t size, Flags flags=NoFlags) final |
Receive Functions | |
void | SyncRecv (void *out_data, size_t size) final |
ssize_t | RecvOne (void *out_data, size_t size) final |
Paired SendReceive Methods | |
void | SyncSendRecv (const void *send_data, size_t send_size, void *recv_data, size_t recv_size) final |
void | SyncRecvSend (const void *send_data, size_t send_size, void *recv_data, size_t recv_size) final |
Public Member Functions inherited from Connection | |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | Send (const T &value) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | Send (const T &value) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | Send (const T &value) |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | Receive (T *out_value) |
Receive any serializable POD item T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | Receive (T *out_value) |
Receive any serializable non-POD fixed-length item T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | Receive (T *out_value) |
Receive any serializable non-POD fixed-length item T. More... | |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | SendReceive (const T *value, T *out_value, size_t n=1) |
SendReceive any serializable POD item T. More... | |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | ReceiveSend (const T &value, T *out_value) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | SendReceive (const T *value, T *out_value, size_t n=1) |
SendReceive any serializable non-POD fixed-length item T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | ReceiveSend (const T &value, T *out_value) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | SendReceive (const T *value, T *out_value, size_t n=1) |
SendReceive any serializable non-POD fixed-length item T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | ReceiveSend (const T &value, T *out_value) |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | SendN (const T *value, size_t n) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | SendN (const T *value, size_t n) |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | SendN (const T *value, size_t n) |
template<typename T > | |
std::enable_if< std::is_pod< T >::value, void >::type | ReceiveN (T *out_value, size_t n) |
Receive an array of serializable POD items T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | ReceiveN (T *out_value, size_t n) |
Receive an array of serializable non-POD fixed-length items T. More... | |
template<typename T > | |
std::enable_if< !std::is_pod< T >::value &&!data::Serialization< BufferBuilder, T >::is_fixed_size, void >::type | ReceiveN (T *out_value, size_t n) |
Receive an array of serializable non-POD fixed-length items T. More... | |
Private Attributes | |
Group * | group_ |
Group reference. More... | |
int | peer_ |
Outgoing peer id of this Connection. More... | |
Static Private Attributes | |
static constexpr bool | debug = false |
Additional Inherited Members | |
Public Types inherited from Connection | |
enum | Flags : size_t { NoFlags = 0, MsgMore = 1 } |
Additional flags for sending or receiving. More... | |
Public Attributes inherited from Connection | |
bool | is_loopback_ = false |
std::atomic< uint32_t > | tx_seq_ { 0 } |
send sequence More... | |
std::atomic< uint32_t > | rx_seq_ { 0 } |
receive sequence More... | |
std::atomic< size_t > | tx_bytes_ { 0 } |
sent bytes More... | |
std::atomic< size_t > | rx_bytes_ = { 0 } |
received bytes More... | |
size_t | prev_tx_bytes_ = 0 |
previous read of sent bytes More... | |
size_t | prev_rx_bytes_ = 0 |
previous read of received bytes More... | |
std::atomic< size_t > | tx_active_ { 0 } |
active send requests More... | |
std::atomic< size_t > | rx_active_ = { 0 } |
active recv requests More... | |
Static Public Attributes inherited from Connection | |
static constexpr bool | self_verify_ = common::g_self_verify |
|
inline |
|
inlinefinalvirtual |
check whether the connection is (still) valid.
Implements Connection.
|
finalvirtual |
virtual method to output to a std::ostream
Implements Connection.
|
inline |
return the MPI peer number
Definition at line 79 of file group.hpp.
Referenced by Dispatcher::AddRead(), Dispatcher::Cancel(), Dispatcher::DispatchOne(), Dispatcher::IRecv(), Dispatcher::ISend(), Dispatcher::PerformAsync(), Dispatcher::QueueAsyncRecv(), Dispatcher::QueueAsyncSend(), and Dispatcher::SetExcept().
|
inlinefinalvirtual |
Non-blocking receive of at most size data. returns number of bytes actually received. check errno for errors.
Implements Connection.
Non-blocking send of a (data,size) message. returns number of bytes possible to send. check errno for errors.
Implements Connection.
|
finalvirtual |
Synchronous blocking receive a message of given size. The size must match the SyncSend size for some network layers may only support matching messages (read: RDMA!, but also true for the mock net). Throws a net::Exception on errors.
Implements Connection.
Definition at line 86 of file group.cpp.
References Exception::Exception(), Dispatcher::IRecv(), LOG, and max().
|
finalvirtual |
Implements Connection.
Synchronous blocking send of the (data,size) packet. if sending fails, a net::Exception is thrown.
Implements Connection.
Definition at line 57 of file group.cpp.
References Dispatcher::ISend(), LOG, and max().
|
finalvirtual |
Synchronous blocking sending and receive a message of given size. The size must match the SyncSendRecv size for some network layers may only support matching messages (read: RDMA!, but also true for the mock net). Throws a net::Exception on errors.
Implements Connection.
Definition at line 125 of file group.cpp.
References Exception::Exception(), Dispatcher::ISend(), LOG, and max().
|
finalvirtual |
Implements Connection.
Definition at line 46 of file group.cpp.
References thrill::mem::to_string().
|
private |
Outgoing peer id of this Connection.