Thrill  0.1
Network Subsystem Layer

Modules

 Mock Network API
 
 TCP Socket API
 
 MPI Network API
 

Classes

class  AsyncReadBuffer
 
class  AsyncReadByteBlock
 
class  AsyncWriteBlock
 
class  AsyncWriteBuffer
 
class  Buffer
 Simple buffer of characters without initialization or growing functionality. More...
 
class  BufferBuilder
 BufferBuilder represents a dynamically growable area of memory, which can be modified by appending integral data types via Put() and other basic operations. More...
 
class  BufferReader
 BufferReader represents a BufferRef with an additional cursor with which the memory can be read incrementally. More...
 
class  BufferRef
 BufferRef represents a reference to a memory area as pointer and valid length. More...
 
class  Connection
 A Connection represents a link to another peer in a network group. More...
 
class  Dispatcher
 Dispatcher is a high level wrapper for asynchronous callback processing. More...
 
class  DispatcherThread
 DispatcherThread contains a net::Dispatcher object and an associated thread that runs in the dispatching loop. More...
 
class  Exception
 A Exception is thrown by Connection on all errors instead of returning error codes. More...
 
class  FixedBufferBuilder< Capacity >
 Represents a FIXED length area of memory, which can be modified by appending integral data types via Put() and other basic operations. More...
 
class  FlowControlChannel
 Provides a blocking collection for communication. More...
 
class  FlowControlChannelManager
 
class  Group
 A network Group is a collection of enumerated communication links, which provides point-to-point communication and MPI-like collective primitives. More...
 
class  Manager
 Initializes communication channels, manages communication channels and handles errors. More...
 
struct  Traffic
 

Typedefs

using AsyncCallback = tlx::delegate< bool(), mem::GPoolAllocator< char > >
 Signature of async connection readability/writability callbacks. More...
 
using AsyncDispatcherThreadCallback = tlx::delegate< void(class Dispatcher &), mem::GPoolAllocator< char > >
 Signature of generic dispatcher callback. More...
 
using AsyncReadBufferCallback = tlx::delegate< void(Connection &c, Buffer &&buffer), mem::GPoolAllocator< char > >
 Signature of async read Buffer callbacks. More...
 
using AsyncReadByteBlockCallback = tlx::delegate< void(Connection &c, data::PinnedByteBlockPtr &&bytes), mem::GPoolAllocator< char > >
 Signature of async read ByteBlock callbacks. More...
 
using AsyncReadCallback = tlx::delegate< void(Connection &c, Buffer &&buffer), mem::GPoolAllocator< char > >
 Signature of async read callbacks. More...
 
using AsyncWriteCallback = tlx::delegate< void(Connection &), mem::GPoolAllocator< char > >
 Signature of async write callbacks. More...
 
using GroupPtr = std::unique_ptr< Group >
 unique pointer to a Group. More...
 
using TimerCallback = tlx::delegate< bool(), mem::GPoolAllocator< char > >
 Signature of timer callbacks. More...
 

Functions

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<typename T , typename BinarySumOp = std::plus<T>>
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT AllReduce (const T &value, const BinarySumOp &sum_op=BinarySumOp())
 Reduces a value of a serializable type T over all workers given a certain reduce function. More...
 
template<>
void Broadcast (int &value, size_t origin)
 
template<>
void Broadcast (unsigned int &value, size_t origin)
 
template<typename T >
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT Broadcast (const T &value, size_t origin=0)
 Broadcasts a value of a serializable type T from the master (the worker with id 0) to all other workers. More...
 
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<typename Group , typename GroupCalled >
void ExecuteGroupThreads (const std::vector< std::unique_ptr< Group > > &groups, const std::function< void(GroupCalled *)> &thread_function)
 
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)
 
template<typename T , typename BinarySumOp = std::plus<T>>
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT ExPrefixSumTotal (T &value, const BinarySumOp &sum_op=BinarySumOp(), const T &initial=T())
 Calculates the exclusive prefix sum over all workers, and delivers the total sum as well. 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)
 
template<typename T , typename BinarySumOp = std::plus<T>>
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT PrefixSumBase (const T &value, const BinarySumOp &sum_op=BinarySumOp(), const T &initial=T(), bool inclusive=true)
 Calculates the prefix sum over all workers, given a certain sum operation. More...
 
