|
HDK
|
#include <taskGraph.h>
Classes | |
| class | BaseTask |
Public Types | |
| using | TaskList = std::vector< BaseTask * > |
| Container for allocated tasks to be spawned. More... | |
| using | TaskLists = tbb::enumerable_thread_specific< TaskList > |
| Thread-local storage for allocated tasks to be spawned. More... | |
Public Member Functions | |
| WorkTaskGraph ()=default | |
| ~WorkTaskGraph () noexcept=default | |
| WorkTaskGraph (WorkTaskGraph const &)=delete | |
| WorkTaskGraph & | operator= (WorkTaskGraph const &)=delete |
| template<typename F , typename... Args> | |
| F * | AllocateTask (Args &&...args) |
| template<typename F > | |
| void | RunTask (F *task) |
| WORK_API void | RunLists (const TaskLists &taskLists) |
| void | Wait () |
| Wait on all the running tasks to complete. More... | |
Instances of this class are used to spawn and wait on a directed graph of tasks, where tasks preserve a pointer to their parent task/successor and a ref count to dynamically track pending children. It supports adding new tasks during the execution of running tasks, continuation passing, recycling of task resources, and scheduler bypass.
This organization of tasks is suited for problems that exhibit hierarchical structured parallelism: tasks that discover additional work during their execution. If these optimizations are not required, consider a higher-level abstraction, e.g. WorkParallelForEach or direct submission of work via WorkDispatcher.
Definition at line 36 of file taskGraph.h.
| using WorkTaskGraph::TaskList = std::vector<BaseTask *> |
Container for allocated tasks to be spawned.
Definition at line 57 of file taskGraph.h.
| using WorkTaskGraph::TaskLists = tbb::enumerable_thread_specific<TaskList> |
Thread-local storage for allocated tasks to be spawned.
Definition at line 60 of file taskGraph.h.
|
default |
|
defaultnoexcept |
|
delete |
|
inline |
Allocate and construct a new top-level task to run with RunTask() or RunLists().
The caller owns the returned task until it is passed to RunTask() or RunLists().
Definition at line 68 of file taskGraph.h.
|
delete |
Submit concurrent tasks accumulated in thread-local lists for execution.
Transfers ownership of all the tasks in the taskLists to this task graph instance.
|
inline |
Submit a concurrent task for execution.
Transfers ownership of task to this task graph instance.
Definition at line 76 of file taskGraph.h.
|
inline |
Wait on all the running tasks to complete.
Definition at line 88 of file taskGraph.h.