STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Classes | Public Member Functions | Public Types | Protected Member Functions | Protected Attributes
stapl::map_reduce_factory< MapWF, ReduceWF, b_coarse > Struct Template Reference

Factory that generates the tasks needed for a map reduce operation. A map reduce operation applies the map work function provided on each set of elements of the input views that have the same offset from the beginning of their respective view. The map operations return values that are combined using the reduce operation provided to form a single result value. The result value is returned to each location in the gang executing the map_reduce call. More...

Classes

struct  result
 Computes the type of the result of the map_reduce PARAGRAPH for the set of views, map operation, and reduce operation provided. More...
 

Public Member Functions

 map_reduce_factory (MapWF const &map_wf, ReduceWF const &reduce_wf)
 
coarsener_type get_coarsener () const
 
void reset ()
 Reset all data members related to the number of tasks that have been generated in order to prepare the factory for PARAGRAPH reinvocation.
 
bool finished () const
 
runtime::location_md const & get_location_md (void) const noexcept
 Returns the location metadata of the location this object registered in.
 
runtime::location_mdget_location_md (void) noexcept
 Returns the location metadata of the location this object registered in. noexcept More...
 
Distributed Object Management
rmi_handle::const_reference const & get_rmi_handle (void) const noexcept
 Returns the associated rmi_handle.
 
rmi_handle::reference const & get_rmi_handle (void) noexcept
 Returns the associated rmi_handle.
 
size_type get_location_id (void) const noexcept
 Returns the location id of the local sub-object.
 
size_type get_num_locations (void) const noexcept
 Returns the number of locations of the gang of this p_object.
 
void advance_epoch (void)
 Advances the epoch of the object. More...
 
void unlock (void)
 Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs. More...
 
void lock (void)
 Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs. More...
 
bool try_lock (void)
 Attempt to maintain atomicity with respect to incoming RMIs. More...
 

Public Types

using coarsener_type = typename std::conditional< b_coarse, default_coarsener, null_coarsener >::type
 
using size_type = rmi_handle::size_type
 

Protected Member Functions

bool initialized (void) const
 
void reset_view_indices ()
 Reset the iterators over the view indices on this location. More...
 
void set_view_index_iterator (std::size_t idx, view_index_iterator_base *ptr)
 
std::size_t view_indices_size () const
 
view_index_iterator_baseget_view_index_iterator (std::size_t n) const
 

Protected Attributes

bool m_finished
 Stores whether the derived factory has finished specifying tasks.
 

Detailed Description

template<typename MapWF, typename ReduceWF, bool b_coarse>
struct stapl::map_reduce_factory< MapWF, ReduceWF, b_coarse >

Factory that generates the tasks needed for a map reduce operation. A map reduce operation applies the map work function provided on each set of elements of the input views that have the same offset from the beginning of their respective view. The map operations return values that are combined using the reduce operation provided to form a single result value. The result value is returned to each location in the gang executing the map_reduce call.

Template Parameters
MapWFFine-grain operation to be applied to each set of elements.
ReduceWFFine-grain reduce operation used to combine the results of the applications of the map operation.
b_coarseIndicates whether the map operation provided is coarse-grain.

The factory uses coarse_map_reduce_wf as the work function for the map tasks when the MapWF is a fine-grain operation. The results of the coarse-grain map operations are combined using a binary reduction tree. If the number of tasks used to perform the coarse-grain map operations isn't a power of two a set of binary trees whose widths are the powers of two that sum to equal the number of coarse-grain map operations is generated, and the results of the trees are combined to form the final result. The final result of the computation is pushed to all locations using a set of tasks that form a broadcast tree.

Member Function Documentation

◆ reset_view_indices()

void stapl::task_factory_base::reset_view_indices ( )
protectedinherited

Reset the iterators over the view indices on this location.

This is used in factories where multiple tasks will be generated for each view element to be processed.

◆ get_location_md()

runtime::location_md& stapl::p_object::get_location_md ( void  )
noexceptinherited

Returns the location metadata of the location this object registered in. noexcept

noexcept

◆ advance_epoch()

void stapl::p_object::advance_epoch ( void  )
inherited

Advances the epoch of the object.

Advancing the epoch will flush any pending RMIs. It will also increase the epoch of the current gang if the object is not a named object.

◆ unlock()

void stapl::p_object::unlock ( void  )
inherited

Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

◆ lock()

void stapl::p_object::lock ( void  )
inherited

Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

◆ try_lock()

bool stapl::p_object::try_lock ( void  )
inherited

Attempt to maintain atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

Returns
true if the lock was able to be acquired. false if it is already locked.

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