void RunLoopbackGroupTest (size_t num_hosts, const std::function< void(Group *)> &thread_function)
 

Variables

static constexpr bool debug_async = false
 
static constexpr bool debug_async_recv = false
 
static constexpr bool debug_async_send = false
 

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

Additional Synchronous Collective Communication Functions

Do not use these directly in user code.

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 , 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 >
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 BroadcastSelect (T &value, size_t origin=0)
 select broadcast implementation (often due to total number of processors) 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 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...
 
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...
 

Detailed Description

Typedef Documentation

◆ AsyncCallback

typedef tlx::delegate< bool(), mem::GPoolAllocator< char > > AsyncCallback

Signature of async connection readability/writability callbacks.

Definition at line 45 of file dispatcher.hpp.

◆ AsyncDispatcherThreadCallback

Signature of generic dispatcher callback.

Definition at line 54 of file dispatcher_thread.hpp.

◆ AsyncReadBufferCallback

Signature of async read Buffer callbacks.

Definition at line 49 of file dispatcher.hpp.

◆ AsyncReadByteBlockCallback

Signature of async read ByteBlock callbacks.

Definition at line 54 of file dispatcher.hpp.

◆ AsyncReadCallback

using AsyncReadCallback = tlx::delegate< void (Connection& c, Buffer&& buffer), mem::GPoolAllocator<char> >

Signature of async read callbacks.

Definition at line 41 of file dispatcher_thread.hpp.

◆ AsyncWriteCallback

Signature of async write callbacks.

Definition at line 58 of file dispatcher.hpp.

◆ GroupPtr

using GroupPtr = std::unique_ptr<Group>

unique pointer to a Group.

Definition at line 293 of file group.hpp.

◆ TimerCallback

typedef tlx::delegate< bool(), mem::GPoolAllocator< char > > TimerCallback

Signature of timer callbacks.

Definition at line 42 of file dispatcher.hpp.

Function Documentation

◆ AllGatherBruck()

void AllGatherBruck ( T values,
size_t  n 
)

◆ AllGatherRecursiveDoublingPowerOfTwo()

void AllGatherRecursiveDoublingPowerOfTwo ( T values,
size_t  n 
)

◆ AllReduce() [1/20]

void AllReduce ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Reduce a value from all workers to all workers.

Perform an All-Reduce on the workers.

This is done by aggregating all values according to a summation operator and sending them backto all workers.

Parameters
valueThe value to be added to the aggregation
sum_opA custom summation operator

Definition at line 568 of file collective.hpp.

References Group::AllReduceSelect().

Referenced by FlowControlChannel::AllReduce(), FlowControlChannel::Barrier(), and Group::ReceiveFrom().

◆ AllReduce() [2/20]

void AllReduce ( int &  value,
std::plus< int >   
)
inline

Definition at line 383 of file group.hpp.

References Group::AllReducePlusInt().

◆ AllReduce() [3/20]

void AllReduce ( int &  value,
common::minimum< int >   
)
inline

Definition at line 387 of file group.hpp.

References Group::AllReduceMinimumInt().

◆ AllReduce() [4/20]

void AllReduce ( int &  value,
common::maximum< int >   
)
inline

Definition at line 391 of file group.hpp.

References Group::AllReduceMaximumInt().

◆ AllReduce() [5/20]

void AllReduce ( unsigned int &  value,
std::plus< unsigned int >   
)
inline

Definition at line 407 of file group.hpp.

References Group::AllReducePlusUnsignedInt().

◆ AllReduce() [6/20]

void AllReduce ( unsigned int &  value,
common::minimum< unsigned int >   
)
inline

Definition at line 411 of file group.hpp.

References Group::AllReduceMinimumUnsignedInt().

◆ AllReduce() [7/20]

void AllReduce ( unsigned int &  value,
common::maximum< unsigned int >   
)
inline

Definition at line 415 of file group.hpp.

References Group::AllReduceMaximumUnsignedInt().

◆ AllReduce() [8/20]

void AllReduce ( long &  value,
std::plus< long >   
)
inline

Definition at line 431 of file group.hpp.

References Group::AllReducePlusLong().

◆ AllReduce() [9/20]

void AllReduce ( long &  value,
common::minimum< long >   
)
inline

