Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Network Subsystem Layer
+ Collaboration diagram for 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 >)
 
template<>
void ExPrefixSum (unsigned int &value, std::plus< unsigned int >)
 
template<>
void ExPrefixSum (long &value, std::plus< long >)
 
template<>
void ExPrefixSum (unsigned long &value, std::plus< unsigned long >)
 
template<>
void ExPrefixSum (long long &value, std::plus< long long >)
 
template<>
void ExPrefixSum (unsigned long long &value, std::plus< unsigned long long >)
 
template<typename T , typename BinarySumOp = std::plus<T>>
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT ExPrefixSumTotal (T &value, const T &initial=T(), const BinarySumOp &sum_op=BinarySumOp())
 Calculates the exclusive prefix sum over all workers, and delivers the total sum as well. More...
 
template<typename T , typename BinarySumOp = std::plus<T>>
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT PrefixSum (const T &value, const T &initial=T(), const BinarySumOp &sum_op=BinarySumOp(), bool inclusive=true)
 Calculates the prefix sum over all workers, given a certain sum operation. More...
 
template<>
void PrefixSum (int &value, std::plus< int >)
 
template<>
void PrefixSum (unsigned int &value, std::plus< unsigned int >)
 
template<>
void PrefixSum (long &value, std::plus< long >)
 
template<>
void PrefixSum (unsigned long &value, std::plus< unsigned long >)
 
template<>
void PrefixSum (long long &value, std::plus< long long >)
 
template<>
void PrefixSum (unsigned long long &value, std::plus< unsigned long long >)
 
void RunLoopbackGroupTest (size_t num_hosts, const std::function< void(Group *)> &thread_function)
 

Variables

static constexpr bool debug_async = false
 

Synchronous Collective Communication Functions

template<typename T , typename BinarySumOp = std::plus<T>>
void PrefixSum (T &value, BinarySumOp sum_op=BinarySumOp())
 Calculate inclusive prefix sum. More...
 
template<typename T , typename BinarySumOp = std::plus<T>>
void ExPrefixSum (T &value, BinarySumOp sum_op=BinarySumOp())
 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(), 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(), 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 , 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

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

Signature of async connection readability/writability callbacks.

Definition at line 45 of file dispatcher.hpp.

using AsyncDispatcherThreadCallback = tlx::delegate< void(class Dispatcher&), mem::GPoolAllocator<char> >

Signature of generic dispatcher callback.

Definition at line 54 of file dispatcher_thread.hpp.

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

Signature of async read Buffer callbacks.

Definition at line 49 of file dispatcher.hpp.

typedef tlx::delegate< void(Connection &c, data::PinnedByteBlockPtr &&block), mem::GPoolAllocator< char > > AsyncReadByteBlockCallback

Signature of async read ByteBlock callbacks.

Definition at line 54 of file dispatcher.hpp.

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.

typedef tlx::delegate< void(Connection &), mem::GPoolAllocator< char > > AsyncWriteCallback

Signature of async write callbacks.

Definition at line 58 of file dispatcher.hpp.

using GroupPtr = std::unique_ptr<Group>

unique pointer to a Group.

Definition at line 283 of file group.hpp.

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

Signature of timer callbacks.

Definition at line 42 of file dispatcher.hpp.

Function Documentation

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 503 of file collective.hpp.

References Group::AllReduceSelect().

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

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

Definition at line 373 of file group.hpp.

References Group::AllReducePlusInt().

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

Definition at line 377 of file group.hpp.

References Group::AllReduceMinimumInt().

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

Definition at line 381 of file group.hpp.

References Group::AllReduceMaximumInt().

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

Definition at line 397 of file group.hpp.

References Group::AllReducePlusUnsignedInt().

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

Definition at line 401 of file group.hpp.

References Group::AllReduceMinimumUnsignedInt().

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

Definition at line 405 of file group.hpp.

References Group::AllReduceMaximumUnsignedInt().

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

Definition at line 421 of file group.hpp.

References Group::AllReducePlusLong().

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

Definition at line 425 of file group.hpp.

References Group::AllReduceMinimumLong().

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

Definition at line 429 of file group.hpp.

References Group::AllReduceMaximumLong().

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

Definition at line 445 of file group.hpp.

References Group::AllReducePlusUnsignedLong().

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

Definition at line 449 of file group.hpp.

References Group::AllReduceMinimumUnsignedLong().

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

Definition at line 453 of file group.hpp.

References Group::AllReduceMaximumUnsignedLong().

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

Definition at line 469 of file group.hpp.

References Group::AllReducePlusLongLong().

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

Definition at line 473 of file group.hpp.

References Group::AllReduceMinimumLongLong().

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

Definition at line 477 of file group.hpp.

References Group::AllReduceMaximumLongLong().

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

Definition at line 493 of file group.hpp.

References Group::AllReducePlusUnsignedLongLong().

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

Definition at line 497 of file group.hpp.

References Group::AllReduceMinimumUnsignedLongLong().

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

Definition at line 501 of file group.hpp.

References Group::AllReduceMaximumUnsignedLongLong().

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

Reduces a value of a serializable type T over all workers given a certain reduce function.

This method is blocking. The reduce happens in order as with prefix sum. The operation is assumed to be associative.

Parameters
valueThe value to use for the reduce operation.
sum_opThe operation to use for calculating the reduced value. The default operation is a normal addition.
Returns
The result of the reduce operation.

Definition at line 522 of file flow_control_channel.hpp.

