Skip to content

[DEBUG] Print device info #2537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ set -e

$PYTHON -c "import dpnp; print(dpnp.__version__)"
$PYTHON -m dpctl -f
$PYTHON -m pytest -ra --pyargs dpnp
# $PYTHON -m pytest -ra -sv --pyargs dpnp
timeout --signal=SIGINT 30m gdb --batch -ex "run" --ex "thread apply all bt" --ex "quit" --args "$PYTHON" -m pytest -ra -sv --pyargs dpnp
3 changes: 2 additions & 1 deletion dpnp/dpnp_utils/dpnp_algo_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ cdef ERROR_PREFIX = "DPNP error:"


def convert_item(item):
if hasattr(item, "__sycl_usm_array_interface__"):
# if hasattr(item, "__sycl_usm_array_interface__"):
if dpnp.is_supported_array_type(item):
item_converted = dpnp.asnumpy(item)
elif hasattr(item, "__array_interface__"): # detect if it is a container (TODO any better way?)
mod_name = getattr(item, "__module__", 'none')
Expand Down
1 change: 1 addition & 0 deletions dpnp/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def pytest_collection_modifyitems(config, items):
print(f"DPNP version: {dpnp.__version__}, location: {dpnp}")
print(f"NumPy version: {numpy.__version__}, location: {numpy}")
print(f"Python version: {sys.version}")
print(f"Device info: {dpctl.utils.intel_device_info(dev)}")
print("")
if is_gpu or os.getenv("DPNP_QUEUE_GPU") == "1":
excluded_tests.extend(get_excluded_tests(test_exclude_file_gpu))
Expand Down
19 changes: 19 additions & 0 deletions dpnp/tests/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

import dpctl
import numpy
import pytest
Expand All @@ -24,6 +26,23 @@
numpy_version,
)

# TODO: comments
_dev = dpctl.select_default_device()


@pytest.fixture(autouse=True)
def setup_each():
print("\n[Setup] Run before each test")
start_time = time.time()
free_mem = dpctl.utils.intel_device_info(_dev).get("free_memory", None)
if free_mem:
print(f"Global memory available: {free_mem}")
yield
end_time = time.time()
duration = end_time - start_time
print(f"\n[Test Duration] {duration:.4f} seconds")
print("[Teardown] Run after each test")


class TestDigitize:
@pytest.mark.parametrize("dtype", get_integer_float_dtypes())
Expand Down
20 changes: 20 additions & 0 deletions dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
import time
import unittest

import dpctl
import numpy
import pytest

Expand Down Expand Up @@ -44,6 +46,24 @@ def for_all_dtypes_combination_bincount(names):
return testing.for_dtypes_combination(_all_types, names=names)


# TODO: comments
_dev = dpctl.select_default_device()


@pytest.fixture(autouse=True)
def setup_each():
print("\n[Setup] Run before each test")
start_time = time.time()
free_mem = dpctl.utils.intel_device_info(_dev).get("free_memory", None)
if free_mem:
print(f"Global memory available: {free_mem}")
yield
end_time = time.time()
duration = end_time - start_time
print(f"\n[Test Duration] {duration:.4f} seconds")
print("[Teardown] Run after each test")


class TestHistogram(unittest.TestCase):

@testing.for_all_dtypes(no_bool=True, no_complex=True)
Expand Down
Loading