Definition at line 435 of file group.hpp.

References Group::AllReduceMinimumLong().

◆ AllReduce() [10/20]

void AllReduce ( long &  value,
common::maximum< long >   
)
inline

Definition at line 439 of file group.hpp.

References Group::AllReduceMaximumLong().

◆ AllReduce() [11/20]

void AllReduce ( unsigned long &  value,
std::plus< unsigned long >   
)
inline

Definition at line 455 of file group.hpp.

References Group::AllReducePlusUnsignedLong().

◆ AllReduce() [12/20]

void AllReduce ( unsigned long &  value,
common::minimum< unsigned long >   
)
inline

Definition at line 459 of file group.hpp.

References Group::AllReduceMinimumUnsignedLong().

◆ AllReduce() [13/20]

void AllReduce ( unsigned long &  value,
common::maximum< unsigned long >   
)
inline

Definition at line 463 of file group.hpp.

References Group::AllReduceMaximumUnsignedLong().

◆ AllReduce() [14/20]

void AllReduce ( long long &  value,
std::plus< long long >   
)
inline

Definition at line 479 of file group.hpp.

References Group::AllReducePlusLongLong().

◆ AllReduce() [15/20]

void AllReduce ( long long &  value,
common::minimum< long long >   
)
inline

Definition at line 483 of file group.hpp.

References Group::AllReduceMinimumLongLong().

◆ AllReduce() [16/20]

void AllReduce ( long long &  value,
common::maximum< long long >   
)
inline

Definition at line 487 of file group.hpp.

References Group::AllReduceMaximumLongLong().

◆ AllReduce() [17/20]

void AllReduce ( unsigned long long &  value,
std::plus< unsigned long long >   
)
inline

Definition at line 503 of file group.hpp.

References Group::AllReducePlusUnsignedLongLong().

◆ AllReduce() [18/20]

void AllReduce ( unsigned long long &  value,
common::minimum< unsigned long long >   
)
inline

Definition at line 507 of file group.hpp.

References Group::AllReduceMinimumUnsignedLongLong().

◆ AllReduce() [19/20]

void AllReduce ( unsigned long long &  value,
common::maximum< unsigned long long >   
)
inline

Definition at line 511 of file group.hpp.

References Group::AllReduceMaximumUnsignedLongLong().

◆ AllReduce() [20/20]

template size_t AllReduce ( const T value,
const BinarySumOp &  sum_op = BinarySumOp() 
)
inline

◆ AllReduceAtRoot()

void AllReduceAtRoot ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Broadcasts the value of the peer with index 0 to all the others.

This is a trivial broadcast from peer 0.

Parameters
valueThe value to be broadcast / receive into.
sum_opA custom summation operator

Definition at line 382 of file collective.hpp.

References Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), and Group::SendTo().

Referenced by Group::ReceiveFrom().

◆ AllReduceElimination()

void AllReduceElimination ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Perform an All-Reduce using the elimination protocol described in R.

Rabenseifner and J. L. Traeff. "More Efficient Reduction Algorithms for Non-Power-of-Two Number of Processors in Message-Passing Parallel Systems." In Recent Advances in Parallel Virtual Machine and Message Passing Interface, 36–46. LNCS 3241. Springer, 2004.

Parameters
valueThe value to be added to the aggregation
sum_opA custom summation operator

Definition at line 459 of file collective.hpp.

References Group::AllReduceEliminationProcess(), Group::my_host_rank(), and Group::num_hosts().

Referenced by Group::AllReduceSelect(), and Group::ReceiveFrom().

◆ AllReduceEliminationProcess()

void AllReduceEliminationProcess ( size_t  host_id,
size_t  group_size,
size_t  remaining_hosts,
size_t  send_to,
T value,
BinarySumOp  sum_op 
)
protected

Helper method for AllReduce().

used for the recursive implementation of the elimination protocol

Definition at line 479 of file collective.hpp.

References Group::my_host_rank(), Group::ReceiveFrom(), Group::SendReceiveReduce(), and Group::SendTo().

Referenced by Group::AllReduceElimination(), and Group::ReceiveFrom().

◆ AllReduceHypercube()

void AllReduceHypercube ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Perform an All-Reduce for powers of two.

This is done with the Hypercube algorithm from the ParAlg script.

