STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Protected Member Functions | Protected Attributes | Friends
stapl::detail::edge_entry< T > Class Template Reference

The primary storage class for dependence and data flow values in the PARAGRAPH. One instance of this class or the base class edge_entry_base exists for each producer task, both on the location where it executes as well as on all locations with active consumers. More...

Public Member Functions

edge_entryoperator= (edge_entry const &)=delete
 
 edge_entry (edge_entry const &)=delete
 
 edge_entry (std::size_t tid, bool b_persistent)
 
 edge_entry (edge_entry_base &&other)
 Constructor called to upgrade a edge_entry_base element of the edge_container to edge value typed instance of this class template. More...
 
 ~edge_entry () final
 Remove all notifications if not part of persistent PARAGRAPH and remove version entries stored m_versions.
 
void cleanup_notifications (void) final
 Clear all local and remote notifications stored in the entry. More...
 
bool has_unnotified_local_consumer () const
 Return true if there are any local notifications in this entry that have not yet been flushed by a data flow trigger.
 
template<typename Filter >
tuple< df_add_status, unsigned int, edge_version_storage< typename df_stored_type< typename boost::result_of< Filter(stored_value_t)>::type >::type > & > add_local_notifier (edge_container &ct, boost::function< void(executor_base &, typename df_stored_type< typename boost::result_of< Filter(typename df_stored_type< T >::type const &) >::type >::type const &) > const &notifier, bool b_inc_local_usr_cnt, Filter const &filter)
 Receive a local consumption request with associated notifier and filter. Integrate it into edge_entry's local dependence representation and signal caller (edge_container::setup_flow) if any remote notification is required. More...
 
tuple< df_add_status, unsigned int, edge_version_storage< stored_value_t > & > add_local_notifier (edge_container &ct, boost::function< void(executor_base &, stored_value_t const &) > const &notifier, bool b_inc_local_usr_cnt, detail::df_identity< stored_value_t > const &)
 Signature of function for identity / full value consumption.
 
template<typename Notifier >
void add_remote_notifier (edge_container &ct, Notifier const &notifier, const size_t loc, const bool b_upgrade)
 Add a notifier to transmit a producer value (full or filtered) to a remote consumer location and trigger data flow of local consumer edges there. More...
 
void add_remote_signal_notifier (edge_container &ct, size_t loc) final
 Add a signal notifier to notify a remote consumer location when a producer task finishes execution. More...
 
void set_shared_value (immutable_shared< stored_value_t > const &wrapper, edge_container &ct, unsigned int version_id, bool b_caller_is_set_element=false, bool b_caller_is_migration=false)
 Used to trigger data flow in this entry for edges that can be serviced with the version of the value that has been passed via immutable sharing.
 
template<typename Filter , typename ValueParam >
void set_value_impl (ValueParam &&val, edge_container &ct, unsigned int version_id, bool b_caller_is_set_element, bool b_migration_enabled, bool b_expect_exist, std::true_type)
 Implementation helper function for set_value to handle full version set value calls.
 
template<typename Filter , typename ValueParam >
void set_value_impl (ValueParam &&val, edge_container &ct, unsigned int version_id, bool b_caller_is_set_element, bool b_migration_enabled, bool b_expect_exist, std::false_type)
 Implementation helper function for set_value to handle filtered versions set value calls.
 
template<typename Filter >
void set_value (immutable_shared< stored_value_t > &&wrapper, edge_container &ct, unsigned int version_id, bool b_caller_is_set_element=false, bool b_caller_is_migration=false)
 
template<typename Filter , typename ValueParam >
void set_value (ValueParam &&val, edge_container &ct, unsigned int version_id, bool b_caller_is_set_element=false, bool b_caller_is_migration=false)
 Used to trigger data flow in this entry for edges that can be serviced with the version of the value that has been passed. More...
 
void set_value (edge_container &ct) final
 Used to trigger data flow in this entry for edges that are void. More...
 
bool persistent_evictable (void) const
 The general evictability test for the edge_entry. Detects whether this entry is no longer needed on the location and can be removed. More...
 
