File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 41
41
42
42
import dpnp
43
43
44
+ from .helper import get_dev_id
45
+
44
46
skip_mark = pytest .mark .skip (reason = "Skipping test." )
45
47
46
48
@@ -129,7 +131,6 @@ def pytest_collection_modifyitems(config, items):
129
131
test_exclude_file_cuda = os .path .join (test_path , "skipped_tests_cuda.tbl" )
130
132
131
133
dev = dpctl .select_default_device ()
132
- dev_id = dpctl .utils .intel_device_info (dev ).get ("device_id" , 0 )
133
134
is_cpu = dev .is_cpu
134
135
is_gpu = dev .is_gpu
135
136
support_fp64 = dev .has_aspect_fp64
@@ -139,7 +140,7 @@ def pytest_collection_modifyitems(config, items):
139
140
print (
140
141
f"DPNP Test scope includes all integer dtypes: { bool (dtype_config .all_int_types )} "
141
142
)
142
- print (f"DPNP current device ID: { dev_id :#x} " )
143
+ print (f"DPNP current device ID: { get_dev_id ( dev ) :#x} " )
143
144
print (f"DPNP current device is CPU: { is_cpu } " )
144
145
print (f"DPNP current device is GPU: { is_gpu } " )
145
146
print (f"DPNP current device supports fp64: { support_fp64 } " )
Original file line number Diff line number Diff line change @@ -26,14 +26,8 @@ def _assert_shape(a, b):
26
26
assert a .shape == (), f"{ a .shape } != ()"
27
27
28
28
29
- def _get_dev_id (device = None ):
30
- dev = dpctl .select_default_device () if device is None else device
31
- dev_info = dpctl .utils .intel_device_info (dev )
32
- return dev_info .get ("device_id" , 0 )
33
-
34
-
35
29
def _get_dev_mask (device = None ):
36
- return _get_dev_id (device ) & 0xFF00
30
+ return get_dev_id (device ) & 0xFF00
37
31
38
32
39
33
def assert_dtype_allclose (
@@ -309,6 +303,16 @@ def get_complex_dtypes(device=None):
309
303
return dtypes
310
304
311
305
306
+ def get_dev_id (device = None ):
307
+ """
308
+ Obtain Intel Device ID for a device (the default device if not provided).
309
+ """
310
+
311
+ dev = dpctl .select_default_device () if device is None else device
312
+ dev_info = dpctl .utils .intel_device_info (dev )
313
+ return dev_info .get ("device_id" , 0 )
314
+
315
+
312
316
def get_float_dtypes (no_float16 = True , device = None ):
313
317
"""
314
318
Build a list of floating types supported by DPNP based on device capabilities.
You can’t perform that action at this time.
0 commit comments