Thrill  0.1
Group Class Referencefinal

Detailed Description

A net group backed by virtual MPI connection.

As MPI already sets up communication, not much is done. Each Group communicates using a unique MPI tag, the group id. Each host's rank within the group is plaining its MPI rank.

Definition at line 137 of file group.hpp.

+ Inheritance diagram for Group:
+ Collaboration diagram for Group:

#include <group.hpp>

Public Member Functions

Base Functions
 Group (size_t my_rank, int group_tag, size_t group_size, DispatcherThread &dispatcher)
 Initialize a Group for the given size and rank. More...
 
int group_tag () const
 return MPI tag used to communicate More...
 
size_t num_hosts () const final
 number of hosts configured. More...
 
DispatcherThreaddispatcher ()
 reference to the main MPI dispatcher thread More...
 
net::Connectionconnection (size_t peer) final
 Return Connection to client id. More...
 
void Close () final
 Close. More...
 
size_t num_parallel_async () const final
 Number of parallel sends or recvs requests supported by net backend. More...
 
std::unique_ptr< net::DispatcherConstructDispatcher () const final
 
void Barrier ()
 run a MPI_Barrier() for synchronization. More...
 
- 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...
 
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)
 
size_t my_host_rank () const
 Return our rank among hosts in this group. More...
 
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...
 

Private Member Functions

template<typename MpiCall >
void WaitForRequest (MpiCall call)
 
Virtual Synchronous Collectives to Override Implementations
void PrefixSumPlusInt (int &value, const int &initial) final
 
void ExPrefixSumPlusInt (int &value, const int &initial) final
 
void BroadcastInt (int &value, size_t origin) final
 
void AllReducePlusInt (int &value) final
 
void AllReduceMinimumInt (int &value) final
 
void AllReduceMaximumInt (int &value) final
 
void PrefixSumPlusUnsignedInt (unsigned int &value, const unsigned int &initial) final
 
void ExPrefixSumPlusUnsignedInt (unsigned int &value, const unsigned int &initial) final
 
void BroadcastUnsignedInt (unsigned int &value, size_t origin) final
 
void AllReducePlusUnsignedInt (unsigned int &value) final
 
void AllReduceMinimumUnsignedInt (unsigned int &value) final
 
void AllReduceMaximumUnsignedInt (unsigned int &value) final
 
void PrefixSumPlusLong (long &value, const long &initial) final
 
void ExPrefixSumPlusLong (long &value, const long &initial) final
 
void BroadcastLong (long &value, size_t origin) final
 
void AllReducePlusLong (long &value) final
 
void AllReduceMinimumLong (long &value) final
 
void AllReduceMaximumLong (long &value) final
 
void PrefixSumPlusUnsignedLong (unsigned long &value, const unsigned long &initial) final
 
void ExPrefixSumPlusUnsignedLong (unsigned long &value, const unsigned long &initial) final
 
void BroadcastUnsignedLong (unsigned long &value, size_t origin) final
 
void AllReducePlusUnsignedLong (unsigned long &value) final
 
void AllReduceMinimumUnsignedLong (unsigned long &value) final
 
void AllReduceMaximumUnsignedLong (unsigned long &value) final
 
void PrefixSumPlusLongLong (long long &value, const long long &initial) final
 
void ExPrefixSumPlusLongLong (long long &value, const long long &initial) final
 
void BroadcastLongLong (long long &value, size_t origin) final
 
void AllReducePlusLongLong (long long &value) final
 
void AllReduceMinimumLongLong (long long &value) final
 
void AllReduceMaximumLongLong (long long &value) final
 
void PrefixSumPlusUnsignedLongLong (unsigned long long &value, const unsigned long long &initial) final
 
void ExPrefixSumPlusUnsignedLongLong (unsigned long long &value, const unsigned long long &initial) final
 
void BroadcastUnsignedLongLong (unsigned long long &value, size_t origin) final
 
void AllReducePlusUnsignedLongLong (unsigned long long &value) final
 
void AllReduceMinimumUnsignedLongLong (unsigned long long &value) final
 
