Skip to content

Commit 531e6de

Browse files
author
Diptorup Deb
committed
Add API doc for get_device_cached_queue
1 parent 2320c92 commit 531e6de

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

dpctl/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
get_current_backend,
6767
get_current_device_type,
6868
get_current_queue,
69+
get_device_cached_queue,
6970
get_num_activated_queues,
7071
is_in_device_context,
7172
nested_context_factories,
@@ -123,6 +124,7 @@
123124
"get_current_backend",
124125
"get_current_device_type",
125126
"get_current_queue",
127+
"get_device_cached_queue",
126128
"get_num_activated_queues",
127129
"is_in_device_context",
128130
"nested_context_factories",

dpctl/_sycl_queue_manager.pyx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ from ._sycl_context cimport SyclContext
3939
from ._sycl_device cimport SyclDevice
4040

4141
__all__ = [
42+
"_global_device_queue_cache",
4243
"device_context",
4344
"get_current_backend",
4445
"get_current_device_type",
4546
"get_current_queue",
47+
"get_device_cached_queue",
4648
"get_num_activated_queues",
4749
"is_in_device_context",
4850
"set_global_queue",
49-
"_global_device_queue_cache",
5051
]
5152

5253
_logger = logging.getLogger(__name__)
@@ -344,7 +345,21 @@ _global_device_queue_cache = ContextVar(
344345

345346

346347
cpdef object get_device_cached_queue(object key):
347-
"""Get cached queue associated with given device"""
348+
"""Returns a cached queue associated with given device.
349+
350+
Args:
351+
key : Either a 2-tuple consisting of a :class:`dpctl.SyclContext` and
352+
a :class:`dpctl.SyclDevice`, or a :class:`dpctl.SyclDevice`
353+
instance, or a filter string identifying a device.
354+
355+
Returns:
356+
:class:`dpctl.SyclQueue`: A cached SYCL queue associated with the
357+
input device.
358+
359+
Raises:
360+
TypeError: If the input key is not one of the accepted types.
361+
362+
"""
348363
_cache = _global_device_queue_cache.get()
349364
q_, changed_ = _cache.get_or_create(key)
350365
if changed_: _global_device_queue_cache.set(_cache)

0 commit comments

Comments
 (0)