STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions
stapl::skeletons::spawner< Env > Class Template Reference

The spawner is used in conjunction with the skeleton_manager to create nodes in the given environment. It is the main interface between skeletons and skeleton_manager and also the environment being used. Therefore, it offers an interface for recording the state of a skeleton's spawning process, and provides spawn_element interface that would do different activities depending on the spawn_mode that the spawner is currently set as. More...

Public Member Functions

 spawner (env_type env, memento &memento_stack)
 
template<typename Skeleton , typename Coord , typename In , typename Out >
bool spawn (Skeleton &skeleton, std::size_t lid_offset, Coord const &skeleton_size, Coord const &coord, In const &in, Out const &out, std::size_t cur_stage=0)
 This method is a simple redirection back and forth to the skeleton. It helps in tracking the spawning process in a centralized fashion, and can be further changed to perform various operations upon the invocation. More...
 
env_type get_env ()
 
mementoget_memento_stack ()
 
void set_spawn_mode (enum spawn_mode cur_spawn_mode)
 
enum spawn_mode spawn_mode () const
 
std::size_t get_num_PEs () const
 
runtime::location_id get_PE_id () const
 
template<typename Skeleton , typename Coord , typename In , typename Out >
void record_state (Skeleton &skeleton, std::size_t lid_offset, Coord &skeleton_size, Coord &coord, In const &in, Out const &out, std::size_t cur_stage, bool is_lazy=false, bool front=false)
 This method records the current state of a partially spawned skeleton in the memento double-ended queue of the skeleton_manager. More...
 
template<bool isResult, typename WF , typename Mapper , typename... In>
void spawn_element (std::size_t tid, std::size_t result_id, WF &&wf, Mapper &&mapper, std::size_t no_succs, In &&... in)
 When a spawner is asked to spawn an element, it checks the spawn_mode that it is now at. This is regardless of which environment the spawn_element request is going to be evaluated in. It would be then the responsibility of an environment to perform the appropriate action on such spawn_element or set_num_succs requests. More...
 
template<bool isResult, typename WF , typename Mapper , typename... In>
void spawn_element (std::size_t tid, std::size_t result_id, std::vector< std::size_t > const &notifications, WF &&wf, Mapper &&mapper, std::size_t no_succs, In &&... in)
 When a spawner is asked to spawn an element, it checks the spawn_mode that is now at. This is regardless of which environment the spawn_element request is going to be evaluated in. It would be then the responsibility of an environment to perform the appropriate action on such spawn_element or set_num_succs requests. More...
 

Detailed Description

template<typename Env>
class stapl::skeletons::spawner< Env >

The spawner is used in conjunction with the skeleton_manager to create nodes in the given environment. It is the main interface between skeletons and skeleton_manager and also the environment being used. Therefore, it offers an interface for recording the state of a skeleton's spawning process, and provides spawn_element interface that would do different activities depending on the spawn_mode that the spawner is currently set as.

Template Parameters
Envthe environment that the spawning process should happen in

Member Function Documentation

◆ spawn()

template<typename Env >
template<typename Skeleton , typename Coord , typename In , typename Out >
bool stapl::skeletons::spawner< Env >::spawn ( Skeleton &  skeleton,
std::size_t  lid_offset,
Coord const &  skeleton_size,
Coord const &  coord,
In const &  in,
Out const &  out,
std::size_t  cur_stage = 0 
)

This method is a simple redirection back and forth to the skeleton. It helps in tracking the spawning process in a centralized fashion, and can be further changed to perform various operations upon the invocation.

Parameters
skeletonthe skeleton to be spawned by this spawner
lid_offsetthe safe id to start the spawning from
skeleton_sizethe size of skeletons
coordthe coordinate of the skeleton
inthe input flow of the skeleton
outthe output flow of the skeleton
cur_stagethe current stage/state of the skeleton
Returns
true if spawning of the skeleton is finished

◆ record_state()

template<typename Env >
template<typename Skeleton , typename Coord , typename In , typename Out >
void stapl::skeletons::spawner< Env >::record_state ( Skeleton &  skeleton,
std::size_t  lid_offset,
Coord &  skeleton_size,
Coord &  coord,
In const &  in,
Out const &  out,
std::size_t  cur_stage,
bool  is_lazy = false,
bool  front = false 
)

This method records the current state of a partially spawned skeleton in the memento double-ended queue of the skeleton_manager.

Parameters
skeletonthe skeleton for which the state should be recorded
lid_offsetthe id offset of the skeleton after pausing
skeleton_sizethe size of the given skeleton
coordthe coordinate of the given skeleton
inthe input flow that should be passed to the skeleton upon continuation
outthe output flow that should be passed to the skeleton upon continuation
cur_stagecurrent stage of the paused skeleton. It is needed to determine the state upon resuming
is_lazyif this skeleton can stay untouched in the memento
frontif this state should be inserted in the front of the memento double-ended queue
See also
skeleton_manager::record_state

◆ spawn_element() [1/2]

template<typename Env >
template<bool isResult, typename WF , typename Mapper , typename... In>
void stapl::skeletons::spawner< Env >::spawn_element ( std::size_t  tid,
std::size_t  result_id,
WF &&  wf,
Mapper &&  mapper,
std::size_t  no_succs,
In &&...  in 
)

When a spawner is asked to spawn an element, it checks the spawn_mode that it is now at. This is regardless of which environment the spawn_element request is going to be evaluated in. It would be then the responsibility of an environment to perform the appropriate action on such spawn_element or set_num_succs requests.

Parameters
tidthe unique element id that is going to be assigned to this element
result_idthe result id of the task if it has any
wfthe work function to be executed on the given inputs
mapperthe output to output mapper for mapping the results of the child paragraph to current paragraph
inthe input producer_info to the workfunction

◆ spawn_element() [2/2]

template<typename Env >
template<bool isResult, typename WF , typename Mapper , typename... In>
void stapl::skeletons::spawner< Env >::spawn_element ( std::size_t  tid,
std::size_t  result_id,
std::vector< std::size_t > const &  notifications,
WF &&  wf,
Mapper &&  mapper,
std::size_t  no_succs,
In &&...  in 
)

When a spawner is asked to spawn an element, it checks the spawn_mode that is now at. This is regardless of which environment the spawn_element request is going to be evaluated in. It would be then the responsibility of an environment to perform the appropriate action on such spawn_element or set_num_succs requests.

Parameters
tidthe unique element id that is going to be assigned to this element
result_idthe result id of the task if it has any
wfthe work function to be executed on the given inputs
inthe input producer_info to the workfunction

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