STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Static Public Attributes
stapl::skeletons::skeletons_impl::reduce_to_pow_two_pd< Op > Class Template Reference

This parametric dependency is used in the preprocessing phase of various algorithms that only accept power-of-two input sizes. More...

Public Member Functions

 reduce_to_pow_two_pd (Op op)
 
template<typename Coord , typename Visitor , typename In >
void case_of (Coord const &skeleton_size, Coord const &coord, Visitor &visitor, In &&in_flow) const
 If coord is <i, ...> it wraps the Op and sends it to the visitor. If q is the closest smaller power of two to n (r = n - q) and i < 2*r the following inputs are used: More...
 
template<typename Size , typename Coord , typename FlowIndex >
std::size_t consumer_count (Size const &, Coord const &, FlowIndex) const
 Determines how many of the instances of this parametric dependency will be consuming from a producer with a given coordinate. This is a reverse query as compared to case_of. More...
 
Op get_op () const
 
template<typename Coord >
int get_result_id (Coord const &, Coord const &) const
 
template<typename Coord , typename Span >
void configure (Coord &&, Span &&)
 

Public Types

using op_type = Op
 

Static Public Attributes

static constexpr std::size_t in_port_size = 1
 
static constexpr std::size_t op_arity = 2
 

Detailed Description

template<typename Op>
class stapl::skeletons::skeletons_impl::reduce_to_pow_two_pd< Op >

This parametric dependency is used in the preprocessing phase of various algorithms that only accept power-of-two input sizes.

This method of size reduction is known as 2-to-1 preprocessing phase which is used in reduction algorithm. Basically, if the input size is n and the closest smaller power-of-two is m. The first 2*(n - m) = 2*r elements are combined given the Op in order to form r elements. The other r elements are just copied using the stapl::identity.

Template Parameters
Opthe workfunction to be applied on each pair of elements

Member Function Documentation

◆ case_of()

template<typename Op >
template<typename Coord , typename Visitor , typename In >
void stapl::skeletons::skeletons_impl::reduce_to_pow_two_pd< Op >::case_of ( Coord const &  skeleton_size,
Coord const &  coord,
Visitor &  visitor,
In &&  in_flow 
) const

If coord is <i, ...> it wraps the Op and sends it to the visitor. If q is the closest smaller power of two to n (r = n - q) and i < 2*r the following inputs are used:

  • in<0>[i*2]
  • in<0>[i*2 +1]

Otherwise identity is used with the following input:

  • in<0>[i+r]
Parameters
skeleton_size<n, m, p, ...> where each element is potentially multi-dimensional.
coord<i, j, k, ...> where i < n, j < m, k < p
visitorthe information about Op and input is passed so that later this information can be converted to a node in the dependence graph
in_flowa tuple of input flows to consume from

◆ consumer_count()

template<typename Op >
template<typename Size , typename Coord , typename FlowIndex >
std::size_t stapl::skeletons::skeletons_impl::reduce_to_pow_two_pd< Op >::consumer_count ( Size const &  ,
Coord const &  ,
FlowIndex   
) const

Determines how many of the instances of this parametric dependency will be consuming from a producer with a given coordinate. This is a reverse query as compared to case_of.

Template Parameters
FlowIndexthe flow index to which this request is sent

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