bool evictable (void) const
 Check whether this entry is no longer needed on the location and can be removed. More...
 
size_t migrate (remote_notifier_list_t &other, int &ct_unknown_consumer_cnt)
 Extract all state necessary to migrate the producer state from this entry and move it to new execution location. More...
 
void reset_values (void) final
 Reset data flow triggers prior to a persistent PARAGRAPH reinvocation. More...
 
bool full_value_set (void) const final
 Return true if the full value of the producer task is currently available (i.e., data flow triggered) in this entry.
 
bool stealable (void) const
 Called in Task::operator() (via lazy_edge_reference) by a consumer identity operation to avoid needless copy if it can have a version stored in edge_version_storage.
 
bool out_edge_stealable (void)
 Called when attempting to use object managed by edge entry as outgoing edge of paragraph. m_local_user_cnt should be zero as result notifications do not increment this variable.
 
virtual bool is_basic_edge_entry (void) const
 
bool is_signal_only (void) const
 
bool is_persistent (void) const
 
std::size_t tid (void) const
 
void set_as_producer (size_t consumer_cnt)
 Inform this edge entry that the producer task has been initialized on this location. More...
 
void delayed_set_num_consumers (size_t consumer_cnt)
 Set the number of successors after delay_spec was passed to set_as_producer. More...
 
void decrement_unknown_consumers (void)
 Reduce the unregistered consumer count. More...
 
void increment_local_consumers (void)
 Increase reference count of local proxies in use by consumer tasks and backed by a version in this edge entry. More...
 
void decrement_local_consumers (void)
 Decrease reference count of local proxies in use by consumer tasks and backed by a version in this edge entry. More...
 
bool local_producer_initialized () const
 Check if the producer task for edge_entry is registered on this location. More...
 
bool has_single_consumer (void) const noexcept
 
bool signal_set () const
 Redirect check signal flow request to the signal version notifier list.
 
void set_signal (executor_base *executor_ptr, const bool b_migration_enabled)
 Set data flow for signal consumers by notifying the signal version notifier list. More...
 
df_add_status compute_request_status (const edge_request_type req, const bool b_flow, const bool b_partial_added=false)
 Called when adding a local notification to determine whether a a consumption request is covered by previous requests or whether a new remote notifier needs to be generated and sent to the producer location. More...
 
df_add_status add_signal_notifier (executor_base &executor, signal_notifier_t notifier)
 Add a signal notifier for a local task. Return the request level status information by calling compute_request_status. More...
 

Public Types

typedef remote_edge_version_entry_t::entry_t remote_notifier_entry_t
 Remote version entry type reflected publicly for migration support.
 
typedef remote_edge_version_entry_t::notifier_list_t remote_notifier_list_t
 Remote version list type reflected publicly for migration support.
 

Protected Member Functions

bool empty_signal_notifications (void) const
 Return true if the the edge_entry contains any signal notifications.
 

Protected Attributes

const std::size_t m_tid
 Task identifier of the produce task this entry refers to.
 
edge_request_type m_request_state
 The current level of consumption on location where this entry exists.
 
size_t m_unknown_consumer_cnt
 Count of consumers which are still unaccounted for. Only initialized on producer location, where the edge_entry will be kept in edge_container at least until all consumers have registered, decrementing this field to 0. Value of defer_spec, denotes location is set as producer location, but successor count will be set separately. More...
 
bool m_single_consumer
 true if there is only one consumer.
 
size_t m_seen_consumers
 Tracks the number of consumers that have registered at producer location when m_unknown_consumer_cnt is set to defer_spec.
 
size_t m_local_user_cnt
 track of consumer reference to version contained in this entry. Used to help manage the lifetime of the object.
 
const bool m_b_persistent
 Tracks whether corresponding PARAGRAPH is persistent.
 
const bool m_b_signal_only
 Is the actual object instantiated edge_entry_base or edge_entry<T>. Used to detect if we need to upgrade the entry based to edge_entry object. More...
 
