Skip to content

Commit aff0ab8

Browse files
author
github-actions[doc-deploy-bot]
committed
Docs for pull request 1889
1 parent 3b35207 commit aff0ab8

File tree

7 files changed

+168
-34
lines changed

7 files changed

+168
-34
lines changed

pulls/1889/_modules/dpctl/_sycl_timer.html

Lines changed: 114 additions & 19 deletions
Large diffs are not rendered by default.

pulls/1889/api_reference/dpctl/generated/dpctl.SyclTimer.html

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,8 @@
820820
<h1>dpctl.SyclTimer<a class="headerlink" href="#dpctl-sycltimer" title="Permalink to this heading"></a></h1>
821821
<dl class="py class">
822822
<dt class="sig sig-object py" id="dpctl.SyclTimer">
823-
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">dpctl.</span></span><span class="sig-name descname"><span class="pre">SyclTimer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host_timer=&lt;built-in</span> <span class="pre">function</span> <span class="pre">perf_counter&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_scale=1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/dpctl/_sycl_timer.html#SyclTimer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dpctl.SyclTimer" title="Permalink to this definition"></a></dt>
824-
<dd><p>Context to measure device time and host wall-time of execution
825-
of commands submitted to <a class="reference internal" href="dpctl.SyclQueue.html#dpctl.SyclQueue" title="dpctl.SyclQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">dpctl.SyclQueue</span></code></a>.</p>
823+
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">dpctl.</span></span><span class="sig-name descname"><span class="pre">SyclTimer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host_timer=&lt;built-in</span> <span class="pre">function</span> <span class="pre">perf_counter&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_timer=None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_scale=1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/dpctl/_sycl_timer.html#SyclTimer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dpctl.SyclTimer" title="Permalink to this definition"></a></dt>
824+
<dd><p>Context to time execution of tasks submitted to <a class="reference internal" href="dpctl.SyclQueue.html#dpctl.SyclQueue" title="dpctl.SyclQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">dpctl.SyclQueue</span></code></a>.</p>
826825
<dl class="field-list">
827826
<dt class="field-odd">Example<span class="colon">:</span></dt>
828827
<dd class="field-odd"><div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">dpctl</span>
@@ -831,16 +830,21 @@ <h1>dpctl.SyclTimer<a class="headerlink" href="#dpctl-sycltimer" title="Permalin
831830
<span class="n">q</span> <span class="o">=</span> <span class="n">dpctl</span><span class="o">.</span><span class="n">SyclQueue</span><span class="p">(</span><span class="nb">property</span><span class="o">=</span><span class="s2">&quot;enable_profiling&quot;</span><span class="p">)</span>
832831

833832
<span class="c1"># create the timer</span>
834-
<span class="n">milliseconds_sc</span> <span class="o">=</span> <span class="mf">1e-3</span>
833+
<span class="n">milliseconds_sc</span> <span class="o">=</span> <span class="mf">1e3</span>
835834
<span class="n">timer</span> <span class="o">=</span> <span class="n">dpctl</span><span class="o">.</span><span class="n">SyclTimer</span><span class="p">(</span><span class="n">time_scale</span> <span class="o">=</span> <span class="n">milliseconds_sc</span><span class="p">)</span>
836835

836+
<span class="n">untimed_code_block_1</span>
837837
<span class="c1"># use the timer</span>
838838
<span class="k">with</span> <span class="n">timer</span><span class="p">(</span><span class="n">queue</span><span class="o">=</span><span class="n">q</span><span class="p">):</span>
839-
<span class="n">code_block1</span>
839+
<span class="n">timed_code_block1</span>
840+
841+
<span class="n">untimed_code_block_2</span>
840842

841843
<span class="c1"># use the timer</span>
842844
<span class="k">with</span> <span class="n">timer</span><span class="p">(</span><span class="n">queue</span><span class="o">=</span><span class="n">q</span><span class="p">):</span>
843-
<span class="n">code_block2</span>
845+
<span class="n">timed_code_block2</span>
846+
847+
<span class="n">untimed_code_block_3</span>
844848

