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::do_while< BodyP, RedP, ContinuationP, Flows > Class Template Reference

Do-while is a composite skeleton that repeats a skeleton for a number of iterations. This number is determined by evaluating the ContinuationP after every iteration. More...

Public Member Functions

 do_while (BodyP const &body_p, RedP const &red_p, const ContinuationP &continuation_p)
 
template<typename Spawner , typename... Views>
void set_dimensions (Spawner const &spawner, Views const &... views)
 sets the underlying skeleton sizes based on the given tuple of view sizes. In addition, it sets the dimension of the do_while itself to 0. More...
 
dims_type dimensions () const
 
body_p_type body_skeleton () const
 
reduction_p_type reduction_skeleton () const
 
continuation_p_type continuation_skeleton () const
 
std::size_t current_iteration () const
 
std::size_t last_id () const
 last_id is the maximum task id that this skeleton will create
 
in_port_type in_port (std::size_t lid_offset) const
 
template<typename In >
out_port_type< In >::type out_port (In const &in, std::size_t lid_offset) const
 
std::size_t lid_offset (std::size_t do_while_lid_offset, std::size_t iter_num, do_while_component c=do_while_component::body) const
 calculate the offset of underlying skeleton based on do-while offset and current iteration number More...
 
template<do_while_component Comp>
auto nested_in_port (std::size_t lid_offset, std::size_t iter) const STAPL_AUTO_RETURN((this -> get_nested_skeleton< Comp >().in_port(this->lid_offset(lid_offset, iter, Comp))))
 Returns the input port of one of the internal do_while skeletons (body, reduction, or continuation) for the given iteration. More...
 
template<typename Spawner , typename Coord , typename In , typename Out >
bool spawn (Spawner &spawner, std::size_t orig_lid_offset, Coord const &skeleton_size, Coord const &coord, In const &in, Out const &out, std::size_t cur_stage)
 Spawning of a do-while is more complicated than the other composite skeletons. A do-while starts by spawning the first iteration (body, reduction, and continuation) without knowing if it is one of the intermediate iterations or if it is the last iteration. Therefore, it creates three follow-up stubs: More...
 

Public Types

using dims_type = std::size_t
 
using body_p_type = BodyP
 
using reduction_p_type = RedP
 
using continuation_p_type = ContinuationP
 
using index_type = typename BodyP::index_type
 
using in_port_type = typename Flows::template port_types< do_while >::in_port_type
 
using skeleton_tag_type = tags::unnamed_skeleton
 

Static Public Attributes

static constexpr std::size_t in_port_size
 

Detailed Description

template<typename BodyP, typename RedP, typename ContinuationP, typename Flows>
class stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >

Do-while is a composite skeleton that repeats a skeleton for a number of iterations. This number is determined by evaluating the ContinuationP after every iteration.

Example - A do-while skeleton with default piped flow:

dot_inline_dotgraph_13.png

Member Function Documentation

◆ set_dimensions()

template<typename BodyP , typename RedP , typename ContinuationP , typename Flows >
template<typename Spawner , typename... Views>
void stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >::set_dimensions ( Spawner const &  spawner,
Views const &...  views 
)

sets the underlying skeleton sizes based on the given tuple of view sizes. In addition, it sets the dimension of the do_while itself to 0.

Parameters
spawnerthe spawner which is spawning this skeleton.
viewsset of views passed to the skeleton.

◆ lid_offset()

template<typename BodyP , typename RedP , typename ContinuationP , typename Flows >
std::size_t stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >::lid_offset ( std::size_t  do_while_lid_offset,
std::size_t  iter_num,
do_while_component  c = do_while_component::body 
) const

calculate the offset of underlying skeleton based on do-while offset and current iteration number

Parameters
repeat_lid_offsetoffset of repeat skeleton
iter_numcurrent iteration number
cwhich component to get the offset for
See also
do_while_component

◆ nested_in_port()

template<typename BodyP , typename RedP , typename ContinuationP , typename Flows >
template<do_while_component Comp>
auto stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >::nested_in_port ( std::size_t  lid_offset,
std::size_t  iter 
) const -> get_nested_skeleton< Comp >().in_port(this->lid_offset(lid_offset, iter, Comp))))

Returns the input port of one of the internal do_while skeletons (body, reduction, or continuation) for the given iteration.

Parameters
lid_offsetthe lid offset for the do_while skeleton
iterthe iteration to get the component skeleton for
Returns
the input port of the specified component skeleton
See also
do_while.hpp
do_while_flows.hpp
do_while_component
current_iteration

◆ spawn()

template<typename BodyP , typename RedP , typename ContinuationP , typename Flows >
template<typename Spawner , typename Coord , typename In , typename Out >
bool stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >::spawn ( Spawner &  spawner,
std::size_t  orig_lid_offset,
Coord const &  skeleton_size,
Coord const &  coord,
In const &  in,
Out const &  out,
std::size_t  cur_stage 
)

Spawning of a do-while is more complicated than the other composite skeletons. A do-while starts by spawning the first iteration (body, reduction, and continuation) without knowing if it is one of the intermediate iterations or if it is the last iteration. Therefore, it creates three follow-up stubs:

  • stub for making this iteration as the last iteration
  • stub for making this iteration as one of the intermediate iterations
  • stub for the next iteration

It is then the job of do_while_pd to invoke the appropriate stub based on the continuation condition. If the condition is satisfied (meaning that we have to continue with the next iteration), stubs (2) and (3) would be called, otherwise stub (1) would only be called.

Like every other composite skeleton, do_while manages the offset for the skeletons so the spawning of the underlying skeletons would not overlap.

Parameters
spawneris used for spawning the enclosed skeletons
orig_lid_offsetthe safe id to start the spawning from
skeleton_sizethe size of skeletons enclosing this skeleton
coordthe coordinate of this skeleton in the evaluated skeletons coordinate space
inthe input flow passed to this skeleton
outthe output flow that this skeleton would produce its results for
cur_stagecurrent iteration number of the do_while loop
Returns
true if spawning of last iteration is finished
See also
do_while.hpp
memento.hpp
spawner.hpp

Member Data Documentation

◆ in_port_size

template<typename BodyP , typename RedP , typename ContinuationP , typename Flows >
constexpr std::size_t stapl::skeletons::skeletons_impl::do_while< BodyP, RedP, ContinuationP, Flows >::in_port_size
static
Initial value:
=
Flows::template port_types<do_while>::in_port_size

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