Peano
Loading...
Searching...
No Matches
dynamic_task_graph.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. It
3// supplements something to oneTBB which has been removed and which I need:
4// dynamic tasking. Therefore I add it to the tbb namespace rather than
5// Peano's tarch.
6#pragma once
7
8
9
10#include <functional>
11#include <set>
12#include <tbb/task_arena.h>
13#include <oneapi/tbb/task_group.h>
14#include <oneapi/tbb/spin_mutex.h>
15#include <oneapi/tbb/spin_rw_mutex.h>
16#include <oneapi/tbb/concurrent_unordered_set.h>
17
18
19namespace tbb {
20 class dynamic_task_graph_node;
21 class dynamic_task_graph_spawned_node;
22 class dynamic_task_graph;
23 class dynamic_task_graph_node_repository;
24}
25
26
121namespace tbb {
139 public:
141
149 ::oneapi::tbb::task_group& arena
150 );
151
210
243
247 void wait( const std::set<dynamic_task_graph_node>& node );
248
274
280 std::size_t size() const;
281 private:
282 ::oneapi::tbb::task_group& _task_group;
283
294 using SpawnedTaskMutex = ::oneapi::tbb::spin_rw_mutex;
296
307 using SpawnedTasksContainer = std::set< std::shared_ptr<dynamic_task_graph_spawned_node> >;
308
313
322 };
323}
324
Represents one node in task graph.
Very simple dynamic task graph interface.
std::size_t size() const
Number of tasks in graph.
void wait(dynamic_task_graph_node node)
Wait for one specific node.
::oneapi::tbb::task_group & _task_group
void put(dynamic_task_graph_node &node)
Put a new node into the task graph.
dynamic_task_graph(::oneapi::tbb::task_group &arena)
Construct task graph over arena.
::oneapi::tbb::spin_rw_mutex SpawnedTaskMutex
I originally used.
void wait_for_all()
Wait for all tasks to finish.
SpawnedTaskMutex _spawned_task_mutex
SpawnedTasksContainer _spawned_tasks
Spawned tasks known to system.
void wait(const std::set< dynamic_task_graph_node > &node)
Wait for set of nodes.
std::set< std::shared_ptr< dynamic_task_graph_spawned_node > > SpawnedTasksContainer
See documentation of dynamic_task_graph_spawned_node for a discussion why we have to use smart pointe...
void clean_up_completed_tasks()
Remove all completed task.
I've written an API to IIT, but I'm not currently using.