Thrill  0.1
Connection Class Referencefinal

Detailed Description

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.

Definition at line 62 of file group.hpp.

+ Inheritance diagram for Connection:
+ Collaboration diagram for Connection:

#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

Groupgroup_
 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
 

Member Function Documentation

◆ Initialize()

void Initialize ( Group group,
int  peer 
)
inline

construct from group tag and MPI peer

Definition at line 68 of file group.hpp.

◆ IsValid()

bool IsValid ( ) const
inlinefinalvirtual

check whether the connection is (still) valid.

Implements Connection.

Definition at line 76 of file group.hpp.

◆ OutputOstream()

std::ostream & OutputOstream ( std::ostream &  os) const
finalvirtual

virtual method to output to a std::ostream

Implements Connection.

Definition at line 50 of file group.cpp.

◆ peer()

◆ RecvOne()

ssize_t RecvOne ( void *  out_data,
size_t  size 
)
inlinefinalvirtual

Non-blocking receive of at most size data. returns number of bytes actually received. check errno for errors.

Implements Connection.

Definition at line 106 of file group.hpp.

◆ SendOne()

ssize_t SendOne ( const void *  data,
size_t  size,
Flags  flags = NoFlags 
)
inlinefinalvirtual

Non-blocking send of a (data,size) message. returns number of bytes possible to send. check errno for errors.

Implements Connection.

Definition at line 93 of file group.hpp.

◆ SyncRecv()

void SyncRecv ( void *  out_data,
size_t  size 
)
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().

◆ SyncRecvSend()

void SyncRecvSend ( const void *  send_data,
size_t  send_size,
void *  recv_data,
size_t  recv_size 
)
finalvirtual

Implements Connection.

Definition at line 173 of file group.cpp.

◆ SyncSend()

void SyncSend ( const void *  data,
size_t  size,
Flags  flags = NoFlags 
)
finalvirtual

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().

◆ SyncSendRecv()

void SyncSendRecv ( const void *  send_data,
size_t  send_size,
void *  recv_data,
size_t  recv_size 
)
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().

◆ ToString()

std::string ToString ( ) const
finalvirtual

mpi::Connection

Implements Connection.

Definition at line 46 of file group.cpp.

References thrill::mem::to_string().

Member Data Documentation

◆ debug

constexpr bool debug = false
staticprivate

Definition at line 64 of file group.hpp.

◆ group_

Group* group_
private

Group reference.

Definition at line 125 of file group.hpp.

◆ peer_

int peer_
private

Outgoing peer id of this Connection.

Definition at line 128 of file group.hpp.


The documentation for this class was generated from the following files: