Skip to content

Commit 67fc5c1

Browse files
updated docs
1 parent b23c49f commit 67fc5c1

22 files changed

+464
-306
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ The folder `example/` contains several examples and is a great place to learn to
788788
+ Report bugs/issues by submitting a [GitHub issue][GitHub issues]
789789
+ Submit contributions using [pull requests][GitHub pull requests]
790790
+ Learn more about Cpp-Taskflow by reading the [documentation][wiki]
791-
+ Find a solution to your question at [Frequently Asked Questions][FAQ]
792791

793792
# Who is Using Cpp-Taskflow?
794793

@@ -857,7 +856,6 @@ Cpp-Taskflow is licensed under the [MIT License](./LICENSE).
857856
[NSF]: https://www.nsf.gov/
858857
[UIUC]: https://illinois.edu/
859858
[CSL]: https://csl.illinois.edu/
860-
[FAQ]: ./docs/faq.md
861859
[wiki]: https://cpp-taskflow.github.io/cpp-taskflow/index.html
862860
[PayMe]: https://www.paypal.me/twhuang/10
863861
[C++17]: https://en.wikipedia.org/wiki/C%2B%2B17

docs/Doxyfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ ALIASES += std_variant="<a href=\"https://en.cppreference.com/w/cpp/utility/vari
255255
ALIASES += std_optional="<a href=\"https://en.cppreference.com/w/cpp/utility/optional\">std::optional</a>"
256256
ALIASES += std_nullopt="<a href=\"https://en.cppreference.com/w/cpp/utility/optional/nullopt\">std::nullopt</a>"
257257
ALIASES += GraphVizOnline="<a href=\"https://dreampuf.github.io/GraphvizOnline/\">GraphViz Online</a>"
258+
ALIASES += CPP17="<a href=\"https://en.wikipedia.org/wiki/C%2B%2B17\">C++17</a>"
258259

259260
# This tag can be used to specify a number of word-keyword mappings (TCL only).
260261
# A mapping has the form "name=value". For example adding "class=itcl::class"
@@ -824,6 +825,7 @@ INPUT = ../taskflow/taskflow.hpp \
824825
cookbook/Chapter4.dox \
825826
cookbook/Chapter5.dox \
826827
cookbook/Chapter6.dox \
828+
FAQ.dox \
827829
header.html
828830

829831
# This tag can be used to specify the character encoding of the source files