845849
<span class="c1"># retrieve elapsed times in milliseconds</span>
846850
<span class="n">wall_dt</span><span class="p">,</span> <span class="n">device_dt</span> <span class="o">=</span> <span class="n">timer</span><span class="o">.</span><span class="n">dt</span>
@@ -850,21 +854,55 @@ <h1>dpctl.SyclTimer<a class="headerlink" href="#dpctl-sycltimer" title="Permalin
850854
</dl>
851855
<div class="admonition note">
852856
<p class="admonition-title">Note</p>
853-
<p>The timer submits barriers to the queue at the entrance and the
857+
<p>The timer submits tasks to the queue at the entrance and the
854858
exit of the context and uses profiling information from events
855859
associated with these submissions to perform the timing. Thus
856860
<a class="reference internal" href="#dpctl.SyclTimer" title="dpctl.SyclTimer"><code class="xref py py-class docutils literal notranslate"><span class="pre">dpctl.SyclTimer</span></code></a> requires the queue with <code class="docutils literal notranslate"><span class="pre">&quot;enable_profiling&quot;</span></code>
857861
property. In order to be able to collect the profiling information,
858-
the <code class="docutils literal notranslate"><span class="pre">dt</span></code> property ensures that both submitted barriers complete their
859-
execution and thus effectively synchronizes the queue.</p>
862+
the <code class="docutils literal notranslate"><span class="pre">dt</span></code> property ensures that both tasks submitted by the timer
863+
complete their execution and thus effectively synchronizes the queue.</p>
864+
<p>Execution of the above example results in the following task graph,
865+
where each group of tasks is ordered after the one preceding it,
866+
<code class="docutils literal notranslate"><span class="pre">[tasks_of_untimed_block1]</span></code>, <code class="docutils literal notranslate"><span class="pre">[timer_fence_start_task]</span></code>,
867+
<code class="docutils literal notranslate"><span class="pre">[tasks_of_timed_block1]</span></code>, <code class="docutils literal notranslate"><span class="pre">[timer_fence_finish_task]</span></code>,
868+
<code class="docutils literal notranslate"><span class="pre">[tasks_of_untimed_block2]</span></code>, <code class="docutils literal notranslate"><span class="pre">[timer_fence_start_task]</span></code>,
869+
<code class="docutils literal notranslate"><span class="pre">[tasks_of_timed_block2]</span></code>, <code class="docutils literal notranslate"><span class="pre">[timer_fence_finish_task]</span></code>,
870+
<code class="docutils literal notranslate"><span class="pre">[tasks_of_untimed_block3]</span></code>.</p>
871+
<p><code class="docutils literal notranslate"><span class="pre">device_timer</span></code> keyword argument controls the type of tasks submitted.
872+
With <code class="docutils literal notranslate"><span class="pre">&quot;queue_barrier&quot;</span></code> value, queue barrier tasks are used. With
873+
<code class="docutils literal notranslate"><span class="pre">&quot;order_manager&quot;</span></code> value, a single empty body task is inserted
874+
and order manager (used by all <cite>dpctl.tensor</cite> operations) is used to
875+
order these tasks so that they fence operations performed within
876+
timer’s context.</p>
877+
<p>Timing offloading operations that do not use the order manager with
878+
the timer that uses <code class="docutils literal notranslate"><span class="pre">&quot;order_manager&quot;</span></code> as <code class="docutils literal notranslate"><span class="pre">device_timer</span></code> value
879+
will be misleading becaused the tasks submitted by the timer will not
880+
be ordered with respect to tasks we intend to time.</p>
881+
<p>Note, that host timer effectively measures the time of task
882+
submissions. To measure host timer wall-time that includes execution
883+
of submitted tasks, make sure to include synchronization point in
884+
the timed block.</p>
885+
<dl class="field-list">
886+
<dt class="field-odd">Example<span class="colon">:</span></dt>
887+
<dd class="field-odd"><div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
888+
</pre></div>
889+
</div>
890+
<dl class="simple">
891+
<dt>with timer(q):</dt><dd><p>timed_block
892+
q.wait()</p>
893+
</dd>
894+
</dl>
895+
</dd>
896+
</dl>
860897
</div>
861898
<dl class="field-list simple">
862899
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
863900
<dd class="field-odd"><ul class="simple">
864901
<li><p><strong>host_timer</strong> (<em>callable</em><em>, </em><em>optional</em>) – A callable such that host_timer() returns current
865902
host time in seconds.
866903
Default: <a class="reference external" href="https://docs.python.org/3/library/timeit.html#timeit.default_timer" title="(in Python v3.13)"><code class="xref py py-func docutils literal notranslate"><span class="pre">timeit.default_timer()</span></code></a>.</p></li>
867-
<li><p><strong>time_scale</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a><em>]</em><em>, </em><em>optional</em>) – Ratio of the unit of time of interest and one second.
904+
<li><p><strong>device_timer</strong> (<em>Literal</em><em>[</em><em>&quot;queue_barrier&quot;</em><em>, </em><em>&quot;order_manager&quot;</em><em>]</em><em>, </em><em>optional</em>) – Device timing method. Default: “queue_barrier”.</p></li>
905+
<li><p><strong>time_scale</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a><em>]</em><em>, </em><em>optional</em>) – Ratio of one second and the unit of time-scale of interest.
868906
Default: <code class="docutils literal notranslate"><span class="pre">1</span></code>.</p></li>
869907
</ul>
870908
</dd>
@@ -873,7 +911,7 @@ <h1>dpctl.SyclTimer<a class="headerlink" href="#dpctl-sycltimer" title="Permalin
873911
<div class="table-wrapper autosummary longtable docutils container">
874912
<table class="autosummary longtable docutils align-default">
875913
<tbody>
876-
<tr class="row-odd"><td><p><a class="reference internal" href="generated/dpctl.SyclTimer.__init__.html#dpctl.SyclTimer.__init__" title="dpctl.SyclTimer.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>([host_timer, time_scale])</p></td>
914+
<tr class="row-odd"><td><p><a class="reference internal" href="generated/dpctl.SyclTimer.__init__.html#dpctl.SyclTimer.__init__" title="dpctl.SyclTimer.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>([host_timer, device_timer, time_scale])</p></td>
877915
<td><p>Create new instance of <a class="reference internal" href="#dpctl.SyclTimer" title="dpctl.SyclTimer"><code class="xref py py-class docutils literal notranslate"><span class="pre">SyclTimer</span></code></a>.</p></td>
878916
</tr>
879917
</tbody>

