Thrill  0.1
Group Class Referenceabstract

Detailed Description

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.

Definition at line 47 of file group.hpp.

+ Inheritance diagram for Group:

#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)
 
Groupoperator= (const Group &)=delete
 non-copyable: delete assignment operator More...
 
Groupoperator= (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 Connectionconnection (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 DispatcherConstructDispatcher () 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

Do not use these directly in user code.

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

Constructor & Destructor Documentation

◆ Group() [1/3]

Group ( size_t  my_rank)
inlineexplicit

initializing constructor

Definition at line 51 of file group.hpp.

References Group::operator=().

◆ Group() [2/3]

Group ( const Group )
delete

non-copyable: delete copy-constructor

◆ Group() [3/3]

Group ( Group &&  )
default

move-constructor: default

◆ ~Group()

virtual ~Group ( )
inlinevirtual

virtual destructor

Reimplemented in Group, and Group.

Definition at line 63 of file group.hpp.

Member Function Documentation

◆ AllReduceMaximumInt()

void AllReduceMaximumInt ( int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 216 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMaximumLong()

void AllReduceMaximumLong ( long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 252 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMaximumLongLong()

void AllReduceMaximumLongLong ( long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 288 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMaximumUnsignedInt()

void AllReduceMaximumUnsignedInt ( unsigned int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 234 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMaximumUnsignedLong()

void AllReduceMaximumUnsignedLong ( unsigned long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 270 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMaximumUnsignedLongLong()

void AllReduceMaximumUnsignedLongLong ( unsigned long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 306 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumInt()

void AllReduceMinimumInt ( int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 213 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumLong()

void AllReduceMinimumLong ( long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 249 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumLongLong()

void AllReduceMinimumLongLong ( long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 285 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumUnsignedInt()

void AllReduceMinimumUnsignedInt ( unsigned int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 231 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumUnsignedLong()

void AllReduceMinimumUnsignedLong ( unsigned long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 267 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReduceMinimumUnsignedLongLong()

void AllReduceMinimumUnsignedLongLong ( unsigned long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 303 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusInt()

void AllReducePlusInt ( int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 210 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusLong()

void AllReducePlusLong ( long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 246 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusLongLong()

void AllReducePlusLongLong ( long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 282 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusUnsignedInt()

void AllReducePlusUnsignedInt ( unsigned int &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 228 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusUnsignedLong()

void AllReducePlusUnsignedLong ( unsigned long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 264 of file group.cpp.

Referenced by Group::AllReduce().

◆ AllReducePlusUnsignedLongLong()

void AllReducePlusUnsignedLongLong ( unsigned long long &  value)
protectedvirtual

Reimplemented in Group.

Definition at line 300 of file group.cpp.

Referenced by Group::AllReduce().

◆ BroadcastInt()

void BroadcastInt ( int &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 207 of file group.cpp.

Referenced by Group::Broadcast().

◆ BroadcastLong()

void BroadcastLong ( long &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 243 of file group.cpp.

Referenced by Group::Broadcast().

◆ BroadcastLongLong()

void BroadcastLongLong ( long long &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 279 of file group.cpp.

Referenced by Group::Broadcast().

◆ BroadcastUnsignedInt()

void BroadcastUnsignedInt ( unsigned int &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 225 of file group.cpp.

Referenced by Group::Broadcast().

◆ BroadcastUnsignedLong()

void BroadcastUnsignedLong ( unsigned long &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 261 of file group.cpp.

Referenced by Group::Broadcast().

◆ BroadcastUnsignedLongLong()

void BroadcastUnsignedLongLong ( unsigned long long &  value,
size_t  origin 
)
protectedvirtual

Reimplemented in Group.

Definition at line 297 of file group.cpp.

Referenced by Group::Broadcast().

◆ Close()

virtual void Close ( )
pure virtual

◆ connection()

◆ ConstructDispatcher()

virtual std::unique_ptr<class Dispatcher> ConstructDispatcher ( ) const
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().

◆ ExPrefixSumPlusInt()

void ExPrefixSumPlusInt ( int &  value,
const int &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 204 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ ExPrefixSumPlusLong()

void ExPrefixSumPlusLong ( long &  value,
const long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 240 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ ExPrefixSumPlusLongLong()

void ExPrefixSumPlusLongLong ( long long &  value,
const long long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 276 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ ExPrefixSumPlusUnsignedInt()

void ExPrefixSumPlusUnsignedInt ( unsigned int &  value,
const unsigned int &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 222 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ ExPrefixSumPlusUnsignedLong()

void ExPrefixSumPlusUnsignedLong ( unsigned long &  value,
const unsigned long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 258 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ ExPrefixSumPlusUnsignedLongLong()

void ExPrefixSumPlusUnsignedLongLong ( unsigned long long &  value,
const unsigned long long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 294 of file group.cpp.

Referenced by Group::ExPrefixSum().

◆ my_host_rank()

◆ num_hosts()

◆ num_parallel_async()

size_t num_parallel_async ( ) const
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().

◆ OneFactorPeer()

size_t OneFactorPeer ( size_t  round) const
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().

◆ OneFactorSize()

size_t OneFactorSize ( ) const
inline

Number of of 1-factor iterations.

Definition at line 90 of file group.hpp.

References thrill::common::CalcOneFactorSize(), and Group::num_hosts().

◆ operator=() [1/2]

Group& operator= ( const Group )
delete

non-copyable: delete assignment operator

Referenced by Group::Group().

◆ operator=() [2/2]

Group& operator= ( Group &&  )
default

move-assignment operator: default

◆ PrefixSumPlusInt()

void PrefixSumPlusInt ( int &  value,
const int &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 201 of file group.cpp.

Referenced by Group::PrefixSum().

◆ PrefixSumPlusLong()

void PrefixSumPlusLong ( long &  value,
const long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 237 of file group.cpp.

Referenced by Group::PrefixSum().

◆ PrefixSumPlusLongLong()

void PrefixSumPlusLongLong ( long long &  value,
const long long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 273 of file group.cpp.

Referenced by Group::PrefixSum().

◆ PrefixSumPlusUnsignedInt()

void PrefixSumPlusUnsignedInt ( unsigned int &  value,
const unsigned int &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 219 of file group.cpp.

Referenced by Group::PrefixSum().

◆ PrefixSumPlusUnsignedLong()

void PrefixSumPlusUnsignedLong ( unsigned long &  value,
const unsigned long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 255 of file group.cpp.

Referenced by Group::PrefixSum().

◆ PrefixSumPlusUnsignedLongLong()

void PrefixSumPlusUnsignedLongLong ( unsigned long long &  value,
const unsigned long long &  initial 
)
protectedvirtual

Reimplemented in Group.

Definition at line 291 of file group.cpp.

Referenced by Group::PrefixSum().

◆ ReceiveFrom()

◆ SendTo()

void SendTo ( size_t  dest,
const T data 
)
inline

Sends a serializable type to the given peer.

Parameters
destThe peer to send the data to.
dataThe 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().

Member Data Documentation

◆ my_rank_

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


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