11# Cpp-Taskflow
2- An easy-to-use and fast header-only library written in C++17 for task-based parallel programming.
2+ An fast header-only library for task-based parallel programming.
33
4- # Scale up Your Program with Cpp-Taskflow
4+ # Get Started with Cpp-Taskflow
55
6- The following example contains most of the syntax you need to use Cpp-Taskflow.
6+ The following example (simple.cpp) contains the basic syntax you need to use Cpp-Taskflow.
77
88``` cpp
9- #include < taskflow.hpp>
10-
119// A simple example to capture the following task dependencies.
1210//
1311// TaskA---->TaskB---->TaskD
1412// TaskA---->TaskC---->TaskD
15- //
13+
14+ #include " taskflow.hpp"
15+
1616int main (){
1717
18- tf::Taskflow<> tf(std::thread : :hardware_concurrency());
18+ tf::Taskflow tf(std::thread : :hardware_concurrency());
1919
2020 auto [ A, B, C, D] = tf.silent_emplace(
2121 [ ] () { std::cout << "TaskA\n"; },
@@ -24,16 +24,24 @@ int main(){
2424 [ ] () { std::cout << "TaskD\n"; }
2525 );
2626
27- A.precede(B);
28- A.precede(C);
29- B.precede(D);
30- C.precede(D);
27+ A.precede(B); // B runs after A
28+ A.precede(C); // C runs after A
29+ B.precede(D); // D runs after B
30+ C.precede(D); // C runs after D
3131
32- tf.wait_for_all();
32+ tf.wait_for_all(); // block until all tasks finish
3333
3434 return 0;
3535}
3636
37+ ```
38+ ``` console
39+ ~$ g++ simple.cpp -O2 -lpthread -o simple
40+ ~$ ./simple
41+ TaskA
42+ TaskC <-- concurrent with TaskB
43+ TaskB <-- concurrent with TaskC
44+ TaskD
3745```
3846
3947# System Requirements
@@ -51,5 +59,6 @@ To use Cpp-Taskflow, you only need a C++17 compiler:
5159
5260# License
5361
54- Copyright © 2018, [ Tsung-Wei Huang] ( http://web.engr.illinois.edu/~thuang19/ ) and Chun-Xun Lin.
62+ Copyright © 2018, [ Tsung-Wei Huang] ( http://web.engr.illinois.edu/~thuang19/ ) and [ Chun-Xun Lin] ( https://github.com/clin99 ) .
5563Released under the [ MIT license] ( https://github.com/twhuang-uiuc/cpp-taskflow/blob/master/LICENSE ) .
64+
0 commit comments