Skip to content

Commit 3cd9caf

Browse files
Added test for global device cache class methods
1 parent 98ec732 commit 3cd9caf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

dpctl/tests/test_sycl_queue_manager.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,22 @@ def test_nested_context_factory_exception_if_wrong_factory(
226226
with _register_nested_context_factory(factory):
227227
with dpctl.device_context("opencl:cpu:0"):
228228
pass
229+
230+
231+
def test__DeviceDefaultQueueCache():
232+
import copy
233+
234+
from dpctl._sycl_queue_manager import _global_device_queue_cache as cache
235+
from dpctl._sycl_queue_manager import get_device_cached_queue
236+
237+
try:
238+
d = dpctl.SyclDevice()
239+
except dpctl.SyclDeviceCreationError:
240+
pytest.skip("Could not create default device")
241+
242+
q1 = get_device_cached_queue(d)
243+
cache_copy = copy.copy(cache.get())
244+
q2, changed = cache_copy.get_or_create(d)
245+
246+
assert not changed
247+
assert q1 == q2

0 commit comments

Comments
 (0)