STAPL API Reference |
Modules Classes |
Classes | |
struct | stapl::ptr_wrapper< View > |
Wraps a view object with a interface that makes it behave as a pointer to a view of the same type would.This is used for PARAGRAPH edge views passed to add_task calls via consume calls, where there is not a view copy held/owned by the PARAGRAPH (i.e., those passed by user at PARAGRAPH creation). More... | |
class | stapl::paragraph_impl::paragraph_view_base |
Trivial view class for PARAGRAPH holding a task_graph pointer. Used for consume() statements and as a base class of Scheduler typed class template paragraph_view. More... | |
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. More... | |
struct | stapl::result_of::consume< T, OptionalFilterParam > |
Defines return type consume signature in single predecessor case. More... | |
struct | stapl::result_of::aggregated_consume< T, OptionalFilterParam > |
Defines return type consume signature for aggregated, multiple edge consumption and user provided filter function. More... | |
Functions | |
template<typename T , typename... OptionalFilterParam> | |
std::pair< ptr_wrapper< edge_view< T, typename std::decay< OptionalFilterParam >::type... > >, std::size_t > | stapl::consume (paragraph_impl::paragraph_view_base const &, std::size_t tid, OptionalFilterParam &&... filter) |
Creates a parameter passed as a view argument to add_task invocations, denoting that the task should consume the value produced by another task. More... | |
template<typename T , typename TaskIdsRef , typename... OptionalFilterParam> | |
std::enable_if< !std::is_integral< typename std::decay< TaskIdsRef >::type >::value, typename result_of::aggregated_consume< T, OptionalFilterParam... >::type >::type | stapl::consume (paragraph_impl::paragraph_view_base const &pgv, TaskIdsRef &&tids, OptionalFilterParam &&... filter) |
Sets up consumption as the basic consume call, except that multiple predecessors task_ids can be specified. Their results will be presented to consumer task as a view implementing the array_view concept. More... | |
std::pair< ptr_wrapper<edge_view<T, typename std::decay<OptionalFilterParam>::type...> >, std::size_t> stapl::consume | ( | paragraph_impl::paragraph_view_base const & | , |
std::size_t | tid, | ||
OptionalFilterParam &&... | filter | ||
) |
Creates a parameter passed as a view argument to add_task
invocations, denoting that the task should consume the value produced by another task.
The | return type of the consumed task. Not deduced, must be explicitly specified. |
pgv | A view of the paragraph the consumption edge is created in. |
tid | The task identifier of the predecessor task. |
filter | Optional function object to apply to the predecessor task's result prior to passing it the consumer task's workfunction. |
add_task
Example Usage:
pgv.add_task(tid, wf, consume<T>(tid)); // wf is unary in this case
Logically, this should be part of the paragraph_view class. However, since it would then be a member template of class template, the explicit use of the template keyword when calling it would be required (i.e., pgv. template consume<T>(tid)), which is just unacceptable. Hence, it is a freestanding function.
The real work of consume (setting up the actual data flow in the PARAGRAPH) is implemented by the edge_container::setup_flow which is called on the add_task
code path, after some type metafunctions to detect consumption has been requested.
The motivation behind this filtering (instead of just having the caller wrap their workfunction with another to apply this transformation is that the PARAGRAPH attempts to push the filter to the producing location, applying before value transmission, so that no unneeded bits are communicated.
std::enable_if< !std::is_integral<typename std::decay<TaskIdsRef>::type>::value, typename result_of::aggregated_consume<T, OptionalFilterParam...>::type>::type stapl::consume | ( | paragraph_impl::paragraph_view_base const & | pgv, |
TaskIdsRef && | tids, | ||
OptionalFilterParam &&... | filter | ||
) |
Sets up consumption as the basic consume
call, except that multiple predecessors task_ids can be specified. Their results will be presented to consumer task as a view implementing the array_view concept.
The | return type of the consumed tasks (must be the same). Not deduced, must be explicitly specified. |
pgv | A view of the paragraph the consumption edge is created in. |
tids | List in a std::vector of task identifiers of predecessors to consume. |
filter | Optional function object to apply to the predecessor task's result prior to passing it the consumer task's workfunction. |
add_task
. The consumer tasks receives an array_view whose elements are theExample usage:
class wf { template<typename View> void operator()(View values) const { x = values[0]; // x assigned result of task 5. } };
in factory::operator():
vector<size_t> tids; tids.push_back(5); tids.push_back(3); pgv.add_task(task_id, wf, consume<T>(tids)); // new task has 2 preds.