You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/PrioritizedTasking.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ <h3>Contents</h3>
55
55
<li><ahref="#AssignAPriorityToATask">Assign a Priority to a Task</a></li>
56
56
</ul>
57
57
</nav>
58
-
<p>This chapter demonstrates how to assigns a task a priority to hint the scheduler about one task of a higher priority should start earlier than another task of a lower priority. Task priorities are useful in many cases. For instance, we may prioritize some tasks over others to improve responsiveness or data locality of parallel tasks.</p><sectionid="AssignAPriorityToATask"><h2><ahref="#AssignAPriorityToATask">Assign a Priority to a Task</a></h2><p>Taskflow supports three different priority levels, <code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fab89de3b4b81c4facfac906edf29aec8c" class="m-doc">TaskPriority::<wbr/>HIGH</a></code>, <code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa1e23852820b9154316c7c06e2b7ba051" class="m-doc">TaskPriority::<wbr/>NORMAL</a></code>, and <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa41bc94cbd8eebea13ce0491b2ac11b88" class="m-doc">tf::<wbr/>TaskPriority::<wbr/>LOW</a>, as defined in <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346f" class="m-doc">tf::<wbr/>TaskPriority</a>. When there are parallel tasks (i.e., no dependencies), Taskflow will <code>try</code> to execute tasks of higher priorities before tasks of lower priorities. By default, all tasks have the highest priorities (<code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fab89de3b4b81c4facfac906edf29aec8c" class="m-doc">TaskPriority::<wbr/>HIGH</a></code>) unless otherwise assigned.</p><preclass="m-code"><spanclass="n">tf</span><spanclass="o">::</span><spanclass="n">Executor</span><spanclass="w"></span><spanclass="nf">executor</span><spanclass="p">(</span><spanclass="mi">1</span><spanclass="p">);</span><spanclass="w"></span>
58
+
<p>This chapter demonstrates how to assigns a task a priority to <em>hint</em> the scheduler about one task of a higher priority should start earlier than another task of a lower priority. Task priorities are useful in many cases. For instance, we may prioritize some tasks over others to improve responsiveness or data locality of parallel tasks.</p><sectionid="AssignAPriorityToATask"><h2><ahref="#AssignAPriorityToATask">Assign a Priority to a Task</a></h2><p>Taskflow supports three different priority levels, <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fab89de3b4b81c4facfac906edf29aec8c" class="m-doc">tf::<wbr/>TaskPriority::<wbr/>HIGH</a>, <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa1e23852820b9154316c7c06e2b7ba051" class="m-doc">tf::<wbr/>TaskPriority::<wbr/>NORMAL</a>, and <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa41bc94cbd8eebea13ce0491b2ac11b88" class="m-doc">tf::<wbr/>TaskPriority::<wbr/>LOW</a>, as defined in <ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346f" class="m-doc">tf::<wbr/>TaskPriority</a>. When there are parallel tasks (i.e., no dependencies), Taskflow will <code>try</code> to execute tasks of higher priorities before tasks of lower priorities. By default, all tasks have the highest priorities (<code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fab89de3b4b81c4facfac906edf29aec8c" class="m-doc">TaskPriority::<wbr/>HIGH</a></code>) unless otherwise assigned.</p><preclass="m-code"><spanclass="n">tf</span><spanclass="o">::</span><spanclass="n">Executor</span><spanclass="w"></span><spanclass="nf">executor</span><spanclass="p">(</span><spanclass="mi">1</span><spanclass="p">);</span><spanclass="w"></span>
Copy file name to clipboardExpand all lines: docs/classtf_1_1TaskQueue.html
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -77,27 +77,30 @@ <h3>Contents</h3>
77
77
</li>
78
78
</ul>
79
79
</nav>
80
-
<p>This class implements the work-stealing queue described in the paper, <ahref="https://www.di.ens.fr/~zappa/readings/ppopp13.pdf">Correct and Efficient Work-Stealing for Weak Memory Models</a>, and extends it to include priority.</p><p>Only the queue owner can perform pop and push operations, while others can steal data from the queue simultaneously. Priority starts from zero (highest priority) to the template value <code>MAX_PRIORITY-1</code> (lowest priority). All operations are associated with priority values to indicate the corresponding queues to which an operation is applied.</p><p>The default template value, <code>MAX_PRIORITY</code>, is 3 or <code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa26a4b44a837bf97b972628509912b4a5" class="m-doc">TaskPriority::<wbr/>MAX</a></code>.</p><preclass="m-code"><spanclass="n">tf</span><spanclass="o">::</span><spanclass="n">Executor</span><spanclass="w"></span><spanclass="nf">executor</span><spanclass="p">(</span><spanclass="mi">1</span><spanclass="p">);</span><spanclass="w"></span>
<p>This class implements the work-stealing queue described in the paper, <ahref="https://www.di.ens.fr/~zappa/readings/ppopp13.pdf">Correct and Efficient Work-Stealing for Weak Memory Models</a>, and extends it to include priority.</p><p>Only the queue owner can perform pop and push operations, while others can steal data from the queue simultaneously. Priority starts from zero (highest priority) to the template value <code>MAX_PRIORITY-1</code> (lowest priority). All operations are associated with priority values to indicate the corresponding queues to which an operation is applied.</p><p>The default template value, <code>MAX_PRIORITY</code>, is <code><ahref="namespacetf.html#ac9f4add8f716ed323b0bdbbc1d89346fa26a4b44a837bf97b972628509912b4a5" class="m-doc">TaskPriority::<wbr/>MAX</a></code> which applies only three priority levels to the task queue.</p><preclass="m-code"><spanclass="k">auto</span><spanclass="w"></span><spanclass="p">[</span><spanclass="n">A</span><spanclass="p">,</span><spanclass="w"></span><spanclass="n">B</span><spanclass="p">,</span><spanclass="w"></span><spanclass="n">C</span><spanclass="p">,</span><spanclass="w"></span><spanclass="n">D</span><spanclass="p">,</span><spanclass="w"></span><spanclass="n">E</span><spanclass="p">]</span><spanclass="w"></span><spanclass="o">=</span><spanclass="w"></span><spanclass="n">taskflow</span><spanclass="p">.</span><spanclass="n">emplace</span><spanclass="p">(</span><spanclass="w"></span>
<spanclass="n">executor</span><spanclass="p">.</span><spanclass="n">run</span><spanclass="p">(</span><spanclass="n">taskflow</span><spanclass="p">).</span><spanclass="n">wait</span><spanclass="p">();</span><spanclass="w"></span></pre><p>In the above example, we have a task graph of five tasks, <code>A</code>, <code>B</code>, <code>C</code>, <code>D</code>, and <code>E</code>, in which <code>B</code>, <code>C</code>, and <code>D</code> can run in simultaneously when <code>A</code> finishes. Since we only uses one worker thread in the executor, we can deterministically run <code>B</code> first, then <code>D</code>, and <code>C</code> in order of their priority values.</p>
100
+
<spanclass="w"></span>
101
+
<spanclass="n">executor</span><spanclass="p">.</span><spanclass="n">run</span><spanclass="p">(</span><spanclass="n">taskflow</span><spanclass="p">).</span><spanclass="n">wait</span><spanclass="p">();</span><spanclass="w"></span></pre><p>In the above example, we have a task graph of five tasks, <code>A</code>, <code>B</code>, <code>C</code>, <code>D</code>, and <code>E</code>, in which <code>B</code>, <code>C</code>, and <code>D</code> can run in simultaneously when <code>A</code> finishes. Since we only uses one worker thread in the executor, we can deterministically run <code>B</code> first, then <code>D</code>, and <code>C</code> in order of their priority values. The output is as follows:</p><preclass="m-console"><spanclass="go">Task B: 0</span>
Copy file name to clipboardExpand all lines: docs/namespacetf.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -737,7 +737,7 @@ <h3>
737
737
enum class tf::<wbr/><ahref="#ac9f4add8f716ed323b0bdbbc1d89346f" class="m-doc-self">TaskPriority</a>: unsigned
738
738
</h3>
739
739
<p>enumeration of all task priority values</p>
740
-
<p>Currently, Taskflow defines three priority levels, <code>HIGH</code>, <code>NORMAL</code>, and <code>LOW</code>, starting from 0, 1, to 2. That is, the lower the value, the higher the priority.</p>
740
+
<p>A priority is an enumerated value of type <code>unsigned</code>. Currently, Taskflow defines three priority levels, <code>HIGH</code>, <code>NORMAL</code>, and <code>LOW</code>, starting from 0, 1, to 2. That is, the lower the value, the higher the priority.</p>
0 commit comments