bool m_b_consumers_before_producer
 Tracks whether consumer tasks at this location registered before the producer was registered. If so, their remote notifiers may arrive out of order. In debug mode, we need to track this for assertion. More...
 

Friends

bool operator== (edge_entry const &lhs, edge_entry const &rhs)
 Freestanding version of operator defined for the edge_entry in terms of the entries' task identifiers. Used by the Boost.Intrusive unordered_set in which all entries are stored by the edge_container.
 
std::ostream & operator<< (std::ostream &os, edge_entry< T > const &entry)
 Define insertion operator on ostream. Provides useful debugging information. More...
 

Detailed Description

template<typename T>
class stapl::detail::edge_entry< T >

The primary storage class for dependence and data flow values in the PARAGRAPH. One instance of this class or the base class edge_entry_base exists for each producer task, both on the location where it executes as well as on all locations with active consumers.

Template Parameters
Thereturn type of the producer task's workfunction.

Each entry maintains a collection of notifier lists called versions. A version may be held in the entry object frame (for now remote and signal versions are held this way) or in a versions list held as data member (currently the case for filtered and full versions). This is strictly an implementation detail that likely warrants further investigation.

The only component interacting with the edge_entry directly is the edge_container which maintains all entries for a given location in a container. The edge_container redirects most requests from outside callers to the appropriate entry methods.

Constructor & Destructor Documentation

◆ edge_entry()

template<typename T >
stapl::detail::edge_entry< T >::edge_entry ( edge_entry_base &&  other)
explicit

Constructor called to upgrade a edge_entry_base element of the edge_container to edge value typed instance of this class template.

This is effectively a move constructor and that calls the similarly defined move constructor of edge_entry_base.

Member Function Documentation

◆ cleanup_notifications()

template<typename T >
void stapl::detail::edge_entry< T >::cleanup_notifications ( void  )
finalvirtual

Clear all local and remote notifications stored in the entry.

Either called in the destructor or as part of the delayed edge_container destruction used when persistency support is enabled.

Reimplemented from stapl::detail::edge_entry_base.

◆ add_local_notifier()

template<typename T >
template<typename Filter >
tuple<df_add_status, unsigned int, edge_version_storage< typename df_stored_type< typename boost::result_of< Filter(stored_value_t)>::type>::type>&> stapl::detail::edge_entry< T >::add_local_notifier ( edge_container ct,
boost::function< void(executor_base &, typename df_stored_type< typename boost::result_of< Filter(typename df_stored_type< T >::type const &) >::type >::type const &) > const &  notifier,
bool  b_inc_local_usr_cnt,
Filter const &  filter 
)

Receive a local consumption request with associated notifier and filter. Integrate it into edge_entry's local dependence representation and signal caller (edge_container::setup_flow) if any remote notification is required.

Parameters
ctthe edge_container holding this edge_entry.
notifierThe notifier to invoke when the requested data flow is complete and available for consumption.
filterThe filtering function to be applied on the producer task's value prior to passing it successor.
b_inc_local_usr_cntDenotes whether this is a consumer that will rely on the entry's copy of the flowed value. Guides internal reference counting.
Returns
Pair containing add_status variable to guide creation of remote notifier and the version identifier associated with filter to use if remote notifier is created.

◆ add_remote_notifier()

template<typename T >
template<typename Notifier >
void stapl::detail::edge_entry< T >::add_remote_notifier ( edge_container ct,
Notifier const &  notifier,
const size_t  loc,
const bool  b_upgrade 
)

Add a notifier to transmit a producer value (full or filtered) to a remote consumer location and trigger data flow of local consumer edges there.

Parameters
ctThe edge container this entry is held by.
notifierThe notifier to called when the producer task finishes execution (encapsulate any filter function).
locThe location this notifier originated from.
b_upgradeDenotes whether this request upgrades a previous remote notification from location loc to higher request level (i.e., FILTERED –> FULL).
See also
remote_edge_version_entry

Currently only called on the producer location.