Note
This method is no longer used, but it is kept here for reference
Parameters
valueThe value to be added to the aggregation
sum_opA custom summation operator

Definition at line 414 of file collective.hpp.

References Group::connection(), Group::my_host_rank(), Group::num_hosts(), Connection::ReceiveSend(), and Connection::SendReceive().

Referenced by Group::ReceiveFrom().

◆ AllReduceSelect()

void AllReduceSelect ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

select allreduce implementation (often due to total number of processors)

Definition at line 551 of file collective.hpp.

References Group::AllReduceElimination().

Referenced by Group::AllReduce(), and Group::ReceiveFrom().

◆ AllReduceSimple()

void AllReduceSimple ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Perform an All-Reduce on the workers.

This is done by aggregating all values according to a summation operator and sending them backto all workers.

Parameters
valueThe value to be added to the aggregation
sum_opA custom summation operator

Definition at line 368 of file collective.hpp.

References Group::Broadcast(), and Group::Reduce().

Referenced by Group::ReceiveFrom().

◆ Broadcast() [1/8]

void Broadcast ( T value,
size_t  origin = 0 
)

Broadcast a value from the worker "origin".

Broadcasts the value of the worker with index 0 to all the others.

This is a binomial tree broadcast method.

Parameters
valueThe value to be broadcast / receive into.
originThe PE to broadcast value from.

Definition at line 252 of file collective.hpp.

References Group::BroadcastSelect().

Referenced by Group::AllReduceSimple(), FlowControlChannel::Broadcast(), FlowControlChannel::ExPrefixSumTotal(), and Group::ReceiveFrom().

◆ Broadcast() [2/8]

void Broadcast ( int &  value,
size_t  origin 
)
inline

Definition at line 379 of file group.hpp.

References Group::BroadcastInt().

◆ Broadcast() [3/8]

void Broadcast ( unsigned int &  value,
size_t  origin 
)
inline

Definition at line 403 of file group.hpp.

References Group::BroadcastUnsignedInt().

◆ Broadcast() [4/8]

template std::array< size_t, 4 > Broadcast ( const T value,
size_t  origin = 0 
)
inline

Broadcasts a value of a serializable type T from the master (the worker with id 0) to all other workers.

This method is blocking on all workers except the master.

Parameters
valueThe value to broadcast. This value is ignored for each worker except the master. We use this signature to keep the decision wether a node is the master transparent.
originWorker number to broadcast value from.
Returns
The value sent by the master.

Definition at line 424 of file flow_control_channel.hpp.

References FlowControlChannel::barrier_, Group::Broadcast(), FlowControlChannel::count_broadcast_, FlowControlChannel::debug, FlowControlChannel::enable_stats, FlowControlChannel::GetNextStep(), FlowControlChannel::group_, FlowControlChannel::local_id_, LOG, FlowControlChannel::SetLocalShared(), FlowControlChannel::thread_count_, FlowControlChannel::timer_broadcast_, FlowControlChannel::timer_communication_, TLX_ATTRIBUTE_WARN_UNUSED_RESULT, gen_data::value, and ThreadBarrierSpin::wait().

Referenced by SampleNode< ValueType >::Execute(), FlowControlChannel::LocalBarrier(), MergeNode< ValueType, Comparator, kNumInputs >::MainOp(), examples::select::PickPivots(), FlowControlChannel::Predecessor(), and examples::select::Select().

◆ Broadcast() [5/8]

void Broadcast ( long &  value,
size_t  origin 
)
inline

Definition at line 427 of file group.hpp.

References Group::BroadcastLong().

◆ Broadcast() [6/8]

void Broadcast ( unsigned long &  value,
size_t  origin 
)
inline

Definition at line 451 of file group.hpp.

References Group::BroadcastUnsignedLong().

◆ Broadcast() [7/8]

void Broadcast ( long long &  value,
size_t  origin 
)
inline

Definition at line 475 of file group.hpp.

References Group::BroadcastLongLong().

◆ Broadcast() [8/8]

void Broadcast ( unsigned long long &  value,
size_t  origin 
)
inline

Definition at line 499 of file group.hpp.

References Group::BroadcastUnsignedLongLong().

◆ BroadcastBinomialTree()

void BroadcastBinomialTree ( T value,
size_t  origin = 0 
)

