STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Protected Member Functions
stapl::terminator< T, BinaryOperation > Class Template Reference

General termination detection. More...

Public Member Functions

template<typename ValueFunction >
 terminator (BinaryOperation op, ValueFunction &&value_fun, bool b_only_local=false)
 
void operator() (void) override
 Starts this terminator if required.
 
size_type iterations (void) const noexcept override
 Returns the number of times the terminator has iterated. More...
 
template<typename Notifier >
void set_notifier (Notifier &&notifier)
 Sets the function to be called when termination is detected.
 

Public Types

using size_type = std::size_t
 

Protected Member Functions

void call_notifier (void) const
 Calls the registered notifier when the terminator has finished.
 

Detailed Description

template<typename T, typename BinaryOperation>
class stapl::terminator< T, BinaryOperation >

General termination detection.

Template Parameters
TObject type of the termination detection.
BinaryOperationBinary operation function object type to be applied.

This terminator does a reduction and compares the resulting value against a known termination value. If they are the same, it calls the notify function.

It implements a phased termination consisting of 3 states:

  1. State A: Do allreduce. If the return value is the same as the termination value, goto State B, otherwise goto State A.
  2. State B: Do allreduce. If the return value is the same as the termination value, goto State C, otherwise goto State A.
  3. State C: Termination detection succeeded.
See also
terminator_base

Constructor & Destructor Documentation

◆ terminator()

template<typename T , typename BinaryOperation >
template<typename ValueFunction >
stapl::terminator< T, BinaryOperation >::terminator ( BinaryOperation  op,
ValueFunction &&  value_fun,
bool  b_only_local = false 
)
Parameters
opBinary operation used to aggregate results from multiple locations.
value_funFunction return value for a given location.
termination_valueThe value that the aggregate of all locations must be equal to for termination detection to succeed.
b_local_onlyRuntime flag disabling use of global condition. Each location independently terminates when its result of value_fun equals termination_value.

Member Function Documentation

◆ iterations()

template<typename T , typename BinaryOperation >
size_type stapl::terminator< T, BinaryOperation >::iterations ( void  ) const
overridevirtualnoexcept

Returns the number of times the terminator has iterated.

Implements stapl::terminator_base.


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