◆ add_remote_signal_notifier()

template<typename T >
void stapl::detail::edge_entry< T >::add_remote_signal_notifier ( edge_container ct,
size_t  loc 
)
finalvirtual

Add a signal notifier to notify a remote consumer location when a producer task finishes execution.

Parameters
ctThe edge container this entry is held by.
locThe location this notifier originated from.

Reimplemented from stapl::detail::edge_entry_base.

◆ set_value() [1/2]

template<typename T >
template<typename Filter , typename ValueParam >
void stapl::detail::edge_entry< T >::set_value ( ValueParam &&  val,
edge_container ct,
unsigned int  version_id,
bool  b_caller_is_set_element = false,
bool  b_caller_is_migration = false 
)

Used to trigger data flow in this entry for edges that can be serviced with the version of the value that has been passed.

Parameters
valThe edge value that has been flowed.
ctThe edge container this entry is held by.
version_idThe version identifier for val. Zero if the full producer. Otherwise a filtered version with the identifier previously assigned in add_local_notifier.
b_caller_is_set_elementDenotes whether the caller of this method is set_element (i.e., the original data flow directly from the producer task).
b_caller_is_migrationDenotes this is called when moving a predecessor value for a successor migrated task. Guards assertions checking previous existence of value (to verify protocol correctness).

◆ set_value() [2/2]

template<typename T >
void stapl::detail::edge_entry< T >::set_value ( edge_container ct)
finalvirtual

Used to trigger data flow in this entry for edges that are void.

Parameters
ctThe edge_container holding this entry.

