diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index b2c96df36242..48a29ffbe945 100755 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -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 diff --git a/dpnp/dpnp_utils/dpnp_algo_utils.pyx b/dpnp/dpnp_utils/dpnp_algo_utils.pyx index 732b792af125..f0b60ec5e6a8 100644 --- a/dpnp/dpnp_utils/dpnp_algo_utils.pyx +++ b/dpnp/dpnp_utils/dpnp_algo_utils.pyx @@ -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') diff --git a/dpnp/tests/conftest.py b/dpnp/tests/conftest.py index a0a76e3edb4e..c4938fff9bd2 100644 --- a/dpnp/tests/conftest.py +++ b/dpnp/tests/conftest.py @@ -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)) diff --git a/dpnp/tests/test_histogram.py b/dpnp/tests/test_histogram.py index a00312af3a5a..7ce218d55e26 100644 --- a/dpnp/tests/test_histogram.py +++ b/dpnp/tests/test_histogram.py @@ -1,3 +1,5 @@ +import time + import dpctl import numpy import pytest @@ -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()) diff --git a/dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py b/dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py index fbc22032aba2..a16d7f598e8e 100644 --- a/dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py +++ b/dpnp/tests/third_party/cupy/statistics_tests/test_histogram.py @@ -1,6 +1,8 @@ import sys +import time import unittest +import dpctl import numpy import pytest @@ -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)