Peano
Loading...
Searching...
No Matches
tarch::multicore::tbb::TaskHandleRepository Class Reference

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
 

Detailed Description

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.

Member Typedef Documentation

◆ Handle

using tarch::multicore::tbb::TaskHandleRepository::Handle = ::oneapi::tbb::task_handle

Definition at line 64 of file TaskHandleRepository.h.

◆ HashMap

using tarch::multicore::tbb::TaskHandleRepository::HashMap = oneapi::tbb::concurrent_hash_map<TaskNumber, oneapi::tbb::task_handle*>
private

Definition at line 97 of file TaskHandleRepository.h.

◆ TaskNumber

Constructor & Destructor Documentation

◆ TaskHandleRepository()

tarch::multicore::tbb::TaskHandleRepository::TaskHandleRepository ( )
default

◆ ~TaskHandleRepository()

tarch::multicore::tbb::TaskHandleRepository::~TaskHandleRepository ( )

Definition at line 56 of file TaskHandleRepository.cpp.

Member Function Documentation

◆ addDependencies()

void tarch::multicore::tbb::TaskHandleRepository::addDependencies ( Handle * newTask,
const std::set< TaskNumber > & in_dependencies )

Definition at line 35 of file TaskHandleRepository.cpp.

◆ addDependency()

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.

◆ registerTask()

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.

Field Documentation

◆ _taskHandleContainer

HashMap tarch::multicore::tbb::TaskHandleRepository::_taskHandleContainer
private

Definition at line 102 of file TaskHandleRepository.h.


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