@@ -213,7 +213,8 @@ cpdef get_current_backend():
213
213
@contextmanager
214
214
def device_context (arg ):
215
215
"""
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.
217
218
218
219
This context manager "activates", *i.e.*, sets as the currently usable
219
220
queue, the SYCL queue defined by the argument `arg`.
@@ -223,25 +224,25 @@ def device_context(arg):
223
224
usable queue on exiting the context manager.
224
225
225
226
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 .
228
229
229
230
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.
232
233
233
234
Raises:
234
235
SyclQueueCreationError: If the SYCL queue creation failed.
235
236
236
237
: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:
239
240
240
241
.. code-block:: python
241
242
242
243
import dpctl
243
244
with dpctl.device_context("level0:gpu:0"):
244
- pass
245
+ do_something_on_gpu0()
245
246
246
247
"""
247
248
ctxt = None
0 commit comments