docs/FAQ.dox

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
namespace tf {
2+
3+
/** @page FAQ Frequently Asked Questions
4+
5+
This page summarizes a list of frequently asked questions about Cpp-Taskflow.
6+
If you cannot find a solution here, please post an issue at
7+
<a href="https://github.com/cpp-taskflow/cpp-taskflow/issues">here</a>.
8+
9+
@section GeneralQuestions General Questions
10+
11+
@subsection GeneralQuestion1 Q1: What's the goal of Cpp-Taskflow?
12+
13+
Cpp-Taskflow aims to help C++ developers quickly implement efficient
14+
parallel decomposition strategies using task-based approaches.
15+
16+
@subsection GeneralQuestion2 Q2: How do I use Cpp-Taskflow in my projects?
17+
18+
Cpp-Taskflow is a header-only library with zero dependencies.
19+
The only thing you need is a @CPP17 compiler.
20+
To use Cpp-Taskflow, simply drop the folder @c taskflow/
21+
to your project and include taskflow.hpp.
22+
23+
@subsection GeneralQuestion3 Q3: What is the difference between static tasking and dynamic tasking?
24+
25+
Static tasking refers to those tasks created before execution,
26+
while dynamic tasking refers to those tasks created during the execution of static tasks
27+
or dynamic tasks (nested).
28+
Dynamic tasks created by the same task node are grouped together to a subflow.
29+
30+
@subsection GeneralQuestion4 Q4: How many tasks can Cpp-Taskflow handle?
31+
32+
Benchmarks showed Cpp-Taskflow can efficiently handle millions or billions of tasks
33+
(both large and small tasks) on a machine with up to 64 CPUs.
34+
35+
@subsection GeneralQuestion5 Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?
36+
37+
The hex value represents the memory address of the task.
38+
Each task has a method tf::Task::name(const std::string&) for user to assign a human readable string
39+
to ease the debugging process. If a task is not assigned a name or is an internal node,
40+
its address value in the memory is used instead.
41+
42+
----
43+
44+
45+
@section ProgrammingQuestions Programming Questions
46+
47+
@subsection ProgrammingQuestions1 Q1: What is the difference between Cpp-Taskflow threads and workers?
48+
49+
The master thread owns the thread pool and can spawn workers to run tasks
50+
or shutdown the pool.
51+
Giving taskflow @c N threads means using @c N threads to do the works,
52+
and there is a total of @c N+1 threads (including the master threads) in the program.
53+
54+
@code{.cpp}
55+
tf::Taskflow(N); // N workers, N+1 threads in the program.
56+
@endcode
57+
58+
If there is no worker threads in the pool, the master thread will do all the works by itself.
59+
Please refer to @ref C6_MasterWorkersAndExecutor for more details.
60+
61+
@subsection ProgrammingQuestions2 Q2: What is the Lifetime of a Task and a Graph?
62+
63+
The lifetime of a task sticks with its parent graph. A task is not destroyed until its parent
64+
graph is destroyed.
65+
Please refer to @ref LifeTimeOfAGraph for more details.
66+
67+
@subsection ProgrammingQuestions3 Q3: Is taskflow thread-safe?
68+
69+
No, the taskflow object is not thread-safe. You can't create tasks from multiple threads
70+
at the same time.
71+
72+
@subsection ProgrammingQuestions4 Q4: My program hangs and never returns after dispatching a taskflow graph. What's wrong?
73+
74+
When the program hangs forever it is very likely your taskflow graph has a cycle.
75+
Try the tf::Taskflow::dump method to debug the graph before dispatching your taskflow graph.
76+
77+
78+
@subsection ProgrammingQuestions5 Q5: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?
79+
80+
@image html dynamic_graph.png width=60%
81+
82+
No. The subflow is spawned during the execution of B, and at this point A must finish
83+
because A precedes B. This gives rise to the fact B1 and B2 must run after A.
84+
This graph may looks strange because B seems to run twice!
85+
However, Cpp-Taskflow will schedule B only once to create its subflow.
86+
Whether this subflow joins or detaches from B only affects the future object returned from B.
87+
88+
89+
*/
90+
91+
}
92+
93+
94+
95+
96+

