Skip to content

Commit 4892558

Browse files
updated docs
1 parent 4009570 commit 4892558

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+269
-202
lines changed

docs/Cookbook.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<a class="el" href="chapter4.html">C4: Create a Parallel Reduction Graph</a> <br />
104104
<a class="el" href="chapter5.html">C5: Spawn Task Dependency Graphs at Runtime</a> <br />
105105
<a class="el" href="chapter6.html">C6: Manage Threads and Executor</a> <br />
106-
<a class="el" href="chapter7.html">C7: Framework (Dev Branch)</a> <br />
106+
<a class="el" href="chapter7.html">C7: Framework (Experimental)</a> <br />
107107
</p>
108108
</div></div><!-- contents -->
109109
</div><!-- doc-content -->

docs/Cookbook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var Cookbook =
5151
[ "Thread Safety", "chapter6.html#C6ThreadSafety", null ],
5252
[ "Example 1: Impact of Over-subscription", "chapter6.html#C6Example1", null ]
5353
] ],
54-
[ "C7: Framework (Dev Branch)", "chapter7.html", [
54+
[ "C7: Framework (Experimental)", "chapter7.html", [
5555
[ "Create a Framework", "chapter7.html#C7_CreateAFramework", null ],
5656
[ "Execute a Framework", "chapter7.html#C7_ExecuteAFramework", null ],
5757
[ "Lifetime of a Framework", "chapter7.html#C7_LifeTimeOfAFramework", null ],

docs/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ EXAMPLE_RECURSIVE = NO
921921
# that contain images that are to be included in the documentation (see the
922922
# \image command).
923923

924-
IMAGE_PATH = ../ favicon/
924+
IMAGE_PATH = favicon/
925925

926926
# The INPUT_FILTER tag can be used to specify a program that doxygen should
927927
# invoke to filter for each input file. Doxygen will invoke the filter program

docs/basic__taskflow_8hpp_source.html

Lines changed: 20 additions & 21 deletions
Large diffs are not rendered by default.

docs/chapter0.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h1><a class="anchor" id="html"></a>
114114
TaskBasedParallelism Task-based Parallelism</h1>
115115
<p>The traditional loop-level parallelism is simple but hardly allows users to exploit parallelism in more irregular applications such as graph algorithms, incremental flows, recursion, and dynamically-allocated data structures. To address these challenges, parallel programming and libraries are evolving from the tradition loop-based parallelism to the <em>task-based</em> model.</p>
116116
<div class="image">
117-
<img src="task-level-parallelism.png" alt="task-level-parallelism.png" width="30%"/>
117+
<img src="images/task-level-parallelism.png" alt="task-level-parallelism.png" width="30%"/>
118118
</div>
119119
<p>The above figure shows an example <em>task dependency graph</em>. Each node in the graph represents a task unit at function level and each edge indicates the task dependency between a pair of tasks. Task-based model offers a powerful means to express both regular and irregular parallelism in a top-down manner, and provides transparent scaling to large number of cores. In fact, it has been proven, both by the research community and the evolution of parallel programming standards, task-based approach scales the best with future processor generations and architectures.</p>
120120
<h1><a class="anchor" id="ChallengesOfTaskBasedParallelProgramming"></a>

docs/chapter7.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@
9292

9393
<div class="header">
9494
<div class="headertitle">
95-
<div class="title">C7: Framework (Dev Branch) </div> </div>
95+
<div class="title">C7: Framework (Experimental) </div> </div>
9696
</div><!--header-->
9797
<div class="contents">
9898
<div class="textblock"><p>In many situations, you will need to execute a task dependency multiple times to create a <em>reusable</em> and <em>stateful</em> execution. The <em>framework</em> - <a class="el" href="classtf_1_1Framework.html" title="A reusable task dependency graph. ">tf::Framework</a> is designed for this purpose. This chapter introduces the concept of a framework and shows its usage.</p>
9999
<h1><a class="anchor" id="C7_CreateAFramework"></a>
100100
Create a Framework</h1>
101-
<p>The <a class="el" href="classtf_1_1Framework.html" title="A reusable task dependency graph. ">tf::Framework</a> inherits <a class="el" href="classtf_1_1FlowBuilder.html" title="The building blocks of task dependency graphs. ">tf::FlowBuilder</a> and contains a task dependency graph that is independent of that in a taskflow object. The big difference is that executing a framework will not make the graph disappear. To construct a task dependency graph in a framework, you will use the same API <a class="el" href="classtf_1_1FlowBuilder.html#acab0b4ac82260f47fdb36a3244ee3aaf" title="creates an empty task ">tf::Taskflow::placeholder</a>, <a class="el" href="classtf_1_1FlowBuilder.html#a7285613836c840e22b8511d447734c87" title="creates a task from a given callable object without access to the result ">tf::Taskflow::silent_emplace</a>, and <a class="el" href="classtf_1_1FlowBuilder.html#a468ddceae9c77728fbaef0f70d9fd11c" title="creates a task from a given callable object ">tf::Taskflow::emplace</a>. The code below shows how to create a framework with three tasks.</p>
102-
<div class="fragment"><div class="line"><span class="comment">// createe a framework </span></div><div class="line"><a class="code" href="classtf_1_1Framework.html">tf::Framework</a> taskflow;</div><div class="line"></div><div class="line"><span class="comment">// Add three tasks into the framework</span></div><div class="line"><span class="keyword">auto</span> A = taskflow.<a class="code" href="classtf_1_1FlowBuilder.html#a7285613836c840e22b8511d447734c87">silent_emplace</a>([](){ <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskA\n&quot;</span>; });</div><div class="line"><span class="keyword">auto</span> B = taskflow.<a class="code" href="classtf_1_1FlowBuilder.html#acab0b4ac82260f47fdb36a3244ee3aaf">placeholder</a>();</div><div class="line"><span class="keyword">auto</span> [C, FuC] = taskflow.<a class="code" href="classtf_1_1FlowBuilder.html#a468ddceae9c77728fbaef0f70d9fd11c">emplace</a>([] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskC\n&quot;</span>; });</div><div class="line"></div><div class="line"><span class="comment">// build precedence links from A to B and C</span></div><div class="line">A.precede(B, C);</div></div><!-- fragment --><h1><a class="anchor" id="C7_ExecuteAFramework"></a>
101+
<p>The <a class="el" href="classtf_1_1Framework.html" title="A reusable task dependency graph. ">tf::Framework</a> inherits <a class="el" href="classtf_1_1FlowBuilder.html" title="The building blocks of task dependency graphs. ">tf::FlowBuilder</a> and contains a task dependency graph that is independent of a taskflow object. The big difference is executing a framework will not make the graph disappear. You can use framework to enalbe reusable control flows. The following example demonstrates how to create a framework.</p>
102+
<div class="fragment"><div class="line"><span class="comment">// createe a framework </span></div><div class="line"><a class="code" href="classtf_1_1Framework.html">tf::Framework</a> framework;</div><div class="line"></div><div class="line"><span class="comment">// create three tasks in the framework</span></div><div class="line"><span class="keyword">auto</span> A = framework.<a class="code" href="classtf_1_1FlowBuilder.html#a7285613836c840e22b8511d447734c87">silent_emplace</a>([](){ <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskA\n&quot;</span>; });</div><div class="line"><span class="keyword">auto</span> B = framework.<a class="code" href="classtf_1_1FlowBuilder.html#acab0b4ac82260f47fdb36a3244ee3aaf">placeholder</a>();</div><div class="line"><span class="keyword">auto</span> [C, FuC] = framework.<a class="code" href="classtf_1_1FlowBuilder.html#a468ddceae9c77728fbaef0f70d9fd11c">emplace</a>([] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskC\n&quot;</span>; });</div><div class="line"></div><div class="line"><span class="comment">// add a dependency link from A to B</span></div><div class="line">A.precede(B); </div><div class="line"></div><div class="line"><span class="comment">// build precedence links from A to B and C</span></div><div class="line">A.precede(B, C);</div></div><!-- fragment --><h1><a class="anchor" id="C7_ExecuteAFramework"></a>
103103
Execute a Framework</h1>
104104
<p>To execute a framework, you use one of following methods: <a class="el" href="classtf_1_1BasicTaskflow.html#afc7f9ac974ee803b2d3b5577a6c8a2bc" title="runs the framework once ">tf::Taskflow::run</a>, tf::Taskflow::silent_run, <a class="el" href="classtf_1_1BasicTaskflow.html#abe9f7964777c2d65052b2dda7307efb6" title="runs the framework for N times ">tf::Taskflow::run_n</a> or tf::Taskflow::silent_run_n. The methods <a class="el" href="classtf_1_1BasicTaskflow.html#afc7f9ac974ee803b2d3b5577a6c8a2bc" title="runs the framework once ">tf::Taskflow::run</a> and tf::Taskflow::silent_run execute the framework only once. The methods <a class="el" href="classtf_1_1BasicTaskflow.html#abe9f7964777c2d65052b2dda7307efb6" title="runs the framework for N times ">tf::Taskflow::run_n</a> and tf::Taskflow::silent_run_n execute the framework for <code>N</code> times. The prefix <code>silent_</code> indicates a void return while others will return a <a class="elRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/thread/shared_future.html">std::shared_future</a> object for users to access the execution status. All methods accept an optional callback to invoke after the execution completes. The code below shows how to run a framework.</p>
105105
<div class="fragment"><div class="line"> 1: <span class="comment">// Declare a framework </span></div><div class="line"> 2: <a class="code" href="classtf_1_1Framework.html">tf::Framework</a> f;</div><div class="line"> 3: </div><div class="line"> 4: <span class="comment">// Add three tasks into the framework</span></div><div class="line"> 5: <span class="keyword">auto</span> [A, B, C] = f.<a class="code" href="classtf_1_1FlowBuilder.html#a7285613836c840e22b8511d447734c87">silent_emplace</a>(</div><div class="line"> 6: [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskA\n&quot;</span>; },</div><div class="line"> 7: [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskB\n&quot;</span>; },</div><div class="line"> 8: [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;This is TaskC\n&quot;</span>; },</div><div class="line"> 9: );</div><div class="line">10: </div><div class="line">11: <span class="comment">// Build precedence between tasks</span></div><div class="line">12: A.precede(B, C); </div><div class="line">13: </div><div class="line">14: <span class="comment">// Declare a taskflow object</span></div><div class="line">15: <a class="code" href="classtf_1_1BasicTaskflow.html">tf::Taskflow</a> taskflow;</div><div class="line">16: </div><div class="line">17: <span class="keyword">auto</span> fu = taskflow.<a class="code" href="classtf_1_1BasicTaskflow.html#afc7f9ac974ee803b2d3b5577a6c8a2bc">run</a>(f);</div><div class="line">18: fu.get();</div><div class="line">19: taskflow.<a class="code" href="classtf_1_1BasicTaskflow.html#afc7f9ac974ee803b2d3b5577a6c8a2bc">run</a>(f, [](){ <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;end of one execution\n&quot;</span>; }).<span class="keyword">get</span>();</div><div class="line">20: </div><div class="line">21: taskflow.silent_run_n(f, 4);</div><div class="line">22: taskflow.<a class="code" href="classtf_1_1BasicTaskflow.html#a37ef86998f23ee7315be032c40fe815e">wait_for_all</a>();</div><div class="line">23: </div><div class="line">24: taskflow.<a class="code" href="classtf_1_1BasicTaskflow.html#abe9f7964777c2d65052b2dda7307efb6">run_n</a>(f, 4, [](){ <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;end of four executions\n&quot;</span>; }).<span class="keyword">get</span>();</div><div class="line">25:</div></div><!-- fragment --><p>Debrief:</p>

0 commit comments

Comments
 (0)