STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Public Attributes | Protected Member Functions | Protected Attributes | Friends
stapl::paragraph_impl::task_graph Class Referenceabstract

Contains all functionality of the PARAGRAPH that isn't dependent on the Scheduler or View types. More...

Public Member Functions

template<typename T , typename PortFilter , typename ValueFilter , typename LocationMapper >
void child_setup_flow (size_t producer, rmi_handle::reference consumer_handle, location_type consumer_location, PortFilter port_filter, ValueFilter value_filter, LocationMapper location_mapper)
 Forward dataflow setup request from child PARAGRAPH to the nested PARAGRAPH directory data member. More...
 
virtual detail::result_container_baseget_result_container (void)=0
 Get a reference to the output port of this PARAGRAPH. Primarily used to forward requests from consumers in a type erased manner.
 
virtual bool has_only_local_tasks (void) const =0
 Return true if PARAGRAPH scheduler has signalled that all tasks are locally executed.
 
virtual bool has_span (void) const =0
 
template<typename T , typename PortFilter , typename ValueFilter , typename LocationMapper >
void request_out_flow (rmi_handle::reference consumer, location_type parent_location, PortFilter port_filter, ValueFilter value_filter, LocationMapper location_mapper)
 Forward sibling PARAGRAPH dataflow request to result_container (the output port of this PARAGRAPH).
 
template<typename Mapper >
void request_parent_out_flow (Mapper mapper)
 Forward parent PARAGRAPH output port dataflow request to result_container (the output port of this PARAGRAPH).
 
template<typename T >
void child_add_producer (rmi_handle::reference child, size_t index)
 Forward dataflow initialization from a given index of a producer PARAGRAPH output port to the input port on this PARAGRAPH with the specified handle.
 
template<typename T >
void child_set_element (rmi_handle::reference child, size_t index, T const &val)
 Forward dataflow from a given index of a producer PARAGRAPH output port to the input port on this PARAGRAPH with the specified handle.
 
bool called_before (void) const
 Returns true if the given PARAGRAPH has been called at least once before (i.e., this is a reinvocation).
 
 ~task_graph () override
 
trivial_p_object const & succs_p_object (void) const
 Return successor task p_object used in gang switcher.
 
trivial_p_object const & no_succs_p_object (void) const
 Return no successor task p_object used in gang switcher.
 
bool has_successors (void) const
 
std::size_t num_successors (void) const
 
rmi_handle::reference const & parent_handle (void) const
 
location_type parent_location (void) const
 
bool parent_notify_all_locations (void) const
 
size_t task_id (void) const
 
virtual void pulse_terminator (void)=0
 Starts termination detection.
 
edge_containeredges (void)
 
nested_pg_directorynested_pgs (void)
 
nested_pg_directory const & nested_pgs (void) const
 
void try_os_delete (void)
 Called by task wrapper of one-sided, persistent paragraphs to signal time for deletion. More...
 
bool migration_enabled () const
 Indicate if the task_graph was instantiated with task migration support enabled.
 
virtual bool is_persistent (void) const =0
 Indicate if the task_graph is persistent.
 
virtual task_baseget_factory_task (void)=0
 Return the factory task.
 
virtual task_base const & get_factory_task (void) const =0
 
executor_baseexecutor_ptr (void) const
 Return a pointer to the executor responsible for processing this instance. More...
 
executor_baseexecutor (void) const
 Return the executor responsible for processing this instance.
 
void set_executor (executor_base *exec_base_ptr)
 Receive the pointer to the executor from the PARAGRAPH function operator.
 
virtual void set_result (std::size_t, task_id_t)=0
 For port flow PARAGRAPHs, connect the output of the given task to the given index of the output port.
 
void set_result (task_id_t task_id)
 Allows the factory to specify which task produces the PARAGRAPH result on this location, which can be used to customize termination detection.
 
template<typename Mapper >
void set_result_pg (task_id_t task_id, Mapper mapper)
 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.
 
template<typename Result , typename Notifier >
void request_notify (size_t tid, Notifier const &notifier)
 Receive the request from a task to receive notification when a task has been processed. More...
 
void notify_termination ()
 Method invoked by a notifier when the PARAGRAPH has terminated.
 
template<typename SchedulerEntry , typename WF , typename ViewSet , std::size_t ... Indices>
void add_migrated_task (std::size_t tid, size_t unknown_consumer_cnt, typename SchedulerEntry::sched_info_type const &sched_info, WF const &wf, ViewSet const &, index_sequence< Indices... > const &)
 Receive a task being migrated from another location. More...
 
void count_local_task (size_t cnt=1)
 Increment the count of tasks placed on this location.
 
void count_task (size_t cnt=1)
 Increment the count of tasks specified on this location. More...
 
void processed_local (void)
 
void processed_remote_void (task_id_t tid, bool b_has_succs)
 Receive notification from a task that it has executed. Method is called by task_base::processed when the task has a void return value and possibly intra-PARAGRAPH successors.
 
template<typename ReturnValue >
void processed_remote (task_id_t tid, bool has_succs, ReturnValue &&val)
 Receive notification from a task that it has executed. More...
 
