Peano
Loading...
Searching...
No Matches
TaskHandleRepository.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org.
3#pragma once
4
5#include "config.h"
6
7
8#if defined(SharedTBBExtension) or defined(SharedTBB)
9
10#include <functional>
11#include <set>
12#include <tbb/task_arena.h>
13
14#include <oneapi/tbb/task_group.h>
15#include <oneapi/tbb/task_arena.h>
16#include <oneapi/tbb/concurrent_hash_map.h>
17#include <oneapi/tbb/concurrent_queue.h>
18
19
20#if !defined(SharedTBBExtension) and !defined(TBB_USE_TASK_GROUP_PREVIEW)
21// In the new TBB version, all the handle and dynamic task graph stuff is
22// merged into the core tasking. No additional includes required.
23#else
27#endif
28
29
30namespace tarch {
31 namespace multicore {
32 namespace tbb {
34 }
35 }
36}
37
57 public:
58 using TaskNumber = int;
59
62
63 #if !defined(SharedTBBExtension) and !defined(TBB_USE_TASK_GROUP_PREVIEW)
64 using Handle = ::oneapi::tbb::task_handle;
65 #else
67 #endif
68
69
70
78 void registerTask(
79 Handle* newTask,
80 TaskNumber number
81 );
82
91 void addDependency( Handle* newTask, const TaskNumber& in_dependency);
92
93 void addDependencies( Handle* newTask, const std::set< TaskNumber >& in_dependencies );
94
95 private:
96 #if !defined(SharedTBBExtension) and !defined(TBB_USE_TASK_GROUP_PREVIEW)
97 using HashMap = oneapi::tbb::concurrent_hash_map<TaskNumber, oneapi::tbb::task_handle*>;
98 #else
99 using HashMap = oneapi::tbb::concurrent_hash_map<TaskNumber, ::tbb::dynamic_task_graph_node*>;
100 #endif
101
103};
104
105#endif
Simple utility class around dynamic task graphs to work with integer task numbers.
oneapi::tbb::concurrent_hash_map< TaskNumber, oneapi::tbb::task_handle * > HashMap
void registerTask(Handle *newTask, TaskNumber number)
Factory mechanism.
void addDependencies(Handle *newTask, const std::set< TaskNumber > &in_dependencies)
void addDependency(Handle *newTask, const TaskNumber &in_dependency)
Add dependency.
Represents one node in task graph.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
I've written an API to IIT, but I'm not currently using.