Skip to content

Commit

Permalink
Complied with black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Feb 21, 2023
1 parent 8f223d0 commit 4329722
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions dpctl/_sycl_queue_manager.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,14 @@ cdef class _DeviceDefaultQueueCache:
self.__device_queue_map__ = dict()

def get_or_create(self, key):
"""Return instance of SyclQueue and indicator if cache has been modified"""
if isinstance(key, tuple) and len(key) == 2 and isinstance(key[0], SyclContext) and isinstance(key[1], SyclDevice):
"""Return instance of SyclQueue and indicator if cache
has been modified"""
if (
isinstance(key, tuple)
and len(key) == 2
and isinstance(key[0], SyclContext)
and isinstance(key[1], SyclDevice)
):
ctx_dev = key
q = None
elif isinstance(key, SyclDevice):
Expand All @@ -325,12 +331,16 @@ cdef class _DeviceDefaultQueueCache:
self.__device_queue_map__.update(dev_queue_map)

def __copy__(self):
cdef _DeviceDefaultQueueCache _copy = _DeviceDefaultQueueCache.__new__(_DeviceDefaultQueueCache)
cdef _DeviceDefaultQueueCache _copy = _DeviceDefaultQueueCache.__new__(
_DeviceDefaultQueueCache)
_copy._update_map(self.__device_queue_map__)
return _copy


_global_device_queue_cache = ContextVar('global_device_queue_cache', default=_DeviceDefaultQueueCache())
_global_device_queue_cache = ContextVar(
'global_device_queue_cache',
default=_DeviceDefaultQueueCache()
)


cpdef object get_device_cached_queue(object key):
Expand Down

0 comments on commit 4329722

Please sign in to comment.