void result_processed ()
 Invoked by the result notifier.
 
void set_num_succs (std::size_t task_id, std::size_t num_succs) const
 Set the number of successors that will require notification of a tasks execution. More...
 
template<typename SchedulerEntry , typename WF , typename ViewWrapper , std::size_t ... Indices>
void migrate_task (Task< SchedulerEntry, std::true_type, std::false_type, WF, ViewWrapper > *task, std::size_t dest, index_sequence< Indices... > const &)
 Migrate a task to another location. More...
 
template<typename T >
void setup_promise_flow (std::size_t task_id, promise< typename df_stored_type< T >::type > pr)
 
int hold_termination (void) const
 Detects whether participation in global quiescence should be initiated, based on whether there are local conditions that would certainly cause it to fail (eg, all tasks in the local queue have not been retired). More...
 
std::pair< int, bool > termination_value (void) const
 Return the termination value of the PARAGRAPH on this location. More...
 
bool query_factory (void)
 Call back to the factory to allow for incremental construction of the task graph. More...
 
bool local_empty (void) const
 
bool is_blocking (void) const
 
runtime::location_md const & get_location_md (void) const noexcept
 Returns the location metadata of the location this object registered in.
 
runtime::location_mdget_location_md (void) noexcept
 Returns the location metadata of the location this object registered in. noexcept More...
 
Distributed Object Management
rmi_handle::const_reference const & get_rmi_handle (void) const noexcept
 Returns the associated rmi_handle.
 
rmi_handle::reference const & get_rmi_handle (void) noexcept
 Returns the associated rmi_handle.
 
size_type get_location_id (void) const noexcept
 Returns the location id of the local sub-object.
 
size_type get_num_locations (void) const noexcept
 Returns the number of locations of the gang of this p_object.
 
void advance_epoch (void)
 Advances the epoch of the object. More...
 
void unlock (void)
 Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs. More...
 
void lock (void)
 Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs. More...
 
bool try_lock (void)
 Attempt to maintain atomicity with respect to incoming RMIs. More...
 

Public Types

using task_id_t = std::size_t
 
typedef void stapl_is_paragraph_
 
using size_type = rmi_handle::size_type
 

Public Attributes

edge_containerm_edge_ct_ptr
 

Protected Member Functions

template<typename TaskMapperParam >
 task_graph (TaskMapperParam &&task_mapper_param, bool b_enable_migration, bool b_persistent, std::size_t num_succs, rmi_handle::reference parent_handle_ref, location_type parent_location, bool b_parent_notify_all_locations, size_t task_id)
 
 task_graph (task_graph const &)=delete
 
task_graphoperator= (task_graph const &)=delete
 
bool finished (void) const
 Return whether the PARAGRAPH has terminated or not.
 
void operator() (int, bool blocking, bool, bool one_sided)
 The portion of the paragraph function operator not dependent on any template parameters. Called by paragraph::operator(). More...
 
virtual void reset_in_out_containers (void)=0
 
void reset (void)
 Clear all counters and booleans modified by execution of the PARAGRAPH to allow it to be reinvoked.
 

Protected Attributes

bool m_b_no_tasks_escaped
 
executor_basem_exec_ptr
 The executor for this PARAGRAPH.
 
bool m_b_blocking
 Indicate if the PARAGRAPH is blocking.
 
unsigned int m_execs_started
 The number of invocations of this paragraph that have been started.
 
unsigned int m_execs_terminated
 The number of invocations of this paragraph that have been finished.
 

Friends

class stapl::edge_container
 

Detailed Description

Contains all functionality of the PARAGRAPH that isn't dependent on the Scheduler or View types.

Constructor & Destructor Documentation

◆ ~task_graph()

stapl::paragraph_impl::task_graph::~task_graph ( )
override

Member Function Documentation

◆ child_setup_flow()

template<typename T , typename PortFilter , typename ValueFilter , typename LocationMapper >
void stapl::paragraph_impl::task_graph::child_setup_flow ( size_t  producer,
rmi_handle::reference  consumer_handle,
location_type  consumer_location,
PortFilter  port_filter,
ValueFilter  value_filter,
LocationMapper  location_mapper 
)

Forward dataflow setup request from child PARAGRAPH to the nested PARAGRAPH directory data member.

Template Parameters
TThe type of elements stored in the target producer's output port.
Parameters
producerTask identifier of the producer PARAGRAPH in its enclosing / parent PARAGRAPH.
consumer_handleRMI handle to the consuming PARAGRAPH.
consumer_locationlocation in the consuming PARAGRAPH initiating the point to point consumption request.
port_filterUsed to select which pins of the producer port are forwarded to this consumer.
value_filterApplied to each flowed pin's value, prior to dataflow to the consumer.
location_mappermaps producer pin to location in this consumer where it should be flowed.

◆ operator()()

void stapl::paragraph_impl::task_graph::operator() ( int  ,
bool  blocking,
bool  ,
bool  one_sided 
)
protected

The portion of the paragraph function operator not dependent on any template parameters. Called by paragraph::operator().

◆ try_os_delete()

void stapl::paragraph_impl::task_graph::try_os_delete ( void  )

