Skip to content

Commit 7b6e91a

Browse files
committed
Add printing of a dictionary with the info for current device, inlcuding free memory if available
1 parent 2233a8c commit 7b6e91a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

dpnp/tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
import dpnp
4646

47-
from .helper import get_dev_id
47+
from .helper import get_dev_id, get_dev_info
4848

4949
skip_mark = pytest.mark.skip(reason="Skipping test.")
5050

@@ -143,7 +143,9 @@ def pytest_collection_modifyitems(config, items):
143143
print(
144144
f"DPNP Test scope includes all integer dtypes: {bool(dtype_config.all_int_types)}"
145145
)
146-
print(f"DPNP current device ID: 0x{get_dev_id(dev):04X}")
146+
print(
147+
f"DPNP current device ID: 0x{get_dev_id(dev):04X}, info: {get_dev_info(dev)}"
148+
)
147149
print(f"DPNP current device is CPU: {is_cpu}")
148150
print(f"DPNP current device is GPU: {is_gpu}")
149151
print(f"DPNP current device supports fp64: {support_fp64}")

dpnp/tests/helper.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,18 @@ def get_dev_id(device=None):
309309
Obtain Intel Device ID for a device (the default device if not provided).
310310
"""
311311

312+
return get_dev_info(device).get("device_id", 0)
313+
314+
315+
def get_dev_info(device=None):
316+
"""
317+
Obtain a dictionary with the info for a device (the default device if not
318+
provided).
319+
320+
"""
321+
312322
dev = dpctl.select_default_device() if device is None else device
313-
dev_info = dpctl.utils.intel_device_info(dev)
314-
return dev_info.get("device_id", 0)
323+
return dpctl.utils.intel_device_info(dev)
315324

316325

317326
def get_float_dtypes(no_float16=True, device=None):

0 commit comments

Comments
 (0)