References Group::AllReduce(), ThreadBarrierSpinning::Await(), FlowControlChannel::barrier_, FlowControlChannel::count_allreduce_, FlowControlChannel::debug, FlowControlChannel::enable_stats, FlowControlChannel::GetNextStep(), FlowControlChannel::group_, LOG, FlowControlChannel::SetLocalShared(), FlowControlChannel::thread_count_, FlowControlChannel::timer_allreduce_, FlowControlChannel::timer_communication_, and gen_data::value.

Referenced by ConcatNode< ValueType >::Execute(), MergeNode< ValueType, Comparator, kNumInputs >::GetGlobalRanks(), MergeNode< ValueType, Comparator, kNumInputs >::MainOp(), MergeNode< ValueType, Comparator, kNumInputs >::Stats::Print(), and MergeNode< ValueType, Comparator, kNumInputs >::SelectPivots().

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 317 of file collective.hpp.

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

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 394 of file collective.hpp.

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

Referenced by Group::AllReduceSelect().

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 414 of file collective.hpp.

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

Referenced by Group::AllReduceElimination().

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 349 of file collective.hpp.

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

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 303 of file collective.hpp.

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

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 244 of file collective.hpp.

References Group::BroadcastSelect().

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

void Broadcast ( int &  value,
size_t  origin 
)
inline

Definition at line 369 of file group.hpp.

References Group::BroadcastInt().

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

Definition at line 393 of file group.hpp.

References Group::BroadcastUnsignedInt().

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 411 of file flow_control_channel.hpp.

References ThreadBarrierSpinning::Await(), 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_, and gen_data::value.

Referenced by MergeNode< ValueType, Comparator, kNumInputs >::MainOp(), examples::select::PickPivots(), and examples::select::Select().

void Broadcast ( long &  value,
size_t  origin 
)
inline

Definition at line 417 of file group.hpp.

References Group::BroadcastLong().

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

Definition at line 441 of file group.hpp.

References Group::BroadcastUnsignedLong().

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

Definition at line 465 of file group.hpp.

References Group::BroadcastLongLong().

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

Definition at line 489 of file group.hpp.

References Group::BroadcastUnsignedLongLong().

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 197 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().

void BroadcastSelect ( T value,
size_t  origin = 0 
)
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 173 of file collective.hpp.

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

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 289 of file group.hpp.

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

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

Calculate exclusive prefix sum.

Definition at line 157 of file collective.hpp.

References Group::PrefixSumSelect().

Referenced by FlowControlChannel::ExPrefixSumTotal(), and FlowControlChannel::PrefixSum().

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

Definition at line 365 of file group.hpp.

References Group::ExPrefixSumPlusInt().

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

Definition at line 389 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedInt().

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

Definition at line 413 of file group.hpp.

References Group::ExPrefixSumPlusLong().

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

Definition at line 437 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedLong().

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

Definition at line 461 of file group.hpp.

References Group::ExPrefixSumPlusLongLong().

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

Definition at line 485 of file group.hpp.

References Group::ExPrefixSumPlusUnsignedLongLong().

template std::array< size_t, 4 > ExPrefixSumTotal ( T value,
const T initial = T(),
const BinarySumOp &  sum_op = BinarySumOp() 
)
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 334 of file flow_control_channel.hpp.

References ThreadBarrierSpinning::Await(), 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_, and gen_data::value.

Referenced by ZipNode< ValueType, ZipFunction, Pad, UnequalCheck, NoRebalance, kNumInputs >::MainOp(), ZipWindowNode< ValueType, ZipFunction_, Pad_, UnequalCheck, UseStdArray, kNumInputs_ >::MainOp(), and SortNode< ValueType, CompareFunction, SortAlgorithm >::MainOp().

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

Calculate inclusive prefix sum.

Definition at line 152 of file collective.hpp.

References Group::PrefixSumSelect().

template std::array< size_t, 4 > PrefixSum ( const T value,
const T initial = T(),
const BinarySumOp &  sum_op = BinarySumOp(),
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 235 of file flow_control_channel.hpp.

References ThreadBarrierSpinning::Await(), FlowControlChannel::barrier_, FlowControlChannel::count_prefixsum_, FlowControlChannel::debug, FlowControlChannel::enable_stats, Group::ExPrefixSum(), FlowControlChannel::GetNextStep(), FlowControlChannel::group_, FlowControlChannel::host_rank_, LOG, FlowControlChannel::SetLocalShared(), FlowControlChannel::thread_count_, FlowControlChannel::timer_communication_, FlowControlChannel::timer_prefixsum_, and gen_data::value.

Referenced by ConcatNode< ValueType >::Execute(), and FlowControlChannel::ExPrefixSum().

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

Definition at line 361 of file group.hpp.

References Group::PrefixSumPlusInt().

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

Definition at line 385 of file group.hpp.

References Group::PrefixSumPlusUnsignedInt().

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

Definition at line 409 of file group.hpp.

References Group::PrefixSumPlusLong().

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

Definition at line 433 of file group.hpp.

References Group::PrefixSumPlusUnsignedLong().

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

Definition at line 457 of file group.hpp.

References Group::PrefixSumPlusLongLong().

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

Definition at line 481 of file group.hpp.

References Group::PrefixSumPlusUnsignedLongLong().

void PrefixSumDoubling ( T value,
BinarySumOp  sum_op = BinarySumOp(),
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
inclusiveInclusive prefix sum if true (default)

Definition at line 50 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().

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 106 of file collective.hpp.

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

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 266 of file collective.hpp.

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

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

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

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 400 of file collective.hpp.

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

Referenced by Group::AllReduceEliminationProcess().

Variable Documentation