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 Types | Protected Attributes
stapl::paragraph_impl::nested_pg_directory Class Reference

Basic generalization of a directory for keys referring to a distributed object. Specific use here is to forward consumption requests from one nested paragraph to another. More...

Public Member Functions

template<typename TaskMapperParam >
 nested_pg_directory (task_graph *tg_ptr, TaskMapperParam &&task_mapper_param)
 
 nested_pg_directory (nested_pg_directory const &)=delete
 
nested_pg_directoryoperator= (nested_pg_directory const &)=delete
 
 ~nested_pg_directory ()
 
bool has_pending_requests (void) const
 
void add_producer (key_type key, rmi_handle::reference handle, size_t num_succs)
 Forward the handle and successor count of a PARAGRAPH to the managing location for the task in the directory so that it is discoverable by consumers.
 
template<typename T , typename PortFilter , typename ValueFilter , typename LocationMapper >
void setup_flow (key_type producer, rmi_handle::reference consumer_handle, location_type consumer_location, PortFilter port_filter, ValueFilter value_filter, LocationMapper location_mapper)
 Forward request to a producer nested paragraph that it flows its return value to the consumer nested paragraph with rmi_handle::reference consumer. More...
 
template<typename Mapper >
void setup_parent_flow (key_type producer, Mapper mapper)
 Forward request to a producer nested paragraph that it flows its return value to its parent output port using the specified mapper class that remaps indices and filter dataflow if necessary. More...
 
bool has_perfect_mapper (void) const
 
mapper_t const & key_mapper (void) const
 
mapper_t & key_mapper (void)
 
bool empty (void) const
 Returns true if there are no entries in directory's registry on this location.
 
void reset (void)
 Clear all local registrations and pending messages in directory. Used by clear() methods of container distributions.
 
bool try_register_key_local (std::size_t const &key)
 Attempt registration from the managing location. Return true if successful (i.e., not already registered).
 
void register_key (std::size_t const &key)
 Associate key in directory's registry with the location invoking this method. More...
 
void register_keys (std::pair< std::size_t, std::size_t > const &keys)
 
void register_apply (std::size_t const &key, Functor &&f)
 Associate key in directory's registry with location invoking this method. Registration location is implicitly set to be caller of this method. More...
 
void register_apply (std::size_t const &key, Functor &&f, location_type location)
 Associate key in directory's registry with location invoking this method. More...
 
void unregister_key (std::size_t const &key)
 Unregister key in directory's registry.
 
void unregister_apply (std::size_t const &key, Functor &&f)
 Unregister key and apply a function object f at location where directory's registry manages key. More...
 
void invoke_where (Functor &&f, std::size_t const &key)
 Invoke function object at the location where key is currently registered. More...
 
void try_invoke_where (Functor &&f, std::size_t const &key)
 Invoke function object at the location where key is currently registered if the key is registered. More...
 
void unordered_invoke_where (Functor &&f, std::size_t const &key)
 Invoke function object at the location where key is currently registered, disregarding RMI causal ordering. More...
 
locality_info locality (std::size_t const &key)
 Provide locality information about a key managed by the directory. More...
 
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 mapped_type = tuple< rmi_handle::reference, size_t >
 
using manager_type = mapper_t
 
using registry_type = registry_t
 
using key_type = std::size_t
 
using size_type = rmi_handle::size_type
 

Public Attributes

std::unordered_map< key_type, mapped_type > m_producers
 
std::size_t m_pending_messages
 
task_graphm_tg_ptr
 

Protected Member Functions

void execute (Functor &&f)
 Internal method, target of RMI called via migrate_impl to invoke functor f at new registration location, post registry update. More...
 
void invoke_at_manager (std::size_t const &key, void(Directory::*const pmf)(PMFArgs...), Args &&... args)
 Forwards functor and arguments to location managing key. The location managing the key will invoke the method with the supplied arguments. More...
 
void invoke_at_manager (std::size_t const &key, void(Directory::*const pmf)(PMFArgs...) const, Args &&... args) const
 Forwards const functor and arguments to location managing key. The location managing the key will invoke the method with the supplied arguments. More...
 
void invoke_at_manager_impl (std::size_t const &key, void(Directory::*const pmf)(PMFArgs...), Args &&... args)
 Implementation of. More...
 