Broadcasts the value of the worker with index "origin" to all the others.

This is a binomial tree broadcast method.

Parameters
valueThe value to be broadcast / receive into.
originThe PE to broadcast value from.

Definition at line 205 of file collective.hpp.

References debug, tlx::ffs(), Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), tlx::round_up_to_power_of_two(), Group::SendTo(), and sLOG.

Referenced by Group::BroadcastSelect(), and Group::ReceiveFrom().

◆ BroadcastSelect()

void BroadcastSelect ( T value,
size_t  origin = 0 
)

select broadcast implementation (often due to total number of processors)

Definition at line 239 of file collective.hpp.

References Group::BroadcastBinomialTree().

Referenced by Group::Broadcast(), and Group::ReceiveFrom().

◆ BroadcastTrivial()

void BroadcastTrivial ( T value,
size_t  origin = 0 
)

Broadcasts the value of the peer with index 0 to all the others.

This is a trivial broadcast from peer 0.

Parameters
valueThe value to be broadcast / receive into.
originThe PE to broadcast value from.

Definition at line 181 of file collective.hpp.

References Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), and Group::SendTo().

Referenced by Group::ReceiveFrom().

◆ ExecuteGroupThreads()

void thrill::net::ExecuteGroupThreads ( const std::vector< std::unique_ptr< Group > > &  groups,
const std::function< void(GroupCalled *)> &  thread_function 
)

Construct a mock Group using a complete graph of local stream sockets for testing, and starts a thread for each client, which gets passed the Group object. This is ideal for testing network communication protocols.

Definition at line 299 of file group.hpp.

References Group::Close(), Group::num_hosts(), and thrill::net::RunLoopbackGroupTest().

Referenced by thrill::net::RunLoopbackGroupTest().

◆ ExPrefixSum() [1/7]

void ExPrefixSum ( T value,
BinarySumOp  sum_op = BinarySumOp(),
const T initial = T() 
)

Calculate exclusive prefix sum.

Definition at line 165 of file collective.hpp.

References Group::PrefixSumSelect().

Referenced by FlowControlChannel::ExPrefixSumTotal(), FlowControlChannel::PrefixSumBase(), and Group::ReceiveFrom().

◆ ExPrefixSum() [2/7]

void ExPrefixSum ( int &  value,
std::plus< int >  ,
const int &  initial 
)
inline

Definition at line 375 of file group.hpp.

References Group::ExPrefixSumPlusInt().

◆ ExPrefixSum() [3/7]

void ExPrefixSum ( unsigned int &  value,
std::plus< unsigned int >  ,
const unsigned int &  initial 
)
inline

Definition at line 399 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedInt().

◆ ExPrefixSum() [4/7]

void ExPrefixSum ( long &  value,
std::plus< long >  ,
const long &  initial 
)
inline

Definition at line 423 of file group.hpp.

References Group::ExPrefixSumPlusLong().

◆ ExPrefixSum() [5/7]

void ExPrefixSum ( unsigned long &  value,
std::plus< unsigned long >  ,
const unsigned long &  initial 
)
inline

Definition at line 447 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedLong().

◆ ExPrefixSum() [6/7]

void ExPrefixSum ( long long &  value,
std::plus< long long >  ,
const long long &  initial 
)
inline

Definition at line 471 of file group.hpp.

References Group::ExPrefixSumPlusLongLong().

◆ ExPrefixSum() [7/7]

void ExPrefixSum ( unsigned long long &  value,
std::plus< unsigned long long >  ,
const unsigned long long &  initial 
)
inline

Definition at line 495 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedLongLong().

◆ ExPrefixSumTotal()

template std::array< size_t, 4 > ExPrefixSumTotal ( T value,
const BinarySumOp &  sum_op = BinarySumOp(),
const T initial = T() 
)
inline

Calculates the exclusive prefix sum over all workers, and delivers the total sum as well.

The input value parameter is set to the PE's exclusive prefix sum value and the total sum is returned.

This method blocks until the sum is calculated. Values are applied in order, that means sum_op(sum_op(a, b), c) if a, b, c are the values of workers 0, 1, 2.

Parameters
valueThe local value of this worker.
sum_opThe operation to use for
initialThe initial element of the body defined by T and SumOp calculating the prefix sum. The default operation is a normal addition.
Returns
The prefix sum for the position of this worker.

