Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9cf59d3

Browse files
committed
updated pipeline docs
1 parent 9baf9c0 commit 9cf59d3

Some content is hidden

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

41 files changed

+703
-213
lines changed

docs/Cookbook.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<h1>
4949
Cookbook
5050
</h1>
51-
<p>This cookbook provides a step-by-step tutorial for writing Taskflow programs.</p><ul><li><a href="ProjectMotivation.html" class="m-doc">Project Motivation</a></li><li><a href="StaticTasking.html" class="m-doc">Static Tasking</a></li><li><a href="ExecuteTaskflow.html" class="m-doc">Executor</a></li><li><a href="DynamicTasking.html" class="m-doc">Dynamic Tasking</a></li><li><a href="ConditionalTasking.html" class="m-doc">Conditional Tasking</a></li><li><a href="ComposableTasking.html" class="m-doc">Composable Tasking</a></li><li><a href="AsyncTasking.html" class="m-doc">Asynchronous Tasking</a></li><li><a href="GPUTaskingcudaFlow.html" class="m-doc">GPU Tasking (cudaFlow)</a></li><li><a href="GPUTaskingcudaFlowCapturer.html" class="m-doc">GPU Tasking (cudaFlowCapturer)</a></li><li><a href="GPUTaskingsyclFlow.html" class="m-doc">GPU Tasking (syclFlow)</a></li><li><a href="LimitTheMaximumConcurrency.html" class="m-doc">Limit the Maximum Concurrency</a></li><li><a href="RequestCancellation.html" class="m-doc">Request Cancellation</a></li><li><a href="Profiler.html" class="m-doc">Profile Taskflow Programs</a></li></ul>
51+
<p>This cookbook provides a step-by-step tutorial for writing Taskflow programs.</p><ul><li><a href="ProjectMotivation.html" class="m-doc">Project Motivation</a></li><li><a href="StaticTasking.html" class="m-doc">Static Tasking</a></li><li><a href="ExecuteTaskflow.html" class="m-doc">Executor</a></li><li><a href="DynamicTasking.html" class="m-doc">Dynamic Tasking</a></li><li><a href="ConditionalTasking.html" class="m-doc">Conditional Tasking</a></li><li><a href="ComposableTasking.html" class="m-doc">Composable Tasking</a></li><li><a href="AsyncTasking.html" class="m-doc">Asynchronous Tasking</a></li><li><a href="RuntimeTasking.html" class="m-doc">Runtime Tasking</a></li><li><a href="GPUTaskingcudaFlow.html" class="m-doc">GPU Tasking (cudaFlow)</a></li><li><a href="GPUTaskingcudaFlowCapturer.html" class="m-doc">GPU Tasking (cudaFlowCapturer)</a></li><li><a href="GPUTaskingsyclFlow.html" class="m-doc">GPU Tasking (syclFlow)</a></li><li><a href="LimitTheMaximumConcurrency.html" class="m-doc">Limit the Maximum Concurrency</a></li><li><a href="RequestCancellation.html" class="m-doc">Request Cancellation</a></li><li><a href="Profiler.html" class="m-doc">Profile Taskflow Programs</a></li></ul>
5252
</div>
5353
</div>
5454
</div>

docs/ParallelPipeline.html

Lines changed: 88 additions & 8 deletions
Large diffs are not rendered by default.