docs/FAQ.html

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<!-- HTML header for doxygen 1.8.13-->
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6+
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
7+
<meta name="generator" content="Doxygen 1.8.13"/>
8+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
9+
<title>Cpp-Taskflow</title>
10+
<link href="tabs.css" rel="stylesheet" type="text/css"/>
11+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
12+
<script type="text/javascript" src="jquery.js"></script>
13+
<script type="text/javascript" src="dynsections.js"></script>
14+
<link href="navtree.css" rel="stylesheet" type="text/css"/>
15+
<script type="text/javascript" src="resize.js"></script>
16+
<script type="text/javascript" src="navtreedata.js"></script>
17+
<script type="text/javascript" src="navtree.js"></script>
18+
<script type="text/javascript">
19+
$(document).ready(initResizable);
20+
</script>
21+
<link href="search/search.css" rel="stylesheet" type="text/css"/>
22+
<script type="text/javascript" src="search/searchdata.js"></script>
23+
<script type="text/javascript" src="search/search.js"></script>
24+
<script type="text/javascript">
25+
$(document).ready(function() { init_search(); });
26+
</script>
27+
<link href="doxygen.css" rel="stylesheet" type="text/css" />
28+
</head>
29+
<body>
30+
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
31+
<div id="titlearea">
32+
<table cellspacing="0" cellpadding="0">
33+
<tbody>
34+
<tr style="height: 56px;">
35+
<td id="projectalign" style="padding-left: 0.5em;">
36+
<div id="projectname"><a href="https://github.com/cpp-taskflow/cpp-taskflow">Cpp-Taskflow</a>
37+
&#160;<span id="projectnumber">2.0.0</span>
38+
</div>
39+
</td>
40+
<td> <div id="MSearchBox" class="MSearchBoxInactive">
41+
<span class="left">
42+
<img id="MSearchSelect" src="search/mag_sel.png"
43+
onmouseover="return searchBox.OnSearchSelectShow()"
44+
onmouseout="return searchBox.OnSearchSelectHide()"
45+
alt=""/>
46+
<input type="text" id="MSearchField" value="Search" accesskey="S"
47+
onfocus="searchBox.OnSearchFieldFocus(true)"
48+
onblur="searchBox.OnSearchFieldFocus(false)"
49+
onkeyup="searchBox.OnSearchFieldChange(event)"/>
50+
</span><span class="right">
51+
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
52+
</span>
53+
</div>
54+
</td>
55+
</tr>
56+
</tbody>
57+
</table>
58+
</div>
59+
<!-- end header part -->
60+
<!-- Generated by Doxygen 1.8.13 -->
61+
<script type="text/javascript">
62+
var searchBox = new SearchBox("searchBox", "search",false,'Search');
63+
</script>
64+
</div><!-- top -->
65+
<div id="side-nav" class="ui-resizable side-nav-resizable">
66+
<div id="nav-tree">
67+
<div id="nav-tree-contents">
68+
<div id="nav-sync" class="sync"></div>
69+
</div>
70+
</div>
71+
<div id="splitbar" style="-moz-user-select:none;"
72+
class="ui-resizable-handle">
73+
</div>
74+
</div>
75+
<script type="text/javascript">
76+
$(document).ready(function(){initNavTree('FAQ.html','');});
77+
</script>
78+
<div id="doc-content">
79+
<!-- window showing the filter options -->
80+
<div id="MSearchSelectWindow"
81+
onmouseover="return searchBox.OnSearchSelectShow()"
82+
onmouseout="return searchBox.OnSearchSelectHide()"
83+
onkeydown="return searchBox.OnSearchSelectKey(event)">
84+
</div>
85+
86+
<!-- iframe showing the search results (closed by default) -->
87+
<div id="MSearchResultsWindow">
88+
<iframe src="javascript:void(0)" frameborder="0"
89+
name="MSearchResults" id="MSearchResults">
90+
</iframe>
91+
</div>
92+
93+
<div class="header">
94+
<div class="headertitle">
95+
<div class="title">Frequently Asked Questions </div> </div>
96+
</div><!--header-->
97+
<div class="contents">
98+
<div class="textblock"><p>This page summarizes a list of frequently asked questions about Cpp-Taskflow. If you cannot find a solution here, please post an issue at <a href="https://github.com/cpp-taskflow/cpp-taskflow/issues">here</a>.</p>
99+
<h1><a class="anchor" id="GeneralQuestions"></a>
100+
General Questions</h1>
101+
<h2><a class="anchor" id="GeneralQuestion1"></a>
102+
Q1: What's the goal of Cpp-Taskflow?</h2>
103+
<p>Cpp-Taskflow aims to help C++ developers quickly implement efficient parallel decomposition strategies using task-based approaches.</p>
104+
<h2><a class="anchor" id="GeneralQuestion2"></a>
105+
Q2: How do I use Cpp-Taskflow in my projects?</h2>
106+
<p>Cpp-Taskflow is a header-only library with zero dependencies. The only thing you need is a <a href="https://en.wikipedia.org/wiki/C%2B%2B17">C++17</a> compiler. To use Cpp-Taskflow, simply drop the folder <code>taskflow/</code> to your project and include <a class="el" href="taskflow_8hpp_source.html">taskflow.hpp</a>.</p>
107+
<h2><a class="anchor" id="GeneralQuestion3"></a>
108+
Q3: What is the difference between static tasking and dynamic tasking?</h2>
109+
<p>Static tasking refers to those tasks created before execution, while dynamic tasking refers to those tasks created during the execution of static tasks or dynamic tasks (nested). Dynamic tasks created by the same task node are grouped together to a subflow.</p>
110+
<h2><a class="anchor" id="GeneralQuestion4"></a>
111+
Q4: How many tasks can Cpp-Taskflow handle?</h2>
112+
<p>Benchmarks showed Cpp-Taskflow can efficiently handle millions or billions of tasks (both large and small tasks) on a machine with up to 64 CPUs.</p>
113+
<h2><a class="anchor" id="GeneralQuestion5"></a>
114+
Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?</h2>
115+
<p>The hex value represents the memory address of the task. Each task has a method <a class="el" href="classtf_1_1Task.html#a9057ecd0f3833b717480e914f8568f02" title="assigns a name to the task ">tf::Task::name(const std::string&amp;)</a> for user to assign a human readable string to ease the debugging process. If a task is not assigned a name or is an internal node, its address value in the memory is used instead. </p><hr/>
116+
<h1><a class="anchor" id="ProgrammingQuestions"></a>
117+
Programming Questions</h1>
118+
<h2><a class="anchor" id="ProgrammingQuestions1"></a>
119+
Q1: What is the difference between Cpp-Taskflow threads and workers?</h2>
120+
<p>The master thread owns the thread pool and can spawn workers to run tasks or shutdown the pool. Giving taskflow <code>N</code> threads means using <code>N</code> threads to do the works, and there is a total of <code>N+1</code> threads (including the master threads) in the program.</p>
121+
<div class="fragment"><div class="line"><a class="code" href="classtf_1_1BasicTaskflow.html">tf::Taskflow</a>(N); <span class="comment">// N workers, N+1 threads in the program.</span></div></div><!-- fragment --><p>If there is no worker threads in the pool, the master thread will do all the works by itself. Please refer to <a class="el" href="chapter6.html#C6_MasterWorkersAndExecutor">Master, Workers, and Executor</a> for more details.</p>
122+
<h2><a class="anchor" id="ProgrammingQuestions2"></a>
123+
Q2: What is the Lifetime of a Task and a Graph?</h2>
124+
<p>The lifetime of a task sticks with its parent graph. A task is not destroyed until its parent graph is destroyed. Please refer to <a class="el" href="chapter2.html#LifeTimeOfAGraph">Lifetime of a Graph</a> for more details.</p>
125+
<h2><a class="anchor" id="ProgrammingQuestions3"></a>
126+
Q3: Is taskflow thread-safe?</h2>
127+
<p>No, the taskflow object is not thread-safe. You can't create tasks from multiple threads at the same time.</p>
128+
<h2><a class="anchor" id="ProgrammingQuestions4"></a>
129+
Q4: My program hangs and never returns after dispatching a taskflow graph. What's wrong?</h2>
130+
<p>When the program hangs forever it is very likely your taskflow graph has a cycle. Try the <a class="el" href="classtf_1_1BasicTaskflow.html#adac448e1cc44307856b3116d7ed5490f" title="dumps the present task dependency graph to a std::ostream in DOT format ">tf::Taskflow::dump</a> method to debug the graph before dispatching your taskflow graph.</p>
131+
<h2><a class="anchor" id="ProgrammingQuestions5"></a>
132+
Q5: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?</h2>
133+
<div class="image">
134+
<img src="dynamic_graph.png" alt="dynamic_graph.png" width="60%"/>
135+
</div>
136+
<p>No. The subflow is spawned during the execution of B, and at this point A must finish because A precedes B. This gives rise to the fact B1 and B2 must run after A. This graph may looks strange because B seems to run twice! However, Cpp-Taskflow will schedule B only once to create its subflow. Whether this subflow joins or detaches from B only affects the future object returned from B. </p>
137+
</div></div><!-- contents -->
138+
</div><!-- doc-content -->
139+
<!-- start footer part -->
140+
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
141+
<ul>
142+
<li class="footer">Generated by
143+
<a href="http://www.doxygen.org/index.html">
144+
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
145+
</ul>
146+
</div>
147+
</body>
148+
</html>

docs/dynamic_graph.png

75.8 KB
Loading

0 commit comments

Comments
 (0)