Definition at line 351 of file flow_control_channel.hpp.

References FlowControlChannel::barrier_, Group::Broadcast(), FlowControlChannel::count_prefixsum_, FlowControlChannel::debug, FlowControlChannel::enable_stats, Group::ExPrefixSum(), FlowControlChannel::GetNextStep(), FlowControlChannel::group_, FlowControlChannel::host_rank_, LOG, FlowControlChannel::num_hosts_, FlowControlChannel::SetLocalShared(), FlowControlChannel::thread_count_, FlowControlChannel::timer_communication_, FlowControlChannel::timer_prefixsum_, TLX_ATTRIBUTE_WARN_UNUSED_RESULT, gen_data::value, and ThreadBarrierSpin::wait().

Referenced by RebalanceNode< ValueType >::Execute(), SampleNode< ValueType >::Execute(), FlowControlChannel::LocalBarrier(), ZipNode< ValueType, ZipFunction, Pad, UnequalCheck, NoRebalance, kNumInputs >::MainOp(), SortNode< ValueType, CompareFunction, SortAlgorithm, Stable >::MainOp(), and FlowControlChannel::Predecessor().

◆ PrefixSum() [1/7]

void PrefixSum ( T value,
BinarySumOp  sum_op = BinarySumOp(),
const T initial = T() 
)

Calculate inclusive prefix sum.

Definition at line 160 of file collective.hpp.

References Group::PrefixSumSelect().

Referenced by Group::ReceiveFrom().

◆ PrefixSum() [2/7]

void PrefixSum ( int &  value,
std::plus< int >  ,
const int &  initial 
)
inline

Definition at line 371 of file group.hpp.

References Group::PrefixSumPlusInt().

◆ PrefixSum() [3/7]

void PrefixSum ( unsigned int &  value,
std::plus< unsigned int >  ,
const unsigned int &  initial 
)
inline

Definition at line 395 of file group.hpp.

References Group::PrefixSumPlusUnsignedInt().

◆ PrefixSum() [4/7]

void PrefixSum ( long &  value,
std::plus< long >  ,
const long &  initial 
)
inline

Definition at line 419 of file group.hpp.

References Group::PrefixSumPlusLong().

◆ PrefixSum() [5/7]

void PrefixSum ( unsigned long &  value,
std::plus< unsigned long >  ,
const unsigned long &  initial 
)
inline

Definition at line 443 of file group.hpp.

References Group::PrefixSumPlusUnsignedLong().

◆ PrefixSum() [6/7]

void PrefixSum ( long long &  value,
std::plus< long long >  ,
const long long &  initial 
)
inline

Definition at line 467 of file group.hpp.

References Group::PrefixSumPlusLongLong().

◆ PrefixSum() [7/7]

void PrefixSum ( unsigned long long &  value,
std::plus< unsigned long long >  ,
const unsigned long long &  initial 
)
inline

Definition at line 491 of file group.hpp.

References Group::PrefixSumPlusUnsignedLongLong().

◆ PrefixSumBase()

template std::array< size_t, 4 > PrefixSumBase ( const T value,
const BinarySumOp &  sum_op = BinarySumOp(),
const T initial = T(),
bool  inclusive = true 
)
inline

Calculates the prefix sum over all workers, given a certain sum operation.

This method blocks until the sum is caluclated. Values are applied in order, that means sum_op(sum_op(a, b), c) if a, b, c are the values of workers 0, 1, 2.

Parameters
valueThe local value of this worker.
initialThe initial element for the body defined by T and sum_op
sum_opThe operation to use for calculating the prefix sum. The default operation is a normal addition.
inclusiveWhether the prefix sum is inclusive or exclusive.
Returns
The prefix sum for the position of this worker.

Definition at line 236 of file flow_control_channel.hpp.

References FlowControlChannel::barrier_, FlowControlChannel::count_prefixsum_, FlowControlChannel::debug, FlowControlChannel::enable_stats, Group::ExPrefixSum(), FlowControlChannel::GetNextStep(), FlowControlChannel::group_, LOG, FlowControlChannel::SetLocalShared(), FlowControlChannel::thread_count_, FlowControlChannel::timer_communication_, FlowControlChannel::timer_prefixsum_, TLX_ATTRIBUTE_WARN_UNUSED_RESULT, gen_data::value, and ThreadBarrierSpin::wait().

