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 | Protected Attributes
stapl::runtime::allreduce_object< T, BinaryOperation, NonCommutative, ComplexOperation > Class Template Reference

Performs an allreduce over all locations of the current gang. More...

Public Member Functions

 allreduce_object (context &ctx, BinaryOperation op=BinaryOperation{})
 
rmi_handle::reference const & get_rmi_handle (void) noexcept
 
rmi_handle::const_reference const & get_rmi_handle (void) const noexcept
 
template<typename U >
void operator() (U &&u)
 Initiates the allreduce. More...
 
bool valid (void) const final
 Returns true if the result has been received.
 
void wait (void) const final
 Waits for the result to be received. More...
 
void wait (context &ctx) const
 Waits for the result to be received. More...
 
get (void) final
 Returns the received result. More...
 
get (context &ctx)
 Returns the received result. More...
 
void set_value (storage_type *const p, void *const base, message_shared_ptr &m)
 Sets the result. More...
 
void set_value (T const &value)
 Sets the result. More...
 
void set_value (T &&value)
 
void set_owned (void) noexcept
 
bool is_owned (void) const noexcept
 
template<typename Function >
void async_then (Function &&f)
 

Public Types

using value_type = T
 
typedef internal_storage_type::storage_type storage_type
 

Protected Member Functions

bool valid_no_yield (void) const noexcept final
 Returns true if the result has been received.
 
void schedule_continuation (void)
 Schedules a continuation if async_then() was called.
 

Protected Attributes

std::mutex m_mtx
 

Detailed Description

template<typename T, typename BinaryOperation, bool NonCommutative = is_non_commutative<BinaryOperation>::value, bool ComplexOperation = !((std::is_empty<BinaryOperation>::value || boost::mpi::is_mpi_op<BinaryOperation, T>::value ) && is_basic<T>::value)>
class stapl::runtime::allreduce_object< T, BinaryOperation, NonCommutative, ComplexOperation >

Performs an allreduce over all locations of the current gang.

Template Parameters
TValue type.
BinaryOperationReduction operator type.
NonCommutativetrue for non-commutative operators, otherwise false.
ComplexOperationtrue for operations without MPI equivalents or on types which are non-basic, otherwise false.

Member Function Documentation

◆ operator()()

template<typename T , typename BinaryOperation , bool NonCommutative = is_non_commutative<BinaryOperation>::value, bool ComplexOperation = !((std::is_empty<BinaryOperation>::value || boost::mpi::is_mpi_op<BinaryOperation, T>::value ) && is_basic<T>::value)>
template<typename U >
void stapl::runtime::allreduce_object< T, BinaryOperation, NonCommutative, ComplexOperation >::operator() ( U &&  u)

Initiates the allreduce.

Template Parameters
uValue to contribute to the reduction.

◆ wait() [1/2]

void stapl::runtime::value_handle< T >::wait ( void  ) const
finalvirtualinherited

Waits for the result to be received.

Blocks until valid() const returns true.

Implements stapl::runtime::future_base< T >.

◆ wait() [2/2]

void stapl::runtime::value_handle< T >::wait ( context ctx) const
inherited

Waits for the result to be received.

Blocks until valid() const returns true.

◆ get() [1/2]

T stapl::runtime::value_handle< T >::get ( void  )
finalvirtualinherited

Returns the received result.

This function waits until the result has been received and returns it.

Calling valid() const returns false after a call to this function.

The lock ensures that set_value() has finished before the get() continues, to avoid calling schedule_continuation() on an object that has been destroyed.

Implements stapl::runtime::future_base< T >.

◆ get() [2/2]

T stapl::runtime::value_handle< T >::get ( context ctx)
inherited

Returns the received result.

This function waits until the result has been received and returns it.

Calling valid() const returns false after a call to this function.

The lock ensures that set_value() has finished before the get() continues, to avoid calling schedule_continuation() on an object that has been destroyed.

◆ set_value() [1/3]

void stapl::runtime::value_handle< T >::set_value ( storage_type *const  p,
void *const  base,
message_shared_ptr m 
)
inherited

Sets the result.

This function keeps a pointer to the buffer where the result remains packed until get() is called.

Parameters
pPointer to the stapl::runtime::arg_storage in the buffer.
baseAddress in the buffer that the stapl::runtime::arg_storage is stored in.
mBuffer that contains the stapl::runtime::arg_storage.
See also
arg_storage, message

◆ set_value() [2/3]

void stapl::runtime::value_handle< T >::set_value ( T const &  value)
inherited

Sets the result.

Parameters
valueValue to be set.

◆ set_value() [3/3]

void stapl::runtime::value_handle< T >::set_value ( T &&  value)
inherited


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