Thrill
0.1
|
A network Group is a collection of enumerated communication links, which provides point-to-point communication and MPI-like collective primitives.
Each communication link in the Group has a specific rank and a representative class Connection can be accessed via connection().
The Group class is abstract, and subclasses must exist for every network implementation.
#include <group.hpp>
Public Member Functions | |
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... | |
virtual | ~Group () |
virtual destructor 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) |
Base Functions | |
size_t | my_host_rank () const |
Return our rank among hosts in this group. More... | |
virtual size_t | num_hosts () const =0 |
Return number of connections in this group (= number computing hosts) More... | |
virtual Connection & | connection (size_t id)=0 |
Return Connection to client id. More... | |
virtual void | Close ()=0 |
Close. More... | |
virtual size_t | num_parallel_async () const |
virtual std::unique_ptr< class Dispatcher > | ConstructDispatcher () const =0 |
size_t | OneFactorSize () const |
Number of of 1-factor iterations. More... | |
size_t | OneFactorPeer (size_t round) const |
Convenience Functions | |
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... | |
Synchronous Collective Communication Functions | |
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... | |
Protected Member Functions | |
Virtual Synchronous Collectives to Override Implementations | |
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) |
Protected Attributes | |
size_t | my_rank_ |
our rank in the network group More... | |
Additional Synchronous Collective Communication Functions | |
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... | |
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... | |
|
inlineexplicit |
|
inlinevirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
pure virtual |
Close.
Implemented in Group, Group, and Group.
Referenced by thrill::net::ExecuteGroupThreads(), Group::my_host_rank(), and Multiplexer::~Multiplexer().
|
pure virtual |
Return Connection to client id.
Implemented in Group, Group, and Group.
Referenced by Group::AllGatherBruck(), Group::AllGatherRecursiveDoublingPowerOfTwo(), Group::AllReduceHypercube(), MixStreamData::GetWriters(), CatStreamData::GetWriters(), Multiplexer::Multiplexer(), Group::my_host_rank(), StreamSet< StreamData >::OnWriterClosed(), Group::ReceiveFrom(), Manager::RunTask(), Group::SendReceiveReduce(), Group::SendTo(), and Manager::Traffic().
|
pure virtual |
Construct a network dispatcher object for the network backend used by this group, matching its internal implementation. A dispatcher may be shared between groups of the same type.
Implemented in Group, Group, and Group.
Referenced by Group::my_host_rank().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 204 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 240 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 276 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 222 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 258 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
protectedvirtual |
Reimplemented in Group.
Definition at line 294 of file group.cpp.
Referenced by Group::ExPrefixSum().
|
inline |
Return our rank among hosts in this group.
Definition at line 69 of file group.hpp.
References Group::Close(), Group::connection(), Group::ConstructDispatcher(), Group::my_rank_, Group::num_hosts(), and Group::num_parallel_async().
Referenced by FlowControlChannel::AllGather(), Group::AllGatherBruck(), Group::AllGatherRecursiveDoublingPowerOfTwo(), Group::AllReduceAtRoot(), Group::AllReduceElimination(), Group::AllReduceEliminationProcess(), Group::AllReduceHypercube(), Group::BroadcastBinomialTree(), Group::BroadcastTrivial(), Multiplexer::Multiplexer(), Multiplexer::my_host_rank(), FlowControlChannel::my_rank(), Group::OneFactorPeer(), Group::PrefixSumDoubling(), Group::PrefixSumHypercube(), Group::Reduce(), FlowControlChannel::Reduce(), Manager::RunTask(), Group::SendReceiveReduce(), and Manager::Traffic().
|
pure virtual |
Return number of connections in this group (= number computing hosts)
Implemented in Group, Group, and Group.
Referenced by Group::AllGatherBruck(), Group::AllGatherRecursiveDoublingPowerOfTwo(), Group::AllReduceAtRoot(), Group::AllReduceElimination(), Group::AllReduceHypercube(), Group::BroadcastBinomialTree(), Group::BroadcastTrivial(), thrill::net::ExecuteGroupThreads(), Multiplexer::Multiplexer(), Group::my_host_rank(), Multiplexer::num_hosts(), FlowControlChannel::num_workers(), Group::OneFactorPeer(), Group::OneFactorSize(), Group::PrefixSumDoubling(), Group::PrefixSumHypercube(), Group::Reduce(), Manager::RunTask(), and Manager::Traffic().
|
virtual |
Number of parallel sends or recvs requests supported by net backend, or zero if asyncs are processed sequentially as with TCP.
Reimplemented in Group.
Definition at line 166 of file group.cpp.
Referenced by Multiplexer::Multiplexer(), and Group::my_host_rank().
|
inline |
Calculate the peer of this host in the k-th iteration (of 0..p-1) of a 1-factor based network exchange algorithm.
Definition at line 96 of file group.hpp.
References thrill::common::CalcOneFactorPeer(), Group::my_host_rank(), and Group::num_hosts().
|
inline |
Number of of 1-factor iterations.
Definition at line 90 of file group.hpp.
References thrill::common::CalcOneFactorSize(), and Group::num_hosts().
non-copyable: delete assignment operator
Referenced by Group::Group().
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
inline |
Receives a serializable type from the given peer.
src | The peer to receive the fixed length type from. |
data | A pointer to the location where the received data should be stored. |
Definition at line 123 of file group.hpp.
References Group::AllGatherBruck(), Group::AllGatherRecursiveDoublingPowerOfTwo(), Group::AllReduce(), Group::AllReduceAtRoot(), Group::AllReduceElimination(), Group::AllReduceEliminationProcess(), Group::AllReduceHypercube(), Group::AllReduceSelect(), Group::AllReduceSimple(), Group::Broadcast(), Group::BroadcastBinomialTree(), Group::BroadcastSelect(), Group::BroadcastTrivial(), Group::connection(), Group::ExPrefixSum(), Group::PrefixSum(), Group::PrefixSumDoubling(), Group::PrefixSumHypercube(), Group::PrefixSumSelect(), Connection::Receive(), Group::Reduce(), Group::SendReceiveReduce(), and gen_data::value.
Referenced by Group::AllReduceAtRoot(), Group::AllReduceEliminationProcess(), Group::BroadcastBinomialTree(), Group::BroadcastTrivial(), FlowControlChannel::Predecessor(), Group::PrefixSumDoubling(), Group::PrefixSumHypercube(), and Group::Reduce().
|
inline |
Sends a serializable type to the given peer.
dest | The peer to send the data to. |
data | The data to send. |
Definition at line 112 of file group.hpp.
References Group::connection(), and Connection::Send().
Referenced by Group::AllReduceAtRoot(), Group::AllReduceEliminationProcess(), Group::BroadcastBinomialTree(), Group::BroadcastTrivial(), FlowControlChannel::Predecessor(), Group::PrefixSumDoubling(), Group::PrefixSumHypercube(), and Group::Reduce().
|
protected |
our rank in the network group
Definition at line 232 of file group.hpp.
Referenced by Group::Close(), Group::my_host_rank(), Group::Send(), and Group::tcp_connection().