STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
Modules | Functions
Executable Skeletons

Executable skeletons change functional skeletons from higher-order functions to regular functions by providing access to the input data. More...

+ Collaboration diagram for Executable Skeletons:

Modules

 Executable Skeletons Internal
 

Functions

template<typename MapOp , typename ... V>
void stapl::map_func (MapOp const &map_op, V &&... views)
 Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided. More...
 
template<typename MapOp , typename ReduceOp , typename ... V>
std::enable_if< !std::is_base_of< skeletons::tags::coarsening_tag, MapOp >::value, stapl::result_of::map_reduce< stapl::use_default, MapOp, ReduceOp, V... >>::type::type stapl::map_reduce (MapOp const &map_op, ReduceOp const &reduce_op, V &&... v)
 Applies map-reduce on a set of inputs. In the first step the given map operation (zip operation if there is more than one view involved) on the given inputs and the results are reduce using the given reduce operation (reduce_op) More...
 
template<typename Tag , typename MapOp , typename ReduceOp , typename ... V>
stapl::result_of::map_reduce< Tag, MapOp, ReduceOp, V... >::type stapl::map_reduce (MapOp const &map_op, ReduceOp const &reduce_op, V &&... v)
 Applies map-reduce on the given input by using the specific map_reduce implementation specified by the given tag. Current set of tags which can be used for map_reduce are: More...
 
template<typename Scheduler , typename MapOp , typename ReduceOp , typename ... V>
stapl::result_of::map_reduce< stapl::use_default, MapOp, ReduceOp, V... >::type stapl::map_reduce_sched (Scheduler const &scheduler, MapOp const &map_op, ReduceOp const &reduce_op, V &&... v)
 Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided. The scheduler provided will be used by the executor processing the tasks of the PARAGRAPH as it is executed. More...
 
template<typename Scheduler , typename MapOp , typename ... V>
void stapl::map_func_sched (Scheduler const &scheduler, MapOp const &map_op, V &&... views)
 Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided. The scheduler provided will be used by the executor processing the tasks of the PARAGRAPH as it is executed. More...
 
template<typename Tag = stapl::use_default, typename View , typename BinaryOp >
std::decay< View >::type::value_type stapl::reduce (View &&view, BinaryOp const &binop)
 Users can specify which version of the reduce skeleton to be used for reduction algorithm. The possible choices are. More...
 
template<typename ScanTag , typename CoarseTag , typename View0 , typename View1 , typename Binop >
void stapl::scan (View0 &&view0, View1 &&view1, Binop binop)
 A scan is an operation in which each element in the results is the result of the cumulative operation on all elements before it. It can be one of two types. More...
 
template<typename CoarseTag = stapl::use_default, typename View0 , typename View1 , typename Binop >
void stapl::scan (View0 &&view0, View1 &&view1, Binop binop, bool shift=false)
 A scan is an operation in which each element in the results is the result of the cumulative operation on all elements before it. It can be one of two types. More...
 
template<typename ScanTag , typename CoarseTag , typename View0 , typename View1 , typename Binop >
std::decay< View0 >::type::value_type stapl::scan_reduce (View0 &&view0, View1 &&view1, Binop binop)
 combines the functionality of scan and reduce skeleton. More...
 
template<typename CoarseTag = stapl::use_default, typename View0 , typename View1 , typename Binop >
std::decay< View0 >::type::value_type stapl::scan_reduce (View0 &&view0, View1 &&view1, Binop binop, bool shift=false)
 Combines the functionality of scan and reduce skeleton. More...
 

Detailed Description

Executable skeletons change functional skeletons from higher-order functions to regular functions by providing access to the input data.

Function Documentation

◆ map_func()

template<typename MapOp , typename ... V>
void stapl::map_func ( MapOp const &  map_op,
V &&...  views 
)

Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided.

Parameters
map_opFine-grain map work function.
viewsOne or more views to process with the map work function.

◆ map_reduce() [1/2]