pulls/1889/api_reference/dpctl/generated/generated/dpctl.SyclTimer.__init__.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,14 +820,15 @@
820820
<h1>dpctl.SyclTimer.__init__<a class="headerlink" href="#dpctl-sycltimer-init" title="Permalink to this heading"></a></h1>
821821
<dl class="py method">
822822
<dt class="sig sig-object py" id="dpctl.SyclTimer.__init__">
823-
<span class="sig-prename descclassname"><span class="pre">SyclTimer.</span></span><span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host_timer=&lt;built-in</span> <span class="pre">function</span> <span class="pre">perf_counter&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_scale=1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../_modules/dpctl/_sycl_timer.html#SyclTimer.__init__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dpctl.SyclTimer.__init__" title="Permalink to this definition"></a></dt>
823+
<span class="sig-prename descclassname"><span class="pre">SyclTimer.</span></span><span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host_timer=&lt;built-in</span> <span class="pre">function</span> <span class="pre">perf_counter&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_timer=None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_scale=1</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../_modules/dpctl/_sycl_timer.html#SyclTimer.__init__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#dpctl.SyclTimer.__init__" title="Permalink to this definition"></a></dt>
824824
<dd><p>Create new instance of <a class="reference internal" href="../dpctl.SyclTimer.html#dpctl.SyclTimer" title="dpctl.SyclTimer"><code class="xref py py-class docutils literal notranslate"><span class="pre">SyclTimer</span></code></a>.</p>
825825
<dl class="field-list simple">
826826
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
827827
<dd class="field-odd"><ul class="simple">
828828
<li><p><strong>host_timer</strong> (<em>callable</em><em>, </em><em>optional</em>) – A function that takes no arguments and returns a value
829829
measuring time.
830830
Default: <code class="xref py py-meth docutils literal notranslate"><span class="pre">timeit.default_timer()</span></code>.</p></li>
831+
<li><p><strong>device_timer</strong> (<em>Literal</em><em>[</em><em>&quot;queue_barrier&quot;</em><em>, </em><em>&quot;order_manager&quot;</em><em>]</em><em>, </em><em>optional</em>) – Device timing method. Default: “queue_barrier”</p></li>
831832
<li><p><strong>time_scale</strong> (<em>Union</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a><em>]</em><em>, </em><em>optional</em>) – Scaling factor applied to durations measured by
832833
the host_timer. Default: <code class="docutils literal notranslate"><span class="pre">1</span></code>.</p></li>
833834
</ul>