void invoke_at_manager_impl (std::size_t const &key, void(Directory::*const pmf)(PMFArgs...) const, Args &&... args) const
 Implementation of. More...
 
void flush_pending (const location_type loc, std::size_t const &key, queue_t &pending)
 Forward all buffered requests for key to location loc. More...
 
void request_forward (std::size_t const &key, Functor &&f)
 Internal method used to facilitate invocation of f on location where key is currently registered. Called via RMI on directory location where key is managed. More...
 
void try_request_forward (std::size_t const &key, Functor &&f)
 Internal method used to facilitate invocation of f on location where key is currently registered. If key is not registered, the request is dropped; otherwise, it is called via RMI on directory location where key is managed. This is directed at situations where it is legal for a key to not exist, i.e. erasing non-existent keys in the unordered set container. More...
 

Protected Types

using mapper_t = typename select_parameter< boost::function< std::pair< location_type, loc_qual >(size_t)>, detail::default_key_mapper< std::size_t > >::type
 
using registry_t = typename select_parameter< use_default, boost::unordered_map< std::size_t, location_type, boost::hash< std::size_t >, std::equal_to< std::size_t >, pool_allocator< std::pair< std::size_t const, location_type > > > >::type
 
using transmitter_type = typename select_parameter< use_default, async_transmitter >::type
 
using queue_t = request_queue< request_t >
 
using queues_t = boost::unordered_map< std::size_t, queue_t, stapl::hash< std::size_t >, std::equal_to< std::size_t >, pool_allocator< std::pair< std::size_t const, queue_t > > >
 

Protected Attributes

registry_t m_registry
 Stores key to locations mapping.
 
queues_t m_pending
 Map of queues, indexed by Key. Entry for keys exists when messages arrive and must be buffered prior to registration, during migration, etc.
 
mapper_t m_key_mapper
 Map a key to location that manages it (i.e., where it has entry in m_registry).
 
bool m_b_perfect_mapper
 

Detailed Description

Basic generalization of a directory for keys referring to a distributed object. Specific use here is to forward consumption requests from one nested paragraph to another.

Constructor & Destructor Documentation

◆ ~nested_pg_directory()

stapl::paragraph_impl::nested_pg_directory::~nested_pg_directory ( )

Member Function Documentation

◆ setup_flow()

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

Forward request to a producer nested paragraph that it flows its return value to the consumer nested paragraph with rmi_handle::reference consumer.

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.

◆ setup_parent_flow()

template<typename Mapper >
void stapl::paragraph_impl::nested_pg_directory::setup_parent_flow ( key_type  producer,
Mapper  mapper 
)

Forward request to a producer nested paragraph that it flows its return value to its parent output port using the specified mapper class that remaps indices and filter dataflow if necessary.

◆ execute()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::execute ( Functor &&  f)
protectedinherited

Internal method, target of RMI called via migrate_impl to invoke functor f at new registration location, post registry update.

Parameters
fNullary functor to apply.
See also
migrate_impl()