template<typename MapOp , typename ReduceOp , typename ... V>
std::enable_if< !std::is_base_of<skeletons::tags::coarsening_tag, MapOp>::value, stapl::result_of::map_reduce<stapl::use_default, MapOp, ReduceOp, V...>>::type::type stapl::map_reduce ( MapOp const &  map_op,
ReduceOp const &  reduce_op,
V &&...  v 
)

Applies map-reduce on a set of inputs. In the first step the given map operation (zip operation if there is more than one view involved) on the given inputs and the results are reduce using the given reduce operation (reduce_op)

Parameters
map_opthe operation to be applied in the first step on the given input(s)
reduce_opthe operation to be applied on the results of the the first map phase
vthe inputs

◆ map_reduce() [2/2]

template<typename Tag , typename MapOp , typename ReduceOp , typename ... V>
stapl::result_of::map_reduce<Tag, MapOp, ReduceOp, V...>::type stapl::map_reduce ( MapOp const &  map_op,
ReduceOp const &  reduce_op,
V &&...  v 
)

Applies map-reduce on the given input by using the specific map_reduce implementation specified by the given tag. Current set of tags which can be used for map_reduce are:

  • stapl::use_default - uses the default coarsened version of map_reduce. This is the most-used version of map_reduce in STAPL.
  • with_coarsened_wf - in some cases it is desirable to avoid the default workfunction used in the coarsened map phase. One can use this tag to indicate that the given map_op can handle coarse-grain inputs
  • no_coarsening - when the coarsening phase (data and skeletons) needs to be avoided as a whole.
Parameters
map_opthe operation to be applied in the first step on the given input(s)
reduce_opthe operation to be applied on the results of the the first map phase
vthe inputs

◆ map_reduce_sched()

template<typename Scheduler , typename MapOp , typename ReduceOp , typename ... V>
stapl::result_of::map_reduce<stapl::use_default, MapOp, ReduceOp, V...>::type stapl::map_reduce_sched ( Scheduler const &  scheduler,
MapOp const &  map_op,
ReduceOp const &  reduce_op,
V &&...  v 
)

Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided. The scheduler provided will be used by the executor processing the tasks of the PARAGRAPH as it is executed.

Parameters
schedulerScheduler to employ in the executor processing the PARAGRAPH.
map_opFine-grain map work function.
viewOne or more views to process with the map work function.

◆ map_func_sched()

template<typename Scheduler , typename MapOp , typename ... V>
void stapl::map_func_sched ( Scheduler const &  scheduler,
MapOp const &  map_op,
V &&...  views 
)

Construct and execute a PARAGRAPH that will perform a map operation, applying the fine-grain work function to the element of the views provided. The scheduler provided will be used by the executor processing the tasks of the PARAGRAPH as it is executed.

Parameters
schedulerScheduler to employ in the executor processing the PARAGRAPH.
map_opFine-grain map work function.
viewsOne or more views to process with the map work function.

◆ reduce()

template<typename Tag = stapl::use_default, typename View , typename BinaryOp >
std::decay<View>::type::value_type stapl::reduce ( View &&  view,
BinaryOp const &  binop 
)

Users can specify which version of the reduce skeleton to be used for reduction algorithm. The possible choices are.

  • stapl::use_default which uses the default coarsened reduction skeleton.
  • no_coarsening In some cases it is desired to use a reduction in its fine-grained format. One can use this tag to avoid the coarsening phase altogether.
Parameters
viewthe input view
binopthe operation used to reduce the values
Template Parameters
Tagwhich reduction to be used
Returns
returns the reduction value on each location
See also
algorithm_fwd.hpp for default values.

◆ scan() [1/2]

template<typename ScanTag , typename CoarseTag , typename View0 , typename View1 , typename Binop >
void stapl::scan ( View0 &&  view0,
View1 &&  view1,
Binop  binop 
)

A scan is an operation in which each element in the results is the result of the cumulative operation on all elements before it. It can be one of two types.

  • exclusive in which the cumulative operation for the value at index i of the output contains all elements before index i in the input
  • inclusive in which the cumulative operation for element at index i of the output contains all elements before index i and at index i of the input.