pulls/1889/api_reference/dpctl/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@
861861
<td><p>Python class representing <code class="docutils literal notranslate"><span class="pre">sycl::platform</span></code> class.</p></td>
862862
</tr>
863863
<tr class="row-even"><td><p><a class="reference internal" href="generated/dpctl.SyclTimer.html#dpctl.SyclTimer" title="dpctl.SyclTimer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SyclTimer</span></code></a></p></td>
864-
<td><p>Context to measure device time and host wall-time of execution of commands submitted to <a class="reference internal" href="generated/dpctl.SyclQueue.html#dpctl.SyclQueue" title="dpctl.SyclQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">dpctl.SyclQueue</span></code></a>.</p></td>
864+
<td><p>Context to time execution of tasks submitted to <a class="reference internal" href="generated/dpctl.SyclQueue.html#dpctl.SyclQueue" title="dpctl.SyclQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">dpctl.SyclQueue</span></code></a>.</p></td>
865865
</tr>
866866
</tbody>
867867
</table>

pulls/1889/beginners_guides/installation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ <h2>Installation using pip<a class="headerlink" href="#installation-using-pip" t
881881
<section id="installation-via-intel-r-distribution-for-python">
882882
<h2>Installation via Intel(R) Distribution for Python<a class="headerlink" href="#installation-via-intel-r-distribution-for-python" title="Permalink to this heading"></a></h2>
883883
<p><a class="reference external" href="https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html">Intel(R) Distribution for Python*</a> is distributed as a conda-based installer
884-
and includes <a class="reference internal" href="../api_reference/dpctl/index.html#module-dpctl" title="dpctl"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpctl</span></code></a> along with its dependencies and sister projects <a class="reference external" href="https://intelpython.github.io/dpnp/overview.html#module-dpnp" title="(in Data Parallel Extension for NumPy v0.17.0dev1+16.gba5fb31b270)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpnp</span></code></a>
884+
and includes <a class="reference internal" href="../api_reference/dpctl/index.html#module-dpctl" title="dpctl"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpctl</span></code></a> along with its dependencies and sister projects <a class="reference external" href="https://intelpython.github.io/dpnp/overview.html#module-dpnp" title="(in Data Parallel Extension for NumPy v0.17.0dev2+1.g264c6d8a772)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dpnp</span></code></a>
885885
and <a class="reference external" href="https://intelpython.github.io/numba-dpex/latest/index.html#module-numba_dpex" title="(in numba-dpex)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numba_dpex</span></code></a>.</p>
886886
<p>Once the installed environment is activated, <code class="docutils literal notranslate"><span class="pre">dpctl</span></code> should be ready to use.</p>
887887
</section>

pulls/1889/objects.inv

0 Bytes
Binary file not shown.

pulls/1889/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)