Referenced by FlowControlChannel::ExPrefixSum(), FlowControlChannel::LocalBarrier(), FlowControlChannel::Predecessor(), and FlowControlChannel::PrefixSum().

◆ PrefixSumDoubling()

void PrefixSumDoubling ( T value,
BinarySumOp  sum_op = BinarySumOp(),
const T initial = T(),
bool  inclusive = true 
)

Calculate for every worker his prefix sum.

The prefix sum is the aggregation of the values of all workers with lesser index, including himself, according to a summation operator. The run-time is in O(log n).

Parameters
valueThe value to be summed up
sum_opA custom summation operator
initialInitial value of prefix sum
inclusiveInclusive prefix sum if true (default)

Definition at line 52 of file collective.hpp.

References debug, Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), Group::SendTo(), sLOG, and gen_data::value.

Referenced by Group::PrefixSumSelect(), and Group::ReceiveFrom().

◆ PrefixSumHypercube()

void PrefixSumHypercube ( T value,
BinarySumOp  sum_op = BinarySumOp() 
)

Calculate for every worker his prefix sum.

Works only for worker numbers which are powers of two.

The prefix sum is an aggregatation of the values of all workers with smaller index, including itself, according to an associative summation operator. This function currently only supports worker numbers which are powers of two.

Parameters
valueThe value to be summed up
sum_opA custom summation operator

Definition at line 113 of file collective.hpp.

References debug, Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), Group::SendTo(), sLOG, and gen_data::value.

Referenced by Group::ReceiveFrom().

◆ PrefixSumSelect()

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)

Definition at line 154 of file collective.hpp.

References Group::PrefixSumDoubling().

Referenced by Group::ExPrefixSum(), Group::PrefixSum(), and Group::ReceiveFrom().

◆ Reduce()

void Reduce ( T value,
size_t  root = 0,
BinarySumOp  sum_op = BinarySumOp() 
)

Reduce a value from all workers to the worker 0.

Perform a reduction on all workers in a group.

This function aggregates the values of all workers in the group according with a specified reduction operator. The result will be returned in the input variable at the root node.

Parameters
valueThe input value to be used in the reduction. Will be overwritten with the result (on the root) or arbitrary data (on other ranks).
rootThe rank of the root
sum_opA custom reduction operator (optional)

Definition at line 331 of file collective.hpp.

References debug, Group::my_host_rank(), Group::num_hosts(), Group::ReceiveFrom(), Group::SendTo(), and sLOG.

Referenced by Group::AllReduceSimple(), Group::ReceiveFrom(), and FlowControlChannel::Reduce().

◆ RunLoopbackGroupTest()

void RunLoopbackGroupTest ( size_t  num_hosts,
const std::function< void(Group *)> &  thread_function 
)

Construct a mock or tcp-loopback Group network and run a thread for each client. The selected network implementation is platform dependent and must run without further configuration.

Definition at line 27 of file group.cpp.

References Group::ConstructLoopbackMesh(), and thrill::net::ExecuteGroupThreads().

Referenced by thrill::net::ExecuteGroupThreads().

◆ SendReceiveReduce()

T SendReceiveReduce ( size_t  peer,
const T value,
BinarySumOp  sum_op 
)
protected

Helper method for AllReduce().

Sends, receives, and reduces a serializable type from the given peer and returns the value after reduction

Parameters
peerThe peer to exchange the fixed length type with.
valueReference to the value exchange.
sum_opReduction operation.

Definition at line 465 of file collective.hpp.

References Group::connection(), Group::my_host_rank(), Connection::ReceiveSend(), and Connection::SendReceive().

Referenced by Group::AllReduceEliminationProcess(), and Group::ReceiveFrom().

Variable Documentation

◆ debug_async

constexpr bool debug_async = false
static

Definition at line 62 of file dispatcher.hpp.

Referenced by AsyncRequest::AsyncRequest(), and AsyncRequest::~AsyncRequest().

◆ debug_async_recv

constexpr bool debug_async_recv = false
static

Definition at line 64 of file dispatcher.hpp.

◆ debug_async_send

constexpr bool debug_async_send = false
static

Definition at line 63 of file dispatcher.hpp.