The type of the scan to be used is determined by the scan tag passed to this function. In addition, one can choose the coarsening method used for the skeleton by specifying a CoarseTag

Parameters
view0A one-dimensional view over the input elements that are of a numeric type.
view1A one-dimensional view over the elements where the result of the scan will be written.
binopThe binary functor that will be used to compute the result of scan operation.
Template Parameters
ScanTagwhich scan algorithm to be used
CoarseTagwhat type of coarsening to be used (if any)
See also
inclusive_scan
exclusive_scan

◆ scan() [2/2]

template<typename CoarseTag = stapl::use_default, typename View0 , typename View1 , typename Binop >
void stapl::scan ( View0 &&  view0,
View1 &&  view1,
Binop  binop,
bool  shift = false 
)

A scan is an operation in which each element in the results is the result of the cumulative operation on all elements before it. It can be one of two types.

  • exclusive in which the cumulative operation for the value at index i of the output contains all elements before index i in the input
  • inclusive in which the cumulative operation for element at index i of the output contains all elements before index i and at index i of the input.

This function specifies the default skeleton to be used for both inclusive and exclusive skeletons. The default case for an exclusive scan is Blelloch and the default for inclusive scan is Binomial.

Parameters
view0A one-dimensional view over the input elements that are of a numeric type.
view1A one-dimensional view over the elements where the result of the scan will be written.
binopThe binary functor that will be used to compute the result of scan operation.
shiftWhether to use an exclusive or inclusive scan.
Template Parameters
CoarseTagwhich type of coarsening to be used for the coarsening of the scan skeleton. One can pass no_coarsening in order to avoid the coarsening as a whole.
See also
inclusive_scan
exclusive_scan

◆ scan_reduce() [1/2]

template<typename ScanTag , typename CoarseTag , typename View0 , typename View1 , typename Binop >
std::decay<View0>::type::value_type stapl::scan_reduce ( View0 &&  view0,
View1 &&  view1,
Binop  binop 
)

combines the functionality of scan and reduce skeleton.

for the scan skeleton it can be one of two types

  • exclusive in which the cumulative operation for the value at index i of the output contains all elements before index i in the input
  • inclusive in which the cumulative operation for element at index i of the output contains all elements before index i and at index i of the input.

The type of the scan to be used is determined by the scan tag passed to this function. In addition, one can choose the coarsening method used for the skeleton by specifying a CoarseTag

Parameters
view0A one-dimensional view over the input elements that are of a numeric type.
view1A one-dimensional view over the elements where the result of the scan will be written.
binopThe binary functor that will be used to compute the result of scan and reduce operation.
Template Parameters
ScanTagwhich scan algorithm to be used
CoarseTagwhat type of coarsening to be used (if any)
Returns
the result of reduce skeleton
See also
reduce
scan
inclusive_scan
exclusive_scan

◆ scan_reduce() [2/2]

template<typename CoarseTag = stapl::use_default, typename View0 , typename View1 , typename Binop >
std::decay<View0>::type::value_type stapl::scan_reduce ( View0 &&  view0,
View1 &&  view1,
Binop  binop,
bool  shift = false 
)

Combines the functionality of scan and reduce skeleton.

This function specifies the default skeleton to be used for scan skeleton. The default case for an exclusive scan is Blelloch and the default for inclusive scan is Binomial.

Parameters
view0A one-dimensional view over the input elements that are of a numeric type.
view1A one-dimensional view over the elements where the result of the scan will be written.
binopThe binary functor that will be used to compute the result of scan and reduce operation.
shiftWhether to use an exclusive or inclusive scan.
Template Parameters
CoarseTagwhich type of coarsening to be used for the coarsening of the scan skeleton. One can pass no_coarsening in order to avoid the coarsening as a whole.
Returns
the result of reduce skeleton
See also
reduce
scan
inclusive_scan
exclusive_scan