Thrill
0.1
|
The central object of a mock network: the Group containing links to other mock Group forming the network.
Note that there is no central object containing all Groups.
#include <group.hpp>
Static Public Member Functions | |
static std::vector< std::unique_ptr< Group > > | ConstructLoopbackMesh (size_t num_hosts) |
Construct a mock network with num_hosts peers and deliver Group contexts for each of them. More... | |
static std::string | MaybeHexdump (const void *data, size_t size) |
return hexdump or just [data] if not debugging More... | |
Private Member Functions | |
void | Send (size_t tgt, net::Buffer &&msg) |
Send a buffer to peer tgt. Blocking, ... sort of. More... | |
Private Attributes | |
Connection * | conns_ |
vector of virtual connection objects to remote peers More... | |
std::vector< Group * > | peers_ |
vector of peers for delivery of messages. More... | |
Static Private Attributes | |
static constexpr bool | debug = false |
static constexpr bool | debug_data = true |
Base Functions | |
using | Dispatcher = mock::Dispatcher |
Group (size_t my_rank, size_t group_size) | |
Initialize a Group for the given size rank. More... | |
~Group () | |
virtual destructor More... | |
size_t | num_hosts () const final |
Return number of connections in this group (= number computing hosts) More... | |
net::Connection & | connection (size_t peer) final |
Return Connection to client id. More... | |
void | Close () final |
Close. More... | |
std::unique_ptr< net::Dispatcher > | ConstructDispatcher () const final |
Additional Inherited Members | |
Public Member Functions inherited from Group | |
Group (size_t my_rank) | |
initializing constructor More... | |
Group (const Group &)=delete | |
non-copyable: delete copy-constructor More... | |
Group (Group &&)=default | |
move-constructor: default More... | |
template<> | |
void | AllReduce (int &value, std::plus< int >) |
template<> | |
void | AllReduce (int &value, common::minimum< int >) |
template<> | |
void | AllReduce (int &value, common::maximum< int >) |
template<> | |
void | AllReduce (unsigned int &value, std::plus< unsigned int >) |
template<> | |
void | AllReduce (unsigned int &value, common::minimum< unsigned int >) |
template<> | |
void | AllReduce (unsigned int &value, common::maximum< unsigned int >) |
template<> | |
void | AllReduce (long &value, std::plus< long >) |
template<> | |
void | AllReduce (long &value, common::minimum< long >) |
template<> | |
void | AllReduce (long &value, common::maximum< long >) |
template<> | |
void | AllReduce (unsigned long &value, std::plus< unsigned long >) |
template<> | |
void | AllReduce (unsigned long &value, common::minimum< unsigned long >) |
template<> | |
void | AllReduce (unsigned long &value, common::maximum< unsigned long >) |
template<> | |
void | AllReduce (long long &value, std::plus< long long >) |
template<> | |
void | AllReduce (long long &value, common::minimum< long long >) |
template<> | |
void | AllReduce (long long &value, common::maximum< long long >) |
template<> | |
void | AllReduce (unsigned long long &value, std::plus< unsigned long long >) |
template<> | |
void | AllReduce (unsigned long long &value, common::minimum< unsigned long long >) |
template<> | |
void | AllReduce (unsigned long long &value, common::maximum< unsigned long long >) |
template<> | |
void | Broadcast (int &value, size_t origin) |
template<> | |
void | Broadcast (unsigned int &value, size_t origin) |
template<> | |
void | Broadcast (long &value, size_t origin) |
template<> | |
void | Broadcast (unsigned long &value, size_t origin) |
template<> | |
void | Broadcast (long long &value, size_t origin) |
template<> | |
void | Broadcast (unsigned long long &value, size_t origin) |
template<> | |
void | ExPrefixSum (int &value, std::plus< int >, const int &initial) |
template<> | |
void | ExPrefixSum (unsigned int &value, std::plus< unsigned int >, const unsigned int &initial) |
template<> | |
void | ExPrefixSum (long &value, std::plus< long >, const long &initial) |
template<> | |
void | ExPrefixSum (unsigned long &value, std::plus< unsigned long >, const unsigned long &initial) |
template<> | |
void | ExPrefixSum (long long &value, std::plus< long long >, const long long &initial) |
template<> | |
void | ExPrefixSum (unsigned long long &value, std::plus< unsigned long long >, const unsigned long long &initial) |
Group & | operator= (const Group &)=delete |
non-copyable: delete assignment operator More... | |
Group & | operator= (Group &&)=default |
move-assignment operator: default More... | |
template<> | |
void | PrefixSum (int &value, std::plus< int >, const int &initial) |
template<> | |
void | PrefixSum (unsigned int &value, std::plus< unsigned int >, const unsigned int &initial) |
template<> | |
void | PrefixSum (long &value, std::plus< long >, const long &initial) |
template<> | |
void | PrefixSum (unsigned long &value, std::plus< unsigned long >, const unsigned long &initial) |
template<> | |
void | PrefixSum (long long &value, std::plus< long long >, const long long &initial) |
template<> | |
void | PrefixSum (unsigned long long &value, std::plus< unsigned long long >, const unsigned long long &initial) |
size_t | my_host_rank () const |
Return our rank among hosts in this group. More... | |
virtual size_t | num_parallel_async () const |
size_t | OneFactorSize () const |
Number of of 1-factor iterations. More... | |
size_t | OneFactorPeer (size_t round) const |
template<typename T > | |
void | SendTo (size_t dest, const T &data) |
Sends a serializable type to the given peer. More... | |
template<typename T > | |
void | ReceiveFrom (size_t src, T *data) |
Receives a serializable type from the given peer. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | PrefixSum (T &value, BinarySumOp sum_op=BinarySumOp(), const T &initial=T()) |
Calculate inclusive prefix sum. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | ExPrefixSum (T &value, BinarySumOp sum_op=BinarySumOp(), const T &initial=T()) |
Calculate exclusive prefix sum. More... | |
template<typename T > | |
void | Broadcast (T &value, size_t origin=0) |
Broadcast a value from the worker "origin". More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | Reduce (T &value, size_t root=0, BinarySumOp sum_op=BinarySumOp()) |
Reduce a value from all workers to the worker 0. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduce (T &value, BinarySumOp sum_op=BinarySumOp()) |
Reduce a value from all workers to all workers. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | PrefixSumSelect (T &value, BinarySumOp sum_op=BinarySumOp(), const T &initial=T(), bool inclusive=true) |
select prefixsum implementation (often due to total number of processors) More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | PrefixSumDoubling (T &value, BinarySumOp sum_op=BinarySumOp(), const T &initial=T(), bool inclusive=true) |
Calculate for every worker his prefix sum. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | PrefixSumHypercube (T &value, BinarySumOp sum_op=BinarySumOp()) |
Calculate for every worker his prefix sum. More... | |
template<typename T > | |
void | BroadcastSelect (T &value, size_t origin=0) |
select broadcast implementation (often due to total number of processors) More... | |
template<typename T > | |
void | BroadcastTrivial (T &value, size_t origin=0) |
Broadcasts the value of the peer with index 0 to all the others. More... | |
template<typename T > | |
void | BroadcastBinomialTree (T &value, size_t origin=0) |
Broadcasts the value of the worker with index "origin" to all the others. More... | |
template<typename T > | |
void | AllGatherRecursiveDoublingPowerOfTwo (T *values, size_t n) |
template<typename T > | |
void | AllGatherBruck (T *values, size_t n) |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduceSelect (T &value, BinarySumOp sum_op=BinarySumOp()) |
select allreduce implementation (often due to total number of processors) More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduceSimple (T &value, BinarySumOp sum_op=BinarySumOp()) |
Perform an All-Reduce on the workers. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduceAtRoot (T &value, BinarySumOp sum_op=BinarySumOp()) |
Broadcasts the value of the peer with index 0 to all the others. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduceHypercube (T &value, BinarySumOp sum_op=BinarySumOp()) |
Perform an All-Reduce for powers of two. More... | |
template<typename T , typename BinarySumOp = std::plus<T>> | |
void | AllReduceElimination (T &value, BinarySumOp sum_op=BinarySumOp()) |
Perform an All-Reduce using the elimination protocol described in R. More... | |
Protected Member Functions inherited from Group | |
virtual void | PrefixSumPlusInt (int &value, const int &initial) |
virtual void | ExPrefixSumPlusInt (int &value, const int &initial) |
virtual void | BroadcastInt (int &value, size_t origin) |
virtual void | AllReducePlusInt (int &value) |
virtual void | AllReduceMinimumInt (int &value) |
virtual void | AllReduceMaximumInt (int &value) |
virtual void | PrefixSumPlusUnsignedInt (unsigned int &value, const unsigned int &initial) |
virtual void | ExPrefixSumPlusUnsignedInt (unsigned int &value, const unsigned int &initial) |
virtual void | BroadcastUnsignedInt (unsigned int &value, size_t origin) |
virtual void | AllReducePlusUnsignedInt (unsigned int &value) |
virtual void | AllReduceMinimumUnsignedInt (unsigned int &value) |
virtual void | AllReduceMaximumUnsignedInt (unsigned int &value) |
virtual void | PrefixSumPlusLong (long &value, const long &initial) |
virtual void | ExPrefixSumPlusLong (long &value, const long &initial) |
virtual void | BroadcastLong (long &value, size_t origin) |
virtual void | AllReducePlusLong (long &value) |
virtual void | AllReduceMinimumLong (long &value) |
virtual void | AllReduceMaximumLong (long &value) |
virtual void | PrefixSumPlusUnsignedLong (unsigned long &value, const unsigned long &initial) |
virtual void | ExPrefixSumPlusUnsignedLong (unsigned long &value, const unsigned long &initial) |
virtual void | BroadcastUnsignedLong (unsigned long &value, size_t origin) |
virtual void | AllReducePlusUnsignedLong (unsigned long &value) |
virtual void | AllReduceMinimumUnsignedLong (unsigned long &value) |
virtual void | AllReduceMaximumUnsignedLong (unsigned long &value) |
virtual void | PrefixSumPlusLongLong (long long &value, const long long &initial) |
virtual void | ExPrefixSumPlusLongLong (long long &value, const long long &initial) |
virtual void | BroadcastLongLong (long long &value, size_t origin) |
virtual void | AllReducePlusLongLong (long long &value) |
virtual void | AllReduceMinimumLongLong (long long &value) |
virtual void | AllReduceMaximumLongLong (long long &value) |
virtual void | PrefixSumPlusUnsignedLongLong (unsigned long long &value, const unsigned long long &initial) |
virtual void | ExPrefixSumPlusUnsignedLongLong (unsigned long long &value, const unsigned long long &initial) |
virtual void | BroadcastUnsignedLongLong (unsigned long long &value, size_t origin) |
virtual void | AllReducePlusUnsignedLongLong (unsigned long long &value) |
virtual void | AllReduceMinimumUnsignedLongLong (unsigned long long &value) |
virtual void | AllReduceMaximumUnsignedLongLong (unsigned long long &value) |
template<typename T , typename BinarySumOp > | |
T | SendReceiveReduce (size_t peer, const T &value, BinarySumOp sum_op) |
Helper method for AllReduce(). More... | |
template<typename T , typename BinarySumOp > | |
void | AllReduceEliminationProcess (size_t host_id, size_t group_size, size_t remaining_hosts, size_t send_to, T &value, BinarySumOp sum_op) |
Helper method for AllReduce(). More... | |
Protected Attributes inherited from Group | |
size_t | my_rank_ |
our rank in the network group More... | |
using Dispatcher = mock::Dispatcher |
Group | ( | size_t | my_rank, |
size_t | group_size | ||
) |
Initialize a Group for the given size rank.
Definition at line 131 of file group.cpp.
References Group::conns_, thrill::net::mpi::Initialize(), and Group::peers_.
|
virtual |
virtual destructor
Reimplemented from Group.
Definition at line 141 of file group.cpp.
References Group::conns_.
|
finalvirtual |
Return Connection to client id.
Implements Group.
Definition at line 149 of file group.cpp.
References Group::conns_, and Group::peers_.
|
finalvirtual |
|
static |
Construct a mock network with num_hosts peers and deliver Group contexts for each of them.
Definition at line 162 of file group.cpp.
References Group::num_hosts().
Referenced by thrill::net::RunLoopbackGroupTest().
|
static |
return hexdump or just [data] if not debugging
Definition at line 181 of file group.cpp.
References Group::debug_data, and tlx::hexdump().
Referenced by Group::Send().
|
finalvirtual |
Return number of connections in this group (= number computing hosts)
Implements Group.
Definition at line 145 of file group.cpp.
References Group::peers_.
Referenced by Group::ConstructLoopbackMesh().
|
private |
Send a buffer to peer tgt. Blocking, ... sort of.
Definition at line 188 of file group.cpp.
References Group::debug, Group::MaybeHexdump(), Group::my_rank_, Group::peers_, and sLOG.
Referenced by Connection::SyncSend().
|
private |
vector of virtual connection objects to remote peers
Definition at line 157 of file group.hpp.
Referenced by Group::connection(), Group::Group(), and Group::~Group().
|
staticprivate |
Definition at line 118 of file group.hpp.
Referenced by Group::Send().
|
staticprivate |
Definition at line 119 of file group.hpp.
Referenced by Group::MaybeHexdump().
|
private |
vector of peers for delivery of messages.
Definition at line 154 of file group.hpp.
Referenced by Group::connection(), Group::Group(), Group::num_hosts(), and Group::Send().