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

Provides an interface for a PARAGRAPH's factory as well as dynamic tasks to add new tasks to the PARAGRAPH during execution. More...

Public Member Functions

derived_tg_tgraph () const
 Extract a reference to the currently running PARAGRAPH from a dynamic call stack of PARAGRAPH invocations maintained in the runtime. More...
 
 paragraph_view (task_graph &paragraph)
 
void add_expected_tasks (size_t count) const
 Allows locations participating in a nested PARAGRAPH that did not initiate the spawning process to convey knowledge about the number of nested paragraphs that they will participate in. Used to aid in elision of global termination detection.
 
template<typename WF , typename... Args>
void add_task (std::size_t task_id, WF const &wf, std::size_t num_succs, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
template<typename WF , typename... Args>
void add_task (sched_info_type const &si, std::size_t task_id, WF const &wf, std::size_t num_succs, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
template<typename WF , typename... Args>
void add_task (std::size_t task_id, WF const &wf, pred_list_t preds, std::size_t num_succs, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
template<typename WF , typename... Args>
void add_task (sched_info_type const &si, std::size_t task_id, WF const &wf, pred_list_t preds, std::size_t num_succs, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
template<typename WF , typename... Args>
std::enable_if< !std::is_integral< WF >::value &&!std::is_same< WF, sched_info_type >::value, void >::type add_task (WF const &wf, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
template<typename WF , typename... Args>
std::enable_if<!std::is_integral< WF >::value, void >::type add_task (sched_info_type const &si, WF const &wf, Args const &... args) const
 Insert a new task in the currently running PARAGRAPH. More...
 
p_object const & no_succs_p_object ()
 
void set_num_succs (std::size_t task_id, std::size_t num_succs) const
 Allows the consumer count for a producer task to be specified independent of its add_task invocation. More...
 
void set_result (std::size_t task_id) const
 Sets the PARAGRAPH task that will be the return value for the PARAGRAPH from this location. Can be called by a factory or any task in the PARAGRAPH with a paragraph_view. More...
 
void set_result (std::size_t index, std::size_t task_id) const
 For port flow PARAGRAPHs, connect the output of the given task to the given index of the output port.
 
template<typename Mapper >
void set_result_pg (std::size_t task_id, Mapper mapper) const
 Specify that a child PARAGRAPH with the given task id will connect to some of the ports of this parent PARAGRAPH as defined by the passed mapper. More...
 
constexpr bool is_local (void) const
 
task_graphcontainer (void) const
 

Detailed Description

template<typename Scheduler>
class stapl::paragraph_impl::paragraph_view< Scheduler >

Provides an interface for a PARAGRAPH's factory as well as dynamic tasks to add new tasks to the PARAGRAPH during execution.

Template Parameters
SchedulerThe type of the scheduler that the PARAGRAPH was constructed with.

Although this class only directly uses the scheduling metadata type (i.e., Scheduler::sched_info_type) in its method signatures, it is templated with the full Scheduler type so that the PARAGRAPH intermediate base with knowledge of this type can be accessed. This allows the PARAGRAPH's internal add_task call to invoke the task placement policy located in the scheduler object.

Member Function Documentation

◆ graph()

template<typename Scheduler >
derived_tg_t& stapl::paragraph_impl::paragraph_view< Scheduler >::graph ( ) const

Extract a reference to the currently running PARAGRAPH from a dynamic call stack of PARAGRAPH invocations maintained in the runtime.

Returns
A reference to an PARAGRAPH object whose type has factory and view information erased, but still maintains knowledge of the scheduler type.

◆ add_task() [1/6]

template<typename Scheduler >
template<typename WF , typename... Args>
void stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( std::size_t  task_id,
WF const &  wf,
std::size_t  num_succs,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
task_idUser specified identifier that other tasks and paragraph_view methods use to refer to this task.
wfThe workfunction for this task.
num_succsThe number of consumers for this task in the PARAGRAPH.
vVariadic list of view inputs to workfunction.
Note
For this and all add_task signatures, the view parameter is actually a std::pair of View* and index which will be evaluated as conceptually as *view[index] prior to being passed to the workfunction. This allows the actual evaluation of to be delayed until the task is actual placed, hopefully with good locality, so that view creation avoids communication.

◆ add_task() [2/6]

template<typename Scheduler >
template<typename WF , typename... Args>
void stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( sched_info_type const &  si,
std::size_t  task_id,
WF const &  wf,
std::size_t  num_succs,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
sched_infoScheduler metadata (e.g., priority) for task.
task_idUser specified identifier that other tasks and paragraph_view methods use to refer to this task.
wfThe workfunction for this task.
num_succsThe number of consumers for this task in the PARAGRAPH.
vVariadic list of view inputs to workfunction.

◆ add_task() [3/6]

template<typename Scheduler >
template<typename WF , typename... Args>
void stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( std::size_t  task_id,
WF const &  wf,
pred_list_t  preds,
std::size_t  num_succs,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
task_idUser specified identifier that other tasks and paragraph_view methods use to refer to this task.
wfThe workfunction for this task.
predsvector of predecessor task ids where there is a dependence to enforce but whose return value is not consumed on PARAGRAPH edge.
num_succsThe number of consumers for this task in the PARAGRAPH.
vVariadic list of view inputs to workfunction.

◆ add_task() [4/6]

template<typename Scheduler >
template<typename WF , typename... Args>
void stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( sched_info_type const &  si,
std::size_t  task_id,
WF const &  wf,
pred_list_t  preds,
std::size_t  num_succs,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
sched_infoScheduler metadata (e.g., priority) for task.
task_idUser specified identifier that other tasks and paragraph_view methods use to refer to this task.
wfThe workfunction for this task.
predsvector of predecessor task ids where there is a dependence to enforce but whose return value is not consumed on PARAGRAPH edge.
num_succsThe number of consumers for this task in the PARAGRAPH.
vVariadic list of view inputs to workfunction.

◆ add_task() [5/6]

template<typename Scheduler >
template<typename WF , typename... Args>
std::enable_if< !std::is_integral<WF>::value && !std::is_same<WF, sched_info_type>::value, void >::type stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( WF const &  wf,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
wfThe workfunction for this task. dependence to enforce but whose return value is not consumed on PARAGRAPH edge.
vVariadic list of view inputs to workfunction.
Returns
PARAGRAPH generated task id guaranteed to be globally unique.
Remarks
The created task implicitly has no consumers.

◆ add_task() [6/6]

template<typename Scheduler >
template<typename WF , typename... Args>
std::enable_if<!std::is_integral<WF>::value, void>::type stapl::paragraph_impl::paragraph_view< Scheduler >::add_task ( sched_info_type const &  si,
WF const &  wf,
Args const &...  args 
) const

Insert a new task in the currently running PARAGRAPH.

Parameters
sched_infoScheduler metadata (e.g., priority) for task.
wfThe workfunction for this task. dependence to enforce but whose return value is not consumed on PARAGRAPH edge.
vVariadic list of view inputs to workfunction.
Returns
PARAGRAPH generated task id guaranteed to be globally unique.
Remarks
The created task implicitly has no consumers.

◆ set_num_succs()

template<typename Scheduler >
void stapl::paragraph_impl::paragraph_view< Scheduler >::set_num_succs ( std::size_t  task_id,
std::size_t  num_succs 
) const

Allows the consumer count for a producer task to be specified independent of its add_task invocation.

Parameters
task_idTask identifier of task to have consumer count set.
num_succsThe consumer count for the task.
Remarks
The corresponding add_task must be passed the defer_spec constant, denoting that the successor count will be separately specified by a call to this method.

◆ set_result()

template<typename Scheduler >
void stapl::paragraph_impl::paragraph_view< Scheduler >::set_result ( std::size_t  task_id) const

Sets the PARAGRAPH task that will be the return value for the PARAGRAPH from this location. Can be called by a factory or any task in the PARAGRAPH with a paragraph_view.

Parameters
task_idTask identifier of task to be used as a result

◆ set_result_pg()

template<typename Scheduler >
template<typename Mapper >
void stapl::paragraph_impl::paragraph_view< Scheduler >::set_result_pg ( std::size_t  task_id,
Mapper  mapper 
) const

Specify that a child PARAGRAPH with the given task id will connect to some of the ports of this parent PARAGRAPH as defined by the passed mapper.

See also
result_container_base::request_parent_flow

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