From bb9f3e1f678787a698dec2def30e8a54c94e4cd9 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 14 Oct 2026 21:27:28 +0200 Subject: [PATCH 1/3] Package the CuPy-based scipy tests The tests/third_party/cupyx/*/*.py glob reaches only the scipy_tests package itself, so the test files one level below it (linalg_tests, sparse_tests, special_tests) were left out of the dpnp package and never ran with --pyargs dpnp.tests against an installed package. --- CHANGELOG.md | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6b8161ef84..66cf8ec33368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ This release is compatible with NumPy 2.5. * Fixed incorrect results of `dpnp.tensor.vecdot` in some cases with strided outputs and of `dpnp.tensor` reductions, `dpnp.tensor.vecdot` and `dpnp.tensor.matmul` on large inputs with some data types [#3082](https://github.com/IntelPython/dpnp/pull/3082) * Fixed `dpnp.median` and `dpnp.nanmedian` raising a `ValueError` for a tuple `axis` when a kept dimension has size 0 [#3081](https://github.com/IntelPython/dpnp/pull/3081) * Fixed a `RuntimeError` raised by `dpnp.tensor` kernels launched over more than `INT_MAX` work-items when built with DPC++ compiler 2026.2 or newer, by also passing `-fno-sycl-id-queries-fit-in-int` to the linker [#3089](https://github.com/IntelPython/dpnp/pull/3089) +* Fixed the CuPy-based `dpnp.scipy` tests under `dpnp/tests/third_party/cupyx/scipy_tests/` missing from the `dpnp` package, so they never ran against an installed package [#3102](https://github.com/IntelPython/dpnp/pull/3102) ### Security diff --git a/setup.py b/setup.py index 08fadda683d8..57264addc7e3 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ "tests/third_party/cupy/*/*.py", "tests/third_party/cupyx/*.py", "tests/third_party/cupyx/*/*.py", + "tests/third_party/cupyx/*/*/*.py", ], }, include_package_data=False, From 402fd3c0850a401bd17a85433c81fff383658414 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 15 Oct 2026 12:11:23 +0200 Subject: [PATCH 2/3] Fix the Jacobi preconditioner in TestMinres At the test's density diag(a) is mostly zero, so 1/diag(a) put inf into the Jacobi preconditioner. SciPy and dpnp then both returned NaN, the comparison passed as NaN == NaN, and the reference side raised RuntimeWarnings. Use 1 for the zero diagonal entries so both sides compare finite results. --- .../cupyx/scipy_tests/sparse_tests/test_linalg.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpnp/tests/third_party/cupyx/scipy_tests/sparse_tests/test_linalg.py b/dpnp/tests/third_party/cupyx/scipy_tests/sparse_tests/test_linalg.py index c77096a289cb..8e5f6001da64 100644 --- a/dpnp/tests/third_party/cupyx/scipy_tests/sparse_tests/test_linalg.py +++ b/dpnp/tests/third_party/cupyx/scipy_tests/sparse_tests/test_linalg.py @@ -625,7 +625,10 @@ def _make_matrix(self): a[mask > self.density] = 0 m = None if self.M == "jacobi": - m = numpy.diag(1.0 / numpy.diag(a)) + # NOTE: at this density diag(a) is mostly zero, so upstream's + # 1/diag(a) is inf and both sides return NaN; use 1 there. + d = numpy.diag(a) + m = numpy.diag(1.0 / numpy.where(d == 0, 1, d)) return a, m def _make_normalized_vector(self): From 5d507011434e26c82b6ab5a94e824700bd903f24 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 15 Oct 2026 16:01:37 +0200 Subject: [PATCH 3/3] Package dpnp/tests/third_party/__init__.py Without it the installed dpnp.tests.third_party was an implicit namespace package, unlike in the source tree. --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 57264addc7e3..23145fab0051 100644 --- a/setup.py +++ b/setup.py @@ -64,6 +64,7 @@ "tests/tensor/*.py", "tests/tensor/*/*.py", "tests/testing/*.py", + "tests/third_party/*.py", "tests/third_party/cupy/*.py", "tests/third_party/cupy/*/*.py", "tests/third_party/cupyx/*.py",