◆ invoke_at_manager() [1/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::invoke_at_manager ( std::size_t const &  key,
void(Directory::*)(PMFArgs...)  pmf,
Args &&...  args 
)
protectedinherited

Forwards functor and arguments to location managing key. The location managing the key will invoke the method with the supplied arguments.

Parameters
keyKey value whose managing location (i.e., where registry entry is stored) is where pmf will be invoked.
pmfDirectory member function to be invoked.
argsvariadic list of arguments to be applied.

This is used to internally encapsulate to forward various method invocations from the requester (e.g., registration, invoke_where, etc) to the location where they can be serviced, forwarded, etc.

See also
directory_base::invoke_where

◆ invoke_at_manager() [2/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::invoke_at_manager ( std::size_t const &  key,
void(Directory::*)(PMFArgs...) const  pmf,
Args &&...  args 
) const
protectedinherited

Forwards const functor and arguments to location managing key. The location managing the key will invoke the method with the supplied arguments.

Parameters
keyKey value whose managing location (i.e., where registry entry is stored) is where pmf will be invoked.
pmfDirectory const member function to be invoked.
argsvariadic list of arguments to be applied.

This is used to internally encapsulate to forward various method invocations from the requester (e.g., registration, invoke_where, etc) to the location where they can be serviced, forwarded, etc.

See also
directory_base::invoke_where

◆ invoke_at_manager_impl() [1/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::invoke_at_manager_impl ( std::size_t const &  key,
void(Directory::*)(PMFArgs...)  pmf,
Args &&...  args 
)
protectedinherited

Implementation of.

See also
invoke_at_manager with a given transmitter
Template Parameters
TransThe transmitter type

◆ invoke_at_manager_impl() [2/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::invoke_at_manager_impl ( std::size_t const &  key,
void(Directory::*)(PMFArgs...) const  pmf,
Args &&...  args 
) const
protectedinherited

Implementation of.

See also
invoke_at_manager with a given transmitter
Template Parameters
TransThe given transmitter type

◆ flush_pending()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::flush_pending ( const location_type  loc,
std::size_t const &  key,
queue_t pending 
)
protectedinherited

Forward all buffered requests for key to location loc.

Parameters
locLocation to send buffered requests to.
keyKey value buffered requests are for.
pendingPending queue associated with Key.

This is internal method only called on the directory location managing key.

◆ request_forward()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::request_forward ( std::size_t const &  key,
Functor &&  f 
)
protectedinherited

Internal method used to facilitate invocation of f on location where key is currently registered. Called via RMI on directory location where key is managed.

Parameters
keyKey whose registered location determines where f should be executed.
fFunctor to invoke (unary, key passed as parameter).

Called by invoke_where and execute (the latter when migration enabled).

◆ try_request_forward()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::try_request_forward ( std::size_t const &  key,
Functor &&  f 
)
protectedinherited

Internal method used to facilitate invocation of f on location where key is currently registered. If key is not registered, the request is dropped; otherwise, it is called via RMI on directory location where key is managed. This is directed at situations where it is legal for a key to not exist, i.e. erasing non-existent keys in the unordered set container.

Parameters
keyKey whose registered location determines where f should be executed.
fFunctor to invoke (unary, key passed as parameter).

Called by invoke_where and execute (the latter when migration enabled).

◆ register_key()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::register_key ( std::size_t const &  key)
inherited

Associate key in directory's registry with the location invoking this method.

◆ register_apply() [1/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::register_apply ( std::size_t const &  key,
Functor &&  f 
)
inherited

Associate key in directory's registry with location invoking this method. Registration location is implicitly set to be caller of this method.

Parameters
keyKey to register.
fUnary function object (receives key) as parameter to call after registration.

◆ register_apply() [2/2]

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::register_apply ( std::size_t const &  key,
Functor &&  f,
location_type  location 
)
inherited

Associate key in directory's registry with location invoking this method.

Parameters
keyKey to registered.
fUnary function object (receives key) as parameter to call after registration.
locationLocation this key should be mapped to in the registry.

◆ unregister_apply()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::unregister_apply ( std::size_t const &  key,
Functor &&  f 
)
inherited

Unregister key and apply a function object f at location where directory's registry manages key.

Parameters
keyKey to unregister.
fUnary function object (receives key) as parameter to call after unregistration.

◆ invoke_where()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::invoke_where ( Functor &&  f,
std::size_t const &  key 
)
inherited

Invoke function object at the location where key is currently registered.

Parameters
fFunctor to apply. Unary operator, receives key as parameter.
keyRegistered key

◆ try_invoke_where()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::try_invoke_where ( Functor &&  f,
std::size_t const &  key 
)
inherited

Invoke function object at the location where key is currently registered if the key is registered.

Parameters
fFunctor to apply. Unary operator, receives key as parameter.
keyKey that may not be registered when method is invoked

◆ unordered_invoke_where()

void stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::unordered_invoke_where ( Functor &&  f,
std::size_t const &  key 
)
inherited

Invoke function object at the location where key is currently registered, disregarding RMI causal ordering.

Parameters
fFunctor to apply. Unary operator, receives key as parameter.
keyRegistered key

◆ locality()

locality_info stapl::detail::directory_base< std::size_t , use_default , boost::function< std::pair< location_type, loc_qual >(size_t)> , use_default , EnableMigration >::locality ( std::size_t const &  key)
inherited

Provide locality information about a key managed by the directory.

Parameters
keyregistered key
Note
Used by containers that inherit / customize directory behavior.

◆ 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.

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