Peano
Loading...
Searching...
No Matches
dynamic_task_graph_spawned_node.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#include <functional>
10#include <set>
11#include <tbb/task_arena.h>
12#include <oneapi/tbb/task_arena.h>
13#include <oneapi/tbb/concurrent_hash_map.h>
14#include <oneapi/tbb/spin_mutex.h>
15
16
17namespace tbb {
18 class dynamic_task_graph_node;
19 class dynamic_task_graph_spawned_node;
20 class dynamic_task_graph;
21}
22
23
24namespace tbb {
47 public:
48 enum class State {
53
59 Spawned,
60
67 };
68
82 const dynamic_task_graph_node& task_specification,
83 dynamic_task_graph& task_graph
84 );
85
90
102
104
141 void run();
142
146 std::string to_string() const;
147
153 bool add_successor( std::shared_ptr<dynamic_task_graph_spawned_node> successor );
154
155 bool has_terminated() const;
156 private:
158 std::function<void()> _functor;
159
165 tbb::spin_mutex _dependencies_semaphore;
168 std::vector< std::shared_ptr<dynamic_task_graph_spawned_node> > _out_dependency;
169
170 #if TBB_USE_DEBUG>0
171 std::string _task_description;
172 #endif
173 };
174
175}
Represents one node in task graph.
void incoming_task_has_terminated()
Decrement the incoming task counter and run if now ready.
tbb::spin_mutex _dependencies_semaphore
Semaphore over all the dependencies.
dynamic_task_graph_spawned_node(const dynamic_task_graph_spawned_node &)=delete
You cannot copy a spawned node.
dynamic_task_graph_spawned_node(const dynamic_task_graph_node &task_specification, dynamic_task_graph &task_graph)
Create a new task node in the graph.
@ Submitted
Task is submitted but not yet running.
@ Complete
Once a task has terminated, it toggles to complete.
bool add_successor(std::shared_ptr< dynamic_task_graph_spawned_node > successor)
std::string to_string() const
Helper routine, which likely will not be there in TBB counterpart.
std::vector< std::shared_ptr< dynamic_task_graph_spawned_node > > _out_dependency
Very simple dynamic task graph interface.
I've written an API to IIT, but I'm not currently using.