Skip to content

Commit 8ce7d00

Browse files
samaidoleksandr-pavlyk
authored andcommitted
Update _sycl_queue_manager.pyx
Improved device_context(arg) API reference documentation
1 parent 309aa1f commit 8ce7d00

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

dpctl/_sycl_queue_manager.pyx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ cpdef get_current_backend():
213213
@contextmanager
214214
def device_context(arg):
215215
"""
216-
Yields a SYCL queue corresponding to the input filter string.
216+
Yields a SYCL queue corresponding to the input queue object, device object,
217+
or device filter selector string.
217218
218219
This context manager "activates", *i.e.*, sets as the currently usable
219220
queue, the SYCL queue defined by the argument `arg`.
@@ -223,25 +224,25 @@ def device_context(arg):
223224
usable queue on exiting the context manager.
224225
225226
Args:
226-
227-
queue_str (str) : A string corresponding to the DPC++ filter selector.
227+
arg : A :class:`dpctl.SyclQueue` object, or a :class:`dpctl.SyclDevice`
228+
object, or a filter selector string.
228229
229230
Yields:
230-
:class:`.SyclQueue`: A SYCL queue corresponding to the specified
231-
filter string.
231+
:class:`dpctl.SyclQueue`: A SYCL queue corresponding to the specified
232+
input device, queue, or filter string.
232233
233234
Raises:
234235
SyclQueueCreationError: If the SYCL queue creation failed.
235236
236237
:Example:
237-
To create a scope within which the Level Zero GPU number 0 is active,
238-
a programmer needs to do the following.
238+
The following example sets current queue targeting specific device
239+
indicated with filter selector string in the scope of `with` block:
239240
240241
.. code-block:: python
241242
242243
import dpctl
243244
with dpctl.device_context("level0:gpu:0"):
244-
pass
245+
do_something_on_gpu0()
245246
246247
"""
247248
ctxt = None

0 commit comments

Comments
 (0)