Skip to content

Commit 6745458

Browse files
author
Rita Iglesias
committed
merge
1 parent a806a97 commit 6745458

File tree

4 files changed

+208
-67
lines changed

4 files changed

+208
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
torch.cuda.stream
2-
=================
3-
1+
.. role:: hidden
2+
:class: hidden-section
43
.. currentmodule:: torch.cuda
54

6-
.. autofunction:: stream
5+
6+
Stream
7+
======
8+
9+
.. autoclass:: Stream
10+
:inherited-members:
11+
:members:
12+
13+
.. autogenerated from source/_templates/autosummary/class.rst
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
torch.nn.utils.prune.identity
2-
=============================
3-
1+
.. role:: hidden
2+
:class: hidden-section
43
.. currentmodule:: torch.nn.utils.prune
54

6-
.. autofunction:: identity
5+
6+
Identity
7+
========
8+
9+
.. autoclass:: Identity
10+
:inherited-members:
11+
:members:
12+
13+
.. autogenerated from source/_templates/autosummary/class.rst

docs/master/generated/torch.cuda.stream.html

+105-21
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212

13-
<title>torch.cuda.stream &mdash; PyTorch master documentation</title>
13+
<title>Stream &mdash; PyTorch master documentation</title>
1414

1515

1616

1717

1818

1919

20-
<link rel="canonical" href="https://pytorch.org/docs/stable/generated/torch.cuda.stream.html"/>
20+
<link rel="canonical" href="https://pytorch.org/docs/stable/generated/torch.cuda.Stream.html"/>
2121

2222

2323

@@ -41,8 +41,8 @@
4141
<link rel="stylesheet" href="../_static/css/jit.css" type="text/css" />
4242
<link rel="index" title="Index" href="../genindex.html" />
4343
<link rel="search" title="Search" href="../search.html" />
44-
<link rel="next" title="torch.cuda.synchronize" href="torch.cuda.synchronize.html" />
45-
<link rel="prev" title="torch.cuda.set_sync_debug_mode" href="torch.cuda.set_sync_debug_mode.html" />
44+
<link rel="next" title="ExternalStream" href="torch.cuda.ExternalStream.html" />
45+
<link rel="prev" title="torch.cuda.comm.gather" href="torch.cuda.comm.gather.html" />
4646

4747
<!--
4848
Search engines should not index the master version of documentation.
@@ -242,7 +242,7 @@
242242

243243

244244
<div>
245-
<a style="color:#F05732" href="https://pytorch.org/docs/stable/generated/torch.cuda.stream.html">
245+
<a style="color:#F05732" href="https://pytorch.org/docs/stable/generated/torch.cuda.Stream.html">
246246
You are viewing unstable developer preview docs.
247247
Click here to view docs for latest stable release.
248248
</a>
@@ -397,13 +397,13 @@
397397

398398
<li><a href="../cuda.html">torch.cuda</a> &gt;</li>
399399

400-
<li>torch.cuda.stream</li>
400+
<li>Stream</li>
401401

402402

403403
<li class="pytorch-breadcrumbs-aside">
404404

405405

406-
<a href="../_sources/generated/torch.cuda.stream.rst.txt" rel="nofollow"><img src="../_static/images/view-page-source-icon.svg"></a>
406+
<a href="../_sources/generated/torch.cuda.Stream.rst.txt" rel="nofollow"><img src="../_static/images/view-page-source-icon.svg"></a>
407407

408408

409409
</li>
@@ -429,21 +429,105 @@
429429
<div role="main" class="main-content" itemscope="itemscope" itemtype="http://schema.org/Article">
430430
<article itemprop="articleBody" id="pytorch-article" class="pytorch-article">
431431

