Skip to content

Commit d35e08b

Browse files
Merge branch 'dev'
2 parents 75500ec + 1a4c2c4 commit d35e08b

13 files changed

Lines changed: 714 additions & 304 deletions

File tree

doxygen/releases/master-branch.dox

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ To download the newest version of Cpp-Taskflow, please clone from <a href="https
2121
@li adding per-thread stream to avoid synchronizing with the default stream in running a %cudaFlow
2222
@li adding tf::cudaFlow::repeat and tf::cudaFlow::predicate for iterative execution of a %cudaFlow
2323
@li adding @ref Examples pages
24+
@li making observer a std::shared_ptr object
25+
@li enabling multiple observers to coexit in an executor
2426

2527
@section master-branch_bug_fixes Bug Fixes
2628

2729
@li fixed the bug in assigning the block pointer before constructor of an object in object pool
30+
@li fixed the namespace conflicting in using MPark.Variant from upstream code
2831

2932
@section master-branch_deprecated_items Deprecated Items
3033

examples/cuda/matmul.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ auto cpu(int M, int N, int K) {
8484

8585
std::vector<int> a, b, c;
8686

87-
tf::Executor executor(1);
87+
tf::Executor executor;
8888
tf::Taskflow taskflow;
8989

9090
auto ha = taskflow.emplace([&](){

examples/observer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ int main(){
3636
// dump the execution timeline to json (view at chrome://tracing)
3737
observer->dump(std::cout);
3838

39+
executor.remove_observer(observer);
40+
3941
return 0;
4042
}
4143

examples/simple.cpp

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,24 @@
77

88
int main(){
99

10-
tf::Taskflow taskflow ("Error 1: no source");
11-
12-
auto E = taskflow.emplace([](){}).name("E");
13-
auto C = taskflow.emplace([](){return ::rand()%2; }).name("C");
14-
auto D = taskflow.emplace([](){}).name("D");
15-
auto D_aux = taskflow.emplace([](){}).name("D_aux");
16-
auto F = taskflow.emplace([](){}).name("F");
17-
E.precede(D);
18-
C.precede(D_aux, F);
19-
D_aux.precede(D);
20-
21-
taskflow.dump(std::cout);
22-
23-
//tf::Taskflow taskflow1("taskflow1");
24-
//tf::Taskflow taskflow2("taskflow2");
25-
26-
//auto [A, B] = taskflow1.emplace(
27-
// [] () { std::cout << "TaskA"; },
28-
// [] () { std::cout << "TaskB"; }
29-
//);
30-
//A.precede(B);
31-
//
32-
//auto [C, D] = taskflow2.emplace(
33-
// [] () { std::cout << "TaskC"; },
34-
// [] (tf::Subflow& sf) {
35-
// std::cout << "TaskD";
36-
// auto [D1, D2] = sf.emplace(
37-
// [] () { std::cout << "D1"; },
38-
// [] () { std::cout << "D2"; }
39-
// );
40-
// D1.precede(D2);
41-
// }
42-
//);
43-
//C.precede(D);
44-
45-
//auto E = taskflow2.composed_of(taskflow1);
46-
//D.precede(E);
47-
48-
//executor.run(taskflow2).wait();
49-
50-
//taskflow2.dump(std::cout);
51-
52-
//auto A = taskflow.emplace([]() { std::cout << "TaskA\n"; });
53-
//auto B = taskflow.emplace([]() { std::cout << "TaskB\n"; });
54-
//auto C = taskflow.emplace([]() { std::cout << "TaskC\n"; });
55-
//auto D = taskflow.emplace([]() { std::cout << "TaskD\n"; });
56-
57-
//A.precede(B); // B runs after A // +---+
58-
//A.precede(C); // C runs after A // +---->| B |-----+
59-
//B.precede(D); // D runs after B // | +---+ |
60-
//C.precede(D); // D runs after C // +---+ +-v-+
61-
// // | A | | D |
62-
// // +---+ +-^-+
63-
//executor.run(taskflow).wait(); // | +---+ |
64-
// // +---->| C |-----+
65-
//return 0; // +---+
10+
tf::Executor executor;
11+
tf::Taskflow taskflow("simple");
12+
13+
auto A = taskflow.emplace([]() { std::cout << "TaskA\n"; });
14+
auto B = taskflow.emplace([]() { std::cout << "TaskB\n"; });
15+
auto C = taskflow.emplace([]() { std::cout << "TaskC\n"; });
16+
auto D = taskflow.emplace([]() { std::cout << "TaskD\n"; });
17+
18+
A.precede(B); // B runs after A // +---+
19+
A.precede(C); // C runs after A // +---->| B |-----+
20+
B.precede(D); // D runs after B // | +---+ |
21+
C.precede(D); // D runs after C // +---+ +-v-+
22+
// | A | | D |
23+
// +---+ +-^-+
24+
executor.run(taskflow).wait(); // | +---+ |
25+
// +---->| C |-----+
26+
// +---+
27+
28+
return 0;
6629
}
6730

0 commit comments

Comments
 (0)