docs/RuntimeTasking.html

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Cookbook &raquo; Runtime Tasking | Taskflow QuickStart</title>
6+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
7+
<link rel="stylesheet" href="m-dark+documentation.compiled.css" />
8+
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<meta name="theme-color" content="#22272e" />
11+
</head>
12+
<body>
13+
<header><nav id="navigation">
14+
<div class="m-container">
15+
<div class="m-row">
16+
<span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
17+
<a href="https://taskflow.github.io"><img src="taskflow_logo.png" alt="" />Taskflow</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">QuickStart</a>
18+
</span>
19+
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
20+
<a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
21+
<path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
22+
</svg></a>
23+
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
24+
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
25+
</div>
26+
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
27+
<div class="m-row">
28+
<ol class="m-col-t-6 m-col-m-none">
29+
<li><a href="pages.html">Handbook</a></li>
30+
<li><a href="namespaces.html">Namespaces</a></li>
31+
</ol>
32+
<ol class="m-col-t-6 m-col-m-none" start="3">
33+
<li><a href="annotated.html">Classes</a></li>
34+
<li><a href="files.html">Files</a></li>
35+
<li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
36+
<use href="#m-doc-search-icon-path" />
37+
</svg></a></li>
38+
</ol>
39+
</div>
40+
</div>
41+
</div>
42+
</div>
43+
</nav></header>
44+
<main><article>
45+
<div class="m-container m-container-inflatable">
46+
<div class="m-row">
47+
<div class="m-col-l-10 m-push-l-1">
48+
<h1>
49+
<span class="m-breadcrumb"><a href="Cookbook.html">Cookbook</a> &raquo;</span>
50+
Runtime Tasking
51+
</h1>
52+
<div class="m-block m-default">
53+
<h3>Contents</h3>
54+
<ul>
55+
<li><a href="#CreateARuntimeTask">Create a Runtime Task</a></li>
56+
<li><a href="#AcquireTheRunningExecutor">Acquire the Running Executor</a></li>
57+
</ul>
58+
</div>
59+
<p>Taskflow allows you to interact with the scheduling runtime from the execution context of a runtime task. <a href="classtf_1_1Runtime.html" class="m-doc">Runtime</a> tasking is mostly used for designing specialized parallel algorithms that go beyond the default scheduling rules of taskflows.</p><section id="CreateARuntimeTask"><h2><a href="#CreateARuntimeTask">Create a Runtime Task</a></h2><p>A runtime task is a callable that takes a reference to a <a href="classtf_1_1Runtime.html" class="m-doc">tf::<wbr />Runtime</a> object in its argument. A <a href="classtf_1_1Runtime.html" class="m-doc">tf::<wbr />Runtime</a> object is created by the running executor and contains several methods for users to interact with the scheduling runtime. For instance, the following code creates a runtime task to <em>forcefully</em> schedule a conditioned task that would never happens:</p><pre class="m-code"><span class="n">tf</span><span class="o">::</span><span class="n">Task</span> <span class="n">A</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">D</span><span class="p">;</span>
60+
<span class="n">std</span><span class="o">::</span><span class="n">tie</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">D</span><span class="p">)</span> <span class="o">=</span> <span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">(</span>
61+
<span class="p">[]</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">},</span>
62+
<span class="p">[</span><span class="o">&amp;</span><span class="n">C</span><span class="p">]</span> <span class="p">(</span><span class="n">tf</span><span class="o">::</span><span class="n">Runtime</span><span class="o">&amp;</span> <span class="n">rt</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// C must be captured by reference</span>
63+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;B</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span>
64+
<span class="n">rt</span><span class="p">.</span><span class="n">schedule</span><span class="p">(</span><span class="n">C</span><span class="p">);</span>
65+
<span class="p">},</span>
66+
<span class="p">[]</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;C</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">},</span>
67+
<span class="p">[]</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;D</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span>
68+
<span class="p">);</span>
69+
<span class="n">A</span><span class="p">.</span><span class="n">precede</span><span class="p">(</span><span class="n">B</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">D</span><span class="p">);</span>
70+
<span class="n">executor</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="n">taskflow</span><span class="p">).</span><span class="n">wait</span><span class="p">();</span></pre><div class="m-graph"><svg style="width: 12.875rem; height: 9.438rem;" viewBox="0.00 0.00 206.00 150.77">
71+
<g transform="scale(1 1) rotate(0) translate(4 146.7696)">
72+
<title>Taskflow</title>
73+
<g class="m-node m-flat">
74+
<title>p0x7bc400014030</title>
75+
<ellipse cx="27" cy="-18.3848" rx="27" ry="18.2703"/>
76+
<text text-anchor="middle" x="27" y="-14.5848">D</text>
77+
</g>
78+
<g class="m-node m-flat">
79+
<title>p0x7bc400014118</title>
80+
<ellipse cx="99" cy="-18.3848" rx="27" ry="18.2703"/>
81+
<text text-anchor="middle" x="99" y="-14.5848">C</text>
82+
</g>
83+
<g class="m-node m-flat">
84+
<title>p0x7bc400014200</title>
85+
<polygon points="198,-36.3848 144,-36.3848 144,-32.3848 140,-32.3848 140,-28.3848 144,-28.3848 144,-8.3848 140,-8.3848 140,-4.3848 144,-4.3848 144,-.3848 198,-.3848 198,-36.3848"/>
86+
<polyline points="144,-32.3848 148,-32.3848 148,-28.3848 144,-28.3848 "/>
87+
<polyline points="144,-8.3848 148,-8.3848 148,-4.3848 144,-4.3848 "/>
88+
<text text-anchor="middle" x="171" y="-14.5848">B</text>
89+
</g>
90+
<g class="m-node">
91+
<title>p0x7bc4000142e8</title>
92+
<polygon points="99,-142.7696 72,-116.7696 99,-90.7696 126,-116.7696 99,-142.7696"/>
93+
<text text-anchor="middle" x="99" y="-112.9696">A</text>
94+
</g>
95+
<g class="m-edge">
96+
<title>p0x7bc4000142e8&#45;&gt;p0x7bc400014030</title>
97+
<path stroke-dasharray="5,2" d="M87.75,-101.3969C76.3977,-85.8845 58.6812,-61.6757 45.3039,-43.3963"/>
98+
<polygon points="47.8626,-40.966 39.1324,-34.9632 42.2137,-45.1001 47.8626,-40.966"/>
99+
<text text-anchor="middle" x="71" y="-59.9696">2</text>
100+
</g>
101+
<g class="m-edge">
102+
<title>p0x7bc4000142e8&#45;&gt;p0x7bc400014118</title>
103+
<path stroke-dasharray="5,2" d="M99,-90.6625C99,-77.2765 99,-60.9411 99,-47.1886"/>
104+
<polygon points="102.5001,-46.8189 99,-36.8189 95.5001,-46.819 102.5001,-46.8189"/>
105+
<text text-anchor="middle" x="104" y="-59.9696">1</text>
106+
</g>
107+
<g class="m-edge">
108+
<title>p0x7bc4000142e8&#45;&gt;p0x7bc400014200</title>
109+
<path stroke-dasharray="5,2" d="M110.25,-101.3969C121.2624,-86.349 138.2637,-63.1175 151.4831,-45.0537"/>
110+
<polygon points="154.5448,-46.7965 157.6261,-36.6596 148.8959,-42.6625 154.5448,-46.7965"/>
111+
<text text-anchor="middle" x="148" y="-59.9696">0</text>
112+
</g>
113+
</g>
114+
</svg>
115+
</div><p>When the condition task <code>A</code> completes and returns <code>0</code>, the scheduler moves on to the runtime task <code>B</code>. Under the normal circumstance, tasks <code>C</code> and <code>D</code> will not run because their conditional dependencies never happen. This can be broken by forcefully scheduling <code>C</code> or/and <code>D</code> via a runtime task that resides in the same graph. Here, the runtime task <code>B</code> call <a href="classtf_1_1Runtime.html#a135ad751e8a4e7b1fd07a2cee65677b5" class="m-doc">tf::<wbr />Runtime::<wbr />schedule</a> to run task <code>C</code> even though the weak dependency between <code>A</code> and <code>C</code> will never happen based on the graph structure itself. As a result, we will see both <code>B</code> and <code>C</code> in the output:</p><pre class="m-console"><span class="go">B # B is a runtime task to schedule C out of its dependency constraint</span>
116+
<span class="go">C</span></pre><aside class="m-note m-warning"><h4>Attention</h4><p>You should only schedule an <em>active</em> task from a runtime task. An active task is a task in a running taskflow. The task may or may not be running, and scheduling that task will immediately put the task into the task queue of the worker that is running the runtime task.</p></aside></section><section id="AcquireTheRunningExecutor"><h2><a href="#AcquireTheRunningExecutor">Acquire the Running Executor</a></h2><p>You can acquire the reference to the running executor using <a href="classtf_1_1Runtime.html#a4ee48a82df1f9758a999d18e6015cec4" class="m-doc">tf::<wbr />Runtime::<wbr />executor</a>. The running executor of a runtime task is the executor that runs the parent taskflow of that runtime task.</p><pre class="m-code"><span class="n">tf</span><span class="o">::</span><span class="n">Executor</span> <span class="n">executor</span><span class="p">;</span>
117+
<span class="n">tf</span><span class="o">::</span><span class="n">Taskflow</span> <span class="n">taskflow</span><span class="p">;</span>
118+
<span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([</span><span class="o">&amp;</span><span class="p">](</span><span class="n">tf</span><span class="o">::</span><span class="n">Runtime</span><span class="o">&amp;</span> <span class="n">rt</span><span class="p">){</span>
119+
<span class="n">assert</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">rt</span><span class="p">.</span><span class="n">executor</span><span class="p">())</span> <span class="o">==</span> <span class="o">&amp;</span><span class="n">executor</span><span class="p">);</span>
120+
<span class="p">});</span>
121+
<span class="n">executor</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="n">taskflow</span><span class="p">).</span><span class="n">wait</span><span class="p">();</span></pre></section>
122+
</div>
123+
</div>
124+
</div>
125+
</article></main>
126+
<div class="m-doc-search" id="search">
127+
<a href="#!" onclick="return hideSearch()"></a>
128+
<div class="m-container">
129+
<div class="m-row">
130+
<div class="m-col-m-8 m-push-m-2">
131+
<div class="m-doc-search-header m-text m-small">
132+
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
133+
<div id="search-symbolcount">&hellip;</div>
134+
</div>
135+
<div class="m-doc-search-content">
136+
<form>
137+
<input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
138+
</form>
139+
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
140+
<div id="search-help" class="m-text m-dim m-text-center">
141+
<p class="m-noindent">Search for symbols, directories, files, pages or
142+
modules. You can omit any prefix from the symbol or file path; adding a
143+
<code>:</code> or <code>/</code> suffix lists all members of given symbol or
144+
directory.</p>
145+
<p class="m-noindent">Use <span class="m-label m-dim">&darr;</span>
146+
/ <span class="m-label m-dim">&uarr;</span> to navigate through the list,
147+
<span class="m-label m-dim">Enter</span> to go.
148+
<span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
149+
copy a link to the result using <span class="m-label m-dim"></span>
150+
<span class="m-label m-dim">L</span> while <span class="m-label m-dim"></span>
151+
<span class="m-label m-dim">M</span> produces a Markdown link.</p>
152+
</div>
153+
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
154+
<ul id="search-results"></ul>
155+
</div>
156+
</div>
157+
</div>
158+
</div>
159+
</div>
160+
<script src="search-v1.js"></script>
161+
<script src="searchdata-v1.js" async="async"></script>
162+
<footer><nav>
163+
<div class="m-container">
164+
<div class="m-row">
165+
<div class="m-col-l-10 m-push-l-1">
166+
<p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2021.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.8.14 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
167+
</div>
168+
</div>
169+
</div>
170+
</nav></footer>
171+
</body>
172+
</html>