Called by task wrapper of one-sided, persistent paragraphs to signal time for deletion.

◆ executor_ptr()

executor_base* stapl::paragraph_impl::task_graph::executor_ptr ( void  ) const

Return a pointer to the executor responsible for processing this instance.

Use pointer to allow cases where inter-paragraph input ports receive dataflow prior to initialization of executor (they won't use it, as no intra-paragraph consumers could have been initialized as the factory hasn't been called yet).

◆ request_notify()

template<typename Result , typename Notifier >
void stapl::paragraph_impl::task_graph::request_notify ( size_t  tid,
Notifier const &  notifier 
)

Receive the request from a task to receive notification when a task has been processed.

Parameters
tidId of the task whose completion will trigger the notifier.
notifierThe notifier to invoke.

◆ add_migrated_task()

template<typename SchedulerEntry , typename WF , typename ViewSet , std::size_t ... Indices>
void stapl::paragraph_impl::task_graph::add_migrated_task ( std::size_t  tid,
size_t  unknown_consumer_cnt,
typename SchedulerEntry::sched_info_type const &  sched_info,
WF const &  wf,
ViewSet const &  vs,
index_sequence< Indices... > const &   
)

Receive a task being migrated from another location.

Parameters
tidId of the task
unknown_consumer_cntNumber of successors that have not yet requested notification of the task's completion or result.
sched_infoInformation used to determine relative priority of task.
wfwork function the task will invoke.
viewsThe packed view of the migrated task.

◆ count_task()

void stapl::paragraph_impl::task_graph::count_task ( size_t  cnt = 1)

Increment the count of tasks specified on this location.

Called in paragraph_view::add_task() methods, which is entry point for both factories and dynamic_wfs

◆ processed_remote()

template<typename ReturnValue >
void stapl::paragraph_impl::task_graph::processed_remote ( task_id_t  tid,
bool  has_succs,
ReturnValue &&  val 
)

Receive notification from a task that it has executed.

Called by Task objects with non-void return type. The produced value is passed so that edge_container can forward it to consumers.

◆ set_num_succs()

void stapl::paragraph_impl::task_graph::set_num_succs ( std::size_t  task_id,
std::size_t  num_succs 
) const

Set the number of successors that will require notification of a tasks execution.

This method is used by dynamic skeletons where the number of successors of a task isn't known when the task is created (e.g., while loop skeleton).

◆ migrate_task()

template<typename SchedulerEntry , typename WF , typename ViewWrapper , std::size_t ... Indices>
void stapl::paragraph_impl::task_graph::migrate_task ( Task< SchedulerEntry, std::true_type, std::false_type, WF, ViewWrapper > *  task,
std::size_t  dest,
index_sequence< Indices... > const &   
)

Migrate a task to another location.

Parameters
taskTask to be migrated
destLocation to which task is to be migrated.
sched_infoScheduling information of the task.

Called by a task to migrate itself to another location as part of the process of work stealing.

◆ hold_termination()

int stapl::paragraph_impl::task_graph::hold_termination ( void  ) const

Detects whether participation in global quiescence should be initiated, based on whether there are local conditions that would certainly cause it to fail (eg, all tasks in the local queue have not been retired).

Used to guard initialization of TD in pulse_terminator and as part of termination value in termination_value.

◆ termination_value()

std::pair<int, bool> stapl::paragraph_impl::task_graph::termination_value ( void  ) const

Return the termination value of the PARAGRAPH on this location.

Returns
non-zero if there are outstanding tasks.

Called by termination_detection.

◆ query_factory()

bool stapl::paragraph_impl::task_graph::query_factory ( void  )

Call back to the factory to allow for incremental construction of the task graph.

This method allows reinvocation of the factory without the task graph being aware of WF and View types.

Invoked by executor when the scheduler on this location has no runnable tasks. If the factory is finished no new tasks are added.

Returns
true if the factory needs to be queried again, otherwise false.

◆ local_empty()

bool stapl::paragraph_impl::task_graph::local_empty ( void  ) const

◆ get_location_md()

runtime::location_md& stapl::p_object::get_location_md ( void  )
noexceptinherited

Returns the location metadata of the location this object registered in. noexcept

noexcept

◆ advance_epoch()

void stapl::p_object::advance_epoch ( void  )
inherited

Advances the epoch of the object.

Advancing the epoch will flush any pending RMIs. It will also increase the epoch of the current gang if the object is not a named object.

◆ unlock()

void stapl::p_object::unlock ( void  )
inherited

Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

◆ lock()

void stapl::p_object::lock ( void  )
inherited

Used by lock_guard functionality in method of derived classes to request atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

◆ try_lock()

bool stapl::p_object::try_lock ( void  )
inherited

Attempt to maintain atomicity with respect to incoming RMIs.

Mutates counter in the associated runqueue.

Returns
true if the lock was able to be acquired. false if it is already locked.

Friends And Related Function Documentation

◆ stapl::edge_container

friend class stapl::edge_container
friend

Member Data Documentation

◆ m_edge_ct_ptr

edge_container* stapl::paragraph_impl::task_graph::m_edge_ct_ptr

Edge container storing the results of tasks.


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