![]() |
Peano
|
Simple utility class around dynamic task graphs to work with integer task numbers. More...
#include <TaskHandleRepository.h>
Public Types | |
using | TaskNumber = int |
using | Handle = ::oneapi::tbb::task_handle |
Public Member Functions | |
TaskHandleRepository ()=default | |
~TaskHandleRepository () | |
void | registerTask (Handle *newTask, TaskNumber number) |
Factory mechanism. | |
void | addDependency (Handle *newTask, const TaskNumber &in_dependency) |
Add dependency. | |
void | addDependencies (Handle *newTask, const std::set< TaskNumber > &in_dependencies) |
Private Types | |
using | HashMap = oneapi::tbb::concurrent_hash_map<TaskNumber, oneapi::tbb::task_handle*> |
Private Attributes | |
HashMap | _taskHandleContainer |
Simple utility class around dynamic task graphs to work with integer task numbers.
It handles the management of the nodes, such that users can work with integer task numbers instead. The only interesting thing here is that users can obviously "overwrite" tasks, i.e. create a new task with the same number over and over again. Usually, the newest task is the ruling one, i.e. hides all previous ones. However, when you add a task dependency for a task to itself, this bookkeeping interprets this as: Hey, I have a task with number A and now create a new task with number A, but that one should only run once the first one has completed.
I use the name handle here, as we never directly interact with tasks. In TBB, there's actually the notion of a task handle. In my own TBB extension, we work with a dynamic task graph node which wraps (contains) a task that is shielded away. You would never interact with the tasks directly here either.
Definition at line 56 of file TaskHandleRepository.h.
using tarch::multicore::tbb::TaskHandleRepository::Handle = ::oneapi::tbb::task_handle |
Definition at line 64 of file TaskHandleRepository.h.
|
private |
Definition at line 97 of file TaskHandleRepository.h.
Definition at line 58 of file TaskHandleRepository.h.
|
default |
tarch::multicore::tbb::TaskHandleRepository::~TaskHandleRepository | ( | ) |
Definition at line 56 of file TaskHandleRepository.cpp.
void tarch::multicore::tbb::TaskHandleRepository::addDependencies | ( | Handle * | newTask, |
const std::set< TaskNumber > & | in_dependencies ) |
Definition at line 35 of file TaskHandleRepository.cpp.
void tarch::multicore::tbb::TaskHandleRepository::addDependency | ( | Handle * | newTask, |
const TaskNumber & | in_dependency ) |
Add dependency.
If in_dependency equals new_task_node, then we assume that it refers to a previously submitted task with the same number. If no such task is known, the add_dependency creates an anti-dependency. We simply ignore it.
Definition at line 42 of file TaskHandleRepository.cpp.
References assertionMsg.
void tarch::multicore::tbb::TaskHandleRepository::registerTask | ( | Handle * | newTask, |
TaskNumber | number ) |
Factory mechanism.
If there's already a task with that number, it will be thrown away. If you want to have tasks with in/out dependencies (identified through the same task number), you have to add these a priori.
Definition at line 18 of file TaskHandleRepository.cpp.
|
private |
Definition at line 102 of file TaskHandleRepository.h.