Redirect to general set_value with default constructed value (this type may be unknown in the calling context, as this is a virtual function that can be called through edge_entry_base.

Reimplemented from stapl::detail::edge_entry_base.

◆ persistent_evictable()

template<typename T >
bool stapl::detail::edge_entry< T >::persistent_evictable ( void  ) const

The general evictability test for the edge_entry. Detects whether this entry is no longer needed on the location and can be removed.

Verifies all consumers have been registered and notified (if this is the producer location) and that no local consumers are still using any version maintained by the entry.

◆ evictable()

template<typename T >
bool stapl::detail::edge_entry< T >::evictable ( void  ) const

Check whether this entry is no longer needed on the location and can be removed.

Guarded to return false if the PARAGRAPH is persistent. Eviction attempts in the edge container are disabled, allowing entry to remain until the destructor of the edge_container (as part of overall PARAGRAPH destruction).

◆ migrate()

template<typename T >
size_t stapl::detail::edge_entry< T >::migrate ( remote_notifier_list_t other,
int &  ct_unknown_consumer_cnt 
)

Extract all state necessary to migrate the producer state from this entry and move it to new execution location.

Parameters
otherA reference to an empty notifier list. Move all remote notifiers into this. edge_container::migrate_entry will forward these notifiers there after invoking directory::migrate.
ct_unknown_consumer_cntA reference to the edge container's global unknown consumer count. Decrement with entry's current unknown count, as these are now another location's responsibility to track.
Returns
The original successor count specified for the producer task.
See also
edge_container::migrate_entry

◆ reset_values()

template<typename T >
void stapl::detail::edge_entry< T >::reset_values ( void  )
finalvirtual

Reset data flow triggers prior to a persistent PARAGRAPH reinvocation.

Reset the remote version list and all versions stored in the versions list. Also invoke edge_entry_base::reset_values to reset the signal version list.

Reimplemented from stapl::detail::edge_entry_base.

◆ set_as_producer()

void stapl::detail::edge_entry_base::set_as_producer ( size_t  consumer_cnt)
inherited

Inform this edge entry that the producer task has been initialized on this location.

Parameters
consumer_cntThe number of consumers as specified by the corresponding add_task call. Possible value is defer_spec, denoting that this count will be specified later.
See also
delayed_set_num_consumers

◆ delayed_set_num_consumers()

void stapl::detail::edge_entry_base::delayed_set_num_consumers ( size_t  consumer_cnt)
inherited

Set the number of successors after delay_spec was passed to set_as_producer.

Parameters
consumer_cntThe out-degree of the producer task in the PARAGRAPH.

◆ decrement_unknown_consumers()

void stapl::detail::edge_entry_base::decrement_unknown_consumers ( void  )
inherited

Reduce the unregistered consumer count.

Called when previous consumption on a consumer location covers a request, meaning no additional notifications are required. A simple decrement of out-degree counter is sufficient.

◆ increment_local_consumers()

void stapl::detail::edge_entry_base::increment_local_consumers ( void  )
inherited

Increase reference count of local proxies in use by consumer tasks and backed by a version in this edge entry.

See also
edge_accessor

◆ decrement_local_consumers()

void stapl::detail::edge_entry_base::decrement_local_consumers ( void  )
inherited

Decrease reference count of local proxies in use by consumer tasks and backed by a version in this edge entry.

See also
edge_accessor

◆ local_producer_initialized()

bool stapl::detail::edge_entry_base::local_producer_initialized ( ) const
inherited

Check if the producer task for edge_entry is registered on this location.

Sufficient to check if m_unknown_consumer_cnt has been initialized.

◆ set_signal()

void stapl::detail::edge_entry_base::set_signal ( executor_base executor_ptr,
const bool  b_migration_enabled 
)
inherited

Set data flow for signal consumers by notifying the signal version notifier list.

Parameters
executor_ptrThe executor associated with the given PARAGRAPH.
b_migration_enabledDenotes whether the PARAGRAPH has task migration support enabled.

◆ compute_request_status()

df_add_status stapl::detail::edge_entry_base::compute_request_status ( const edge_request_type  req,
const bool  b_flow,
const bool  b_partial_added = false 
)
inherited

Called when adding a local notification to determine whether a a consumption request is covered by previous requests or whether a new remote notifier needs to be generated and sent to the producer location.

Parameters
reqThe type of request that has just been added.
b_flowWhether data flow has already been triggered on this consumer location for req.
b_partial_addedIf req is partial, denotes if this request added a new version (i.e., filter) on this location for the producer task value.
See also
add_signal_notifier
edge_entry::add_local_notifier

◆ add_signal_notifier()

df_add_status stapl::detail::edge_entry_base::add_signal_notifier ( executor_base executor,
signal_notifier_t  notifier 
)
inherited

Add a signal notifier for a local task. Return the request level status information by calling compute_request_status.

Parameters
executorThe executor associated with the PARAGRAPH. Passed to notifier if it is immediately called (i.e., the signal flow has already been set.
notifierThe signal notifier for the successor task.
See also
edge_container::setup_signal_flow

Friends And Related Function Documentation

◆ operator<<

template<typename T >
std::ostream& operator<< ( std::ostream &  os,
edge_entry< T > const &  entry 
)
friend

Define insertion operator on ostream. Provides useful debugging information.

Parameters
osThe output stream to insert into.
entryThe edge entry to insert information about into the stream.

Member Data Documentation

◆ m_unknown_consumer_cnt

size_t stapl::detail::edge_entry_base::m_unknown_consumer_cnt
protectedinherited

Count of consumers which are still unaccounted for. Only initialized on producer location, where the edge_entry will be kept in edge_container at least until all consumers have registered, decrementing this field to 0. Value of defer_spec, denotes location is set as producer location, but successor count will be set separately.

See also
delayed_set_num_consumers

◆ m_b_signal_only

const bool stapl::detail::edge_entry_base::m_b_signal_only
protectedinherited

Is the actual object instantiated edge_entry_base or edge_entry<T>. Used to detect if we need to upgrade the entry based to edge_entry object.

See also
edge_container::lookup_or_insert

◆ m_b_consumers_before_producer

bool stapl::detail::edge_entry_base::m_b_consumers_before_producer
protectedinherited

Tracks whether consumer tasks at this location registered before the producer was registered. If so, their remote notifiers may arrive out of order. In debug mode, we need to track this for assertion.

See also
remote_edge_version_entry::add_notifier

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