docs/classtf_1_1FlowBuilder.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ <h3>
762762
<p>The following example creates a runtime task that enables in-task control over the running executor.</p><pre class="m-code"><span class="n">tf</span><span class="o">::</span><span class="n">Task</span> <span class="n">runtime_task</span> <span class="o">=</span> <span class="n">taskflow</span><span class="p">.</span><span class="n">emplace</span><span class="p">([](</span><span class="n">tf</span><span class="o">::</span><span class="n">Runtime</span><span class="o">&amp;</span> <span class="n">rt</span><span class="p">){</span>
763763
<span class="k">auto</span><span class="o">&amp;</span> <span class="n">executor</span> <span class="o">=</span> <span class="n">rt</span><span class="p">.</span><span class="n">executor</span><span class="p">();</span>
764764
<span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">executor</span><span class="p">.</span><span class="n">num_workers</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="sc">&#39;\n&#39;</span><span class="p">;</span>
765-
<span class="p">});</span></pre><p>Please refer to RuntimeTasking for details.</p>
765+
<span class="p">});</span></pre><p>Please refer to <a href="RuntimeTasking.html" class="m-doc">Runtime Tasking</a> for details.</p>
766766
</div></section>
767767
<section class="m-doc-details" id="a90f3d9b9d6fcf4df8e7d7878dfdd130d"><div>
768768
<h3>

0 commit comments

Comments
 (0)