From 8ce7d0024a9fdfdaf5e409769b83a0de3a70fef9 Mon Sep 17 00:00:00 2001 From: samaid Date: Fri, 5 Nov 2021 11:46:16 -0500 Subject: [PATCH] Update _sycl_queue_manager.pyx Improved device_context(arg) API reference documentation --- dpctl/_sycl_queue_manager.pyx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dpctl/_sycl_queue_manager.pyx b/dpctl/_sycl_queue_manager.pyx index 53d5058d04..c2b854da12 100644 --- a/dpctl/_sycl_queue_manager.pyx +++ b/dpctl/_sycl_queue_manager.pyx @@ -213,7 +213,8 @@ cpdef get_current_backend(): @contextmanager def device_context(arg): """ - Yields a SYCL queue corresponding to the input filter string. + Yields a SYCL queue corresponding to the input queue object, device object, + or device filter selector string. This context manager "activates", *i.e.*, sets as the currently usable queue, the SYCL queue defined by the argument `arg`. @@ -223,25 +224,25 @@ def device_context(arg): usable queue on exiting the context manager. Args: - - queue_str (str) : A string corresponding to the DPC++ filter selector. + arg : A :class:`dpctl.SyclQueue` object, or a :class:`dpctl.SyclDevice` + object, or a filter selector string. Yields: - :class:`.SyclQueue`: A SYCL queue corresponding to the specified - filter string. + :class:`dpctl.SyclQueue`: A SYCL queue corresponding to the specified + input device, queue, or filter string. Raises: SyclQueueCreationError: If the SYCL queue creation failed. :Example: - To create a scope within which the Level Zero GPU number 0 is active, - a programmer needs to do the following. + The following example sets current queue targeting specific device + indicated with filter selector string in the scope of `with` block: .. code-block:: python import dpctl with dpctl.device_context("level0:gpu:0"): - pass + do_something_on_gpu0() """ ctxt = None