void AllReduceMaximumUnsignedLongLong (unsigned long long &value) final
 

Private Attributes

std::vector< Connectionconns_
 vector of virtual connection objects to remote peers More...
 
DispatcherThreaddispatcher_
 reference to the main MPI dispatcher thread More...
 
int group_tag_
 this group's MPI tag More...
 

Static Private Attributes

static constexpr bool debug = false
 

Additional Inherited Members

- Protected Member Functions inherited from Group
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...
 

Constructor & Destructor Documentation

◆ Group()

Group ( size_t  my_rank,
int  group_tag,
size_t  group_size,
DispatcherThread dispatcher 
)
inline

Initialize a Group for the given size and rank.

Definition at line 146 of file group.hpp.

References thrill::net::mpi::Initialize().

Member Function Documentation

◆ AllReduceMaximumInt()

void AllReduceMaximumInt ( int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 354 of file group.cpp.

References LOG.

◆ AllReduceMaximumLong()

void AllReduceMaximumLong ( long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 460 of file group.cpp.

References LOG.

◆ AllReduceMaximumLongLong()

void AllReduceMaximumLongLong ( long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 566 of file group.cpp.

References LOG.

◆ AllReduceMaximumUnsignedInt()

void AllReduceMaximumUnsignedInt ( unsigned int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 407 of file group.cpp.

References LOG.

◆ AllReduceMaximumUnsignedLong()

void AllReduceMaximumUnsignedLong ( unsigned long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 513 of file group.cpp.

References LOG.

◆ AllReduceMaximumUnsignedLongLong()

void AllReduceMaximumUnsignedLongLong ( unsigned long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 619 of file group.cpp.

References LOG.

◆ AllReduceMinimumInt()

void AllReduceMinimumInt ( int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 345 of file group.cpp.

References LOG.

◆ AllReduceMinimumLong()

void AllReduceMinimumLong ( long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 451 of file group.cpp.

References LOG.

◆ AllReduceMinimumLongLong()

void AllReduceMinimumLongLong ( long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 557 of file group.cpp.

References LOG.

◆ AllReduceMinimumUnsignedInt()

void AllReduceMinimumUnsignedInt ( unsigned int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 398 of file group.cpp.

References LOG.

◆ AllReduceMinimumUnsignedLong()

void AllReduceMinimumUnsignedLong ( unsigned long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 504 of file group.cpp.

References LOG.

◆ AllReduceMinimumUnsignedLongLong()

void AllReduceMinimumUnsignedLongLong ( unsigned long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 610 of file group.cpp.

References LOG.

◆ AllReducePlusInt()

void AllReducePlusInt ( int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 336 of file group.cpp.

References LOG.

◆ AllReducePlusLong()

void AllReducePlusLong ( long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 442 of file group.cpp.

References LOG.

◆ AllReducePlusLongLong()

void AllReducePlusLongLong ( long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 548 of file group.cpp.

References LOG.

◆ AllReducePlusUnsignedInt()

void AllReducePlusUnsignedInt ( unsigned int &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 389 of file group.cpp.

References LOG.

◆ AllReducePlusUnsignedLong()

void AllReducePlusUnsignedLong ( unsigned long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 495 of file group.cpp.

References LOG.

◆ AllReducePlusUnsignedLongLong()

void AllReducePlusUnsignedLongLong ( unsigned long long &  value)
finalprivatevirtual

Reimplemented from Group.

Definition at line 601 of file group.cpp.

References LOG.

◆ Barrier()

void Barrier ( )

run a MPI_Barrier() for synchronization.

Definition at line 190 of file group.cpp.

References Dispatcher::AddAsyncRequest(), and Exception::Exception().

◆ BroadcastInt()

void BroadcastInt ( int &  value,
size_t  origin 
)
finalprivatevirtual

Reimplemented from Group.

Definition at line 328 of file group.cpp.

References LOG.

◆ BroadcastLong()

void BroadcastLong ( long &  value,
size_t  origin 
)
finalprivatevirtual

Reimplemented from Group.

Definition at line 434 of file group.cpp.

References LOG.

◆ BroadcastLongLong()

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

Reimplemented from Group.

Definition at line 540 of file group.cpp.

References LOG.

◆ BroadcastUnsignedInt()

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

Reimplemented from Group.

Definition at line 381 of file group.cpp.

References LOG.

◆ BroadcastUnsignedLong()

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

Reimplemented from Group.

Definition at line 487 of file group.cpp.

References LOG.

◆ BroadcastUnsignedLongLong()

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

Reimplemented from Group.

Definition at line 593 of file group.cpp.

References LOG.

◆ Close()

void Close ( )
inlinefinalvirtual

Close.

Implements Group.

Definition at line 171 of file group.hpp.

◆ connection()

net::Connection& connection ( size_t  id)
inlinefinalvirtual

Return Connection to client id.

Implements Group.

Definition at line 166 of file group.hpp.

◆ ConstructDispatcher()

std::unique_ptr< net::Dispatcher > ConstructDispatcher ( ) const
finalvirtual

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.

Implements Group.

Definition at line 185 of file group.cpp.

◆ dispatcher()

DispatcherThread& dispatcher ( )
inline

reference to the main MPI dispatcher thread

Definition at line 164 of file group.hpp.

◆ ExPrefixSumPlusInt()

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

Reimplemented from Group.

Definition at line 319 of file group.cpp.

References LOG.

◆ ExPrefixSumPlusLong()

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

Reimplemented from Group.

Definition at line 425 of file group.cpp.

References LOG.

◆ ExPrefixSumPlusLongLong()

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

Reimplemented from Group.

Definition at line 531 of file group.cpp.

References LOG.

◆ ExPrefixSumPlusUnsignedInt()

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

Reimplemented from Group.

Definition at line 372 of file group.cpp.

References LOG.

◆ ExPrefixSumPlusUnsignedLong()

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

Reimplemented from Group.

Definition at line 478 of file group.cpp.

References LOG.

◆ ExPrefixSumPlusUnsignedLongLong()

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

Reimplemented from Group.

Definition at line 584 of file group.cpp.

References LOG.

◆ group_tag()

int group_tag ( ) const
inline

return MPI tag used to communicate

Definition at line 158 of file group.hpp.

◆ num_hosts()

size_t num_hosts ( ) const
inlinefinalvirtual

number of hosts configured.

Implements Group.

Definition at line 161 of file group.hpp.

◆ num_parallel_async()

size_t num_parallel_async ( ) const
finalvirtual

Number of parallel sends or recvs requests supported by net backend.

Reimplemented from Group.

Definition at line 181 of file group.cpp.

◆ PrefixSumPlusInt()

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

Reimplemented from Group.

Definition at line 310 of file group.cpp.

References LOG.

◆ PrefixSumPlusLong()

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

Reimplemented from Group.

Definition at line 416 of file group.cpp.

References LOG.

◆ PrefixSumPlusLongLong()

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

Reimplemented from Group.

Definition at line 522 of file group.cpp.

References LOG.

◆ PrefixSumPlusUnsignedInt()

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

Reimplemented from Group.

Definition at line 363 of file group.cpp.

References LOG.

◆ PrefixSumPlusUnsignedLong()

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

Reimplemented from Group.

Definition at line 469 of file group.cpp.

References LOG.

◆ PrefixSumPlusUnsignedLongLong()

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

Reimplemented from Group.

Definition at line 575 of file group.cpp.

References LOG.

◆ WaitForRequest()

void WaitForRequest ( MpiCall  call)
private

Definition at line 214 of file group.cpp.

References Dispatcher::AddAsyncRequest(), and Exception::Exception().

Member Data Documentation

◆ conns_

std::vector<Connection> conns_
private

vector of virtual connection objects to remote peers

Definition at line 191 of file group.hpp.

◆ debug

constexpr bool debug = false
staticprivate

Definition at line 139 of file group.hpp.

◆ dispatcher_

DispatcherThread& dispatcher_
private

reference to the main MPI dispatcher thread

Definition at line 194 of file group.hpp.

◆ group_tag_

int group_tag_
private

this group's MPI tag

Definition at line 188 of file group.hpp.


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