432-
<section id="torch-cuda-stream">
433-
<h1>torch.cuda.stream<a class="headerlink" href="#torch-cuda-stream" title="Permalink to this heading"></a></h1>
434-
<dl class="py function">
435-
<dt class="sig sig-object py" id="torch.cuda.stream">
436-
<span class="sig-prename descclassname"><span class="pre">torch.cuda.</span></span><span class="sig-name descname"><span class="pre">stream</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda.html#stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.stream" title="Permalink to this definition"></a></dt>
437-
<dd><p>Wrapper around the Context-manager StreamContext that
438-
selects a given stream.</p>
432+
<section id="stream">
433+
<h1>Stream<a class="headerlink" href="#stream" title="Permalink to this heading"></a></h1>
434+
<dl class="py class">
435+
<dt class="sig sig-object py" id="torch.cuda.Stream">
436+
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">torch.cuda.</span></span><span class="sig-name descname"><span class="pre">Stream</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream" title="Permalink to this definition"></a></dt>
437+
<dd><p>Wrapper around a CUDA stream.</p>
438+
<p>A CUDA stream is a linear sequence of execution that belongs to a specific
439+
device, independent from other streams. See <a class="reference internal" href="../notes/cuda.html#cuda-semantics"><span class="std std-ref">CUDA semantics</span></a> for
440+
details.</p>
439441
<dl class="field-list simple">
440442
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
441-
<dd class="field-odd"><p><strong>stream</strong> (<a class="reference internal" href="torch.cuda.Stream.html#torch.cuda.Stream" title="torch.cuda.Stream"><em>Stream</em></a>) – selected stream. This manager is a no-op if it’s
442-
<code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
443+
<dd class="field-odd"><ul class="simple">
444+
<li><p><strong>device</strong> (<a class="reference internal" href="../tensor_attributes.html#torch.device" title="torch.device"><em>torch.device</em></a><em> or </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – a device on which to allocate
445+
the stream. If <a class="reference internal" href="torch.cuda.device.html#torch.cuda.device" title="torch.cuda.device"><code class="xref py py-attr docutils literal notranslate"><span class="pre">device</span></code></a> is <code class="docutils literal notranslate"><span class="pre">None</span></code> (default) or a negative
446+
integer, this will use the current device.</p></li>
447+
<li><p><strong>priority</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – priority of the stream. Can be either
448+
-1 (high priority) or 0 (low priority). By default, streams have
449+
priority 0.</p></li>
450+
</ul>
451+
</dd>
452+
</dl>
453+
<div class="admonition note">
454+
<p class="admonition-title">Note</p>
455+
<p>Although CUDA versions &gt;= 11 support more than two levels of
456+
priorities, in PyTorch, we only support two levels of priorities.</p>
457+
</div>
458+
<dl class="py method">
459+
<dt class="sig sig-object py" id="torch.cuda.Stream.query">
460+
<span class="sig-name descname"><span class="pre">query</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream.query"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream.query" title="Permalink to this definition"></a></dt>
461+
<dd><p>Checks if all the work submitted has been completed.</p>
462+
<dl class="field-list simple">
463+
<dt class="field-odd">Returns<span class="colon">:</span></dt>
464+
<dd class="field-odd"><p>A boolean indicating if all kernels in this stream are completed.</p>
465+
</dd>
466+
</dl>
467+
</dd></dl>
468+
469+
<dl class="py method">
470+
<dt class="sig sig-object py" id="torch.cuda.Stream.record_event">
471+
<span class="sig-name descname"><span class="pre">record_event</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">event</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream.record_event"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream.record_event" title="Permalink to this definition"></a></dt>
472+
<dd><p>Records an event.</p>
473+
<dl class="field-list simple">
474+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
475+
<dd class="field-odd"><p><strong>event</strong> (<a class="reference internal" href="torch.cuda.Event.html#torch.cuda.Event" title="torch.cuda.Event"><em>torch.cuda.Event</em></a><em>, </em><em>optional</em>) – event to record. If not given, a new one
476+
will be allocated.</p>
477+
</dd>
478+
<dt class="field-even">Returns<span class="colon">:</span></dt>
479+
<dd class="field-even"><p>Recorded event.</p>
443480
</dd>
444481
</dl>
445-
<p>..Note:: In eager mode stream is of type Stream class while in JIT it is
446-
an object of the custom class <code class="docutils literal notranslate"><span class="pre">torch.classes.cuda.Stream</span></code>.</p>
482+
</dd></dl>
483+
484+
<dl class="py method">
485+
<dt class="sig sig-object py" id="torch.cuda.Stream.synchronize">
486+
<span class="sig-name descname"><span class="pre">synchronize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream.synchronize"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream.synchronize" title="Permalink to this definition"></a></dt>
487+
<dd><p>Wait for all the kernels in this stream to complete.</p>
488+
<div class="admonition note">
489+
<p class="admonition-title">Note</p>
490+
<p>This is a wrapper around <code class="docutils literal notranslate"><span class="pre">cudaStreamSynchronize()</span></code>: see
491+
<a class="reference external" href="https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html">CUDA Stream documentation</a> for more info.</p>
492+
</div>
493+
</dd></dl>
494+
495+
<dl class="py method">
496+
<dt class="sig sig-object py" id="torch.cuda.Stream.wait_event">
497+
<span class="sig-name descname"><span class="pre">wait_event</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">event</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream.wait_event"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream.wait_event" title="Permalink to this definition"></a></dt>
498+
<dd><p>Makes all future work submitted to the stream wait for an event.</p>
499+
<dl class="field-list simple">
500+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
501+
<dd class="field-odd"><p><strong>event</strong> (<a class="reference internal" href="torch.cuda.Event.html#torch.cuda.Event" title="torch.cuda.Event"><em>torch.cuda.Event</em></a>) – an event to wait for.</p>
502+
</dd>
503+
</dl>
504+
<div class="admonition note">
505+
<p class="admonition-title">Note</p>
506+
<p>This is a wrapper around <code class="docutils literal notranslate"><span class="pre">cudaStreamWaitEvent()</span></code>: see
507+
<a class="reference external" href="https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html">CUDA Stream documentation</a> for more info.</p>
508+
<p>This function returns without waiting for <code class="xref py py-attr docutils literal notranslate"><span class="pre">event</span></code>: only future
509+
operations are affected.</p>
510+
</div>
511+
</dd></dl>
512+
513+
<dl class="py method">
514+
<dt class="sig sig-object py" id="torch.cuda.Stream.wait_stream">
515+
<span class="sig-name descname"><span class="pre">wait_stream</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/torch/cuda/streams.html#Stream.wait_stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#torch.cuda.Stream.wait_stream" title="Permalink to this definition"></a></dt>
516+
<dd><p>Synchronizes with another stream.</p>
517+
<p>All future work submitted to this stream will wait until all kernels
518+
submitted to a given stream at the time of call complete.</p>
519+
<dl class="field-list simple">
520+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
521+
<dd class="field-odd"><p><strong>stream</strong> (<a class="reference internal" href="#torch.cuda.Stream" title="torch.cuda.Stream"><em>Stream</em></a>) – a stream to synchronize.</p>
522+
</dd>
523+
</dl>
524+
<div class="admonition note">
525+
<p class="admonition-title">Note</p>
526+
<p>This function returns without waiting for currently enqueued
527+
kernels in <a class="reference internal" href="torch.cuda.stream.html#torch.cuda.stream" title="torch.cuda.stream"><code class="xref py py-attr docutils literal notranslate"><span class="pre">stream</span></code></a>: only future operations are affected.</p>
528+
</div>
529+
</dd></dl>
530+
447531
</dd></dl>
448532

449533
</section>
@@ -456,10 +540,10 @@ <h1>torch.cuda.stream<a class="headerlink" href="#torch-cuda-stream" title="Perm
456540

457541
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
458542

459-
<a href="torch.cuda.synchronize.html" class="btn btn-neutral float-right" title="torch.cuda.synchronize" accesskey="n" rel="next">Next <img src="../_static/images/chevron-right-orange.svg" class="next-page"></a>
543+
<a href="torch.cuda.ExternalStream.html" class="btn btn-neutral float-right" title="ExternalStream" accesskey="n" rel="next">Next <img src="../_static/images/chevron-right-orange.svg" class="next-page"></a>
460544

461545

462-
<a href="torch.cuda.set_sync_debug_mode.html" class="btn btn-neutral" title="torch.cuda.set_sync_debug_mode" accesskey="p" rel="prev"><img src="../_static/images/chevron-right-orange.svg" class="previous-page"> Previous</a>
546+
<a href="torch.cuda.comm.gather.html" class="btn btn-neutral" title="torch.cuda.comm.gather" accesskey="p" rel="prev"><img src="../_static/images/chevron-right-orange.svg" class="previous-page"> Previous</a>
463547

464548
</div>
465549

@@ -491,7 +575,7 @@ <h1>torch.cuda.stream<a class="headerlink" href="#torch-cuda-stream" title="Perm
491575
<div class="pytorch-right-menu" id="pytorch-right-menu">
492576
<div class="pytorch-side-scroll" id="pytorch-side-scroll-right">
493577
<ul>
494-
<li><a class="reference internal" href="#">torch.cuda.stream</a></li>
578+
<li><a class="reference internal" href="#">Stream</a></li>
495579
</ul>
496580

497581
</div>

0 commit comments

Comments
 (0)