Skip to content

Commit bbcfd6d

Browse files
authored
Merge d492948 into 6fe5c6e
2 parents 6fe5c6e + d492948 commit bbcfd6d

File tree

6 files changed

+60
-49
lines changed

6 files changed

+60
-49
lines changed

.github/workflows/conda-package.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ env:
1616
CONDA_BUILD_INDEX_ENV_PY_VER: '3.12' # conda does not support python 3.13
1717
CONDA_BUILD_VERSION: '25.1.1'
1818
CONDA_INDEX_VERSION: '0.5.0'
19-
CONDA_CPH_VERSION: '2.4.0'
2019
RERUN_TESTS_ON_FAILURE: 'true'
2120
RUN_TESTS_MAX_ATTEMPTS: 2
2221
TEST_ENV_NAME: 'test'
@@ -130,7 +129,6 @@ jobs:
130129
env:
131130
channel-path: '${{ github.workspace }}/channel/'
132131
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
133-
extracted-pkg-path: '${{ github.workspace }}/pkg/'
134132
ver-json-path: '${{ github.workspace }}/version.json'
135133

136134
steps:
@@ -163,14 +161,9 @@ jobs:
163161
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
164162
activate-environment: ${{ env.TEST_ENV_NAME }}
165163

166-
- name: Install conda-index and conda-package-handling
164+
- name: Install conda-index
167165
run: |
168-
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }} conda-package-handling=${{ env.CONDA_CPH_VERSION }}
169-
170-
- name: Extract package archive
171-
run: |
172-
mkdir -p ${{ env.extracted-pkg-path }}
173-
cph extract ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.conda --dest ${{ env.extracted-pkg-path }}
166+
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
174167
175168
- name: Create conda channel
176169
run: |
@@ -255,7 +248,6 @@ jobs:
255248
env:
256249
channel-path: '${{ github.workspace }}\channel\'
257250
pkg-path-in-channel: '${{ github.workspace }}\channel\win-64\'
258-
extracted-pkg-path: '${{ github.workspace }}\pkg'
259251
ver-json-path: '${{ github.workspace }}\version.json'
260252
workdir: '${{ github.workspace }}'
261253

@@ -269,7 +261,6 @@ jobs:
269261
- name: Store a path to package archive
270262
run: |
271263
@echo on
272-
mkdir -p ${{ env.extracted-pkg-path }}
273264
274265
set SEARCH_SCRIPT="DIR ${{ env.pkg-path-in-channel }} /s/b | FINDSTR /r "dpnp-.*\.conda""
275266
FOR /F "tokens=* USEBACKQ" %%F IN (`%SEARCH_SCRIPT%`) DO (
@@ -294,14 +285,9 @@ jobs:
294285
(echo CONDA_LIB_PATH=%CONDA_PREFIX%\Library\lib\) >> %GITHUB_ENV%
295286
(echo CONDA_LIB_BIN_PATH=%CONDA_PREFIX%\Library\bin\) >> %GITHUB_ENV%
296287
297-
- name: Install conda-index and conda-package-handling
298-
run: |
299-
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }} conda-package-handling=${{ env.CONDA_CPH_VERSION }}
300-
301-
- name: Extract package archive
288+
- name: Install conda-index
302289
run: |
303-
cph extract %FULL_PACKAGE_PATH% --dest ${{ env.extracted-pkg-path }}
304-
dir ${{ env.extracted-pkg-path }}
290+
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
305291
306292
- name: Create conda channel
307293
run: |
@@ -467,7 +453,6 @@ jobs:
467453
array-api-skips-file: '${{ github.workspace }}/dpnp/.github/workflows/array-api-skips.txt'
468454
channel-path: '${{ github.workspace }}/channel/'
469455
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
470-
extracted-pkg-path: '${{ github.workspace }}/pkg/'
471456
ver-json-path: '${{ github.workspace }}/version.json'
472457

473458
steps:
@@ -500,21 +485,16 @@ jobs:
500485
python-version: ${{ matrix.python }}
501486
activate-environment: 'array-api-conformity'
502487

503-
- name: Install conda-index and conda-package-handling
488+
- name: Install conda-index
504489
id: install_conda_index
505490
continue-on-error: true
506491
run: |
507-
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }} conda-package-handling=${{ env.CONDA_CPH_VERSION }}
492+
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
508493
509-
- name: ReInstall conda-index and conda-package-handling
494+
- name: ReInstall conda-index
510495
if: steps.install_conda_index.outcome == 'failure'
511496
run: |
512-
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }} conda-package-handling=${{ env.CONDA_CPH_VERSION }}
513-
514-
- name: Extract package archive
515-
run: |
516-
mkdir -p ${{ env.extracted-pkg-path }}
517-
cph extract ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.conda --dest ${{ env.extracted-pkg-path }}
497+
mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
518498
519499
- name: Create conda channel
520500
run: |

dpnp/tests/third_party/cupy/core_tests/test_nep50_examples.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
import dpnp as cp
5+
from dpnp.tests.helper import has_support_aspect64
56
from dpnp.tests.third_party.cupy import testing
67

78
# TODO: remove once all dtype aliases added
@@ -15,8 +16,6 @@
1516
"uint8(1) + 2",
1617
"array([1], uint8) + int64(1)",
1718
"array([1], uint8) + array(1, int64)",
18-
"array([1.], float32) + float64(1.)",
19-
"array([1.], float32) + array(1., float64)",
2019
"array([1], uint8) + 1",
2120
"array([1], uint8) + 200",
2221
"array([100], uint8) + 200",
@@ -25,7 +24,6 @@
2524
"uint8(100) + 200",
2625
"float32(1) + 3e100",
2726
"array([1.0], float32) + 1e-14 == 1.0",
28-
"array([0.1], float32) == float64(0.1)",
2927
"array(1.0, float32) + 1e-14 == 1.0",
3028
"array([1.], float32) + 3",
3129
"array([1.], float32) + int64(3)",
@@ -42,25 +40,34 @@
4240
"1.0 + array([1, 2, 3], int8)",
4341
"array([1], float32) + 1j",
4442
]
43+
if has_support_aspect64():
44+
examples += [
45+
"array([1.], float32) + float64(1.)",
46+
"array([1.], float32) + array(1., float64)",
47+
"array([0.1], float32) == float64(0.1)",
48+
]
4549

4650

4751
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
4852
@testing.with_requires("numpy>=2.0")
4953
@pytest.mark.parametrize("example", examples)
50-
@testing.numpy_cupy_allclose(atol=1e-15, accept_error=OverflowError)
54+
@testing.numpy_cupy_allclose(
55+
atol=1e-15, accept_error=OverflowError, type_check=has_support_aspect64()
56+
)
5157
def test_nep50_examples(xp, example):
5258
dct = {
5359
"array": xp.array,
5460
"uint8": xp.uint8,
5561
"int64": xp.int64,
5662
"float32": xp.float32,
57-
"float64": xp.float64,
5863
"int16": xp.int16,
5964
"bool_": xp.bool_,
6065
"int32": xp.int32,
6166
"complex64": xp.complex64,
6267
"int8": xp.int8,
6368
}
69+
if has_support_aspect64():
70+
dct["float64"] = xp.float64
6471

6572
if isinstance(example, tuple):
6673
example, mesg = example

dpnp/tests/third_party/cupy/linalg_tests/test_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class TestLinalgCrossProduct(unittest.TestCase):
172172

173173
@testing.with_requires("numpy>=2.0")
174174
@testing.for_all_dtypes_combination(["dtype_a", "dtype_b"])
175-
@testing.numpy_cupy_allclose()
175+
@testing.numpy_cupy_allclose(type_check=has_support_aspect64())
176176
def test_cross(self, xp, dtype_a, dtype_b):
177177
if dtype_a == dtype_b == numpy.bool_:
178178
# cross does not support bool-bool inputs.

dpnp/tests/third_party/cupy/math_tests/test_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def test_fabs(self, xp, dtype):
198198

199199
@testing.with_requires("numpy>=2.0")
200200
@testing.for_all_dtypes(no_complex=True)
201-
@testing.numpy_cupy_allclose(atol=1e-5)
201+
@testing.numpy_cupy_allclose(atol=1e-5, type_check=has_support_aspect64())
202202
def test_fabs_negative(self, xp, dtype):
203203
if numpy.issubdtype(dtype, numpy.unsignedinteger):
204204
pytest.skip("trying to set negative value to unsigned integer")

dpnp/tests/third_party/cupy/math_tests/test_sumprod.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,51 +1162,75 @@ def test_ediff1d_ed2(self, xp, dtype):
11621162
class TestTrapezoid:
11631163

11641164
@testing.for_all_dtypes()
1165-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1165+
@testing.numpy_cupy_allclose(
1166+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1167+
type_check=has_support_aspect64(),
1168+
)
11661169
def test_trapz_1dim(self, xp, dtype):
11671170
a = testing.shaped_arange((5,), xp, dtype)
11681171
return xp.trapezoid(a)
11691172

11701173
@testing.for_all_dtypes()
1171-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1174+
@testing.numpy_cupy_allclose(
1175+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1176+
type_check=has_support_aspect64(),
1177+
)
11721178
def test_trapz_1dim_with_x(self, xp, dtype):
11731179
a = testing.shaped_arange((5,), xp, dtype)
11741180
x = testing.shaped_arange((5,), xp, dtype)
11751181
return xp.trapezoid(a, x=x)
11761182

11771183
@testing.for_all_dtypes()
1178-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1184+
@testing.numpy_cupy_allclose(
1185+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1186+
type_check=has_support_aspect64(),
1187+
)
11791188
def test_trapz_1dim_with_dx(self, xp, dtype):
11801189
a = testing.shaped_arange((5,), xp, dtype)
11811190
return xp.trapezoid(a, dx=0.1)
11821191

11831192
@testing.for_all_dtypes()
1184-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1193+
@testing.numpy_cupy_allclose(
1194+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1195+
type_check=has_support_aspect64(),
1196+
)
11851197
def test_trapz_2dim_without_axis(self, xp, dtype):
11861198
a = testing.shaped_arange((4, 5), xp, dtype)
11871199
return xp.trapezoid(a)
11881200

11891201
@testing.for_all_dtypes()
1190-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1202+
@testing.numpy_cupy_allclose(
1203+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1204+
type_check=has_support_aspect64(),
1205+
)
11911206
def test_trapz_2dim_with_axis(self, xp, dtype):
11921207
a = testing.shaped_arange((4, 5), xp, dtype)
11931208
return xp.trapezoid(a, axis=-2)
11941209

11951210
@testing.for_all_dtypes()
1196-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1211+
@testing.numpy_cupy_allclose(
1212+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1213+
type_check=has_support_aspect64(),
1214+
)
11971215
def test_trapz_2dim_with_x_and_axis(self, xp, dtype):
11981216
a = testing.shaped_arange((4, 5), xp, dtype)
11991217
x = testing.shaped_arange((5,), xp, dtype)
12001218
return xp.trapezoid(a, x=x, axis=1)
12011219

12021220
@testing.for_all_dtypes()
1203-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1221+
@testing.numpy_cupy_allclose(
1222+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1223+
type_check=has_support_aspect64(),
1224+
)
12041225
def test_trapz_2dim_with_dx_and_axis(self, xp, dtype):
12051226
a = testing.shaped_arange((4, 5), xp, dtype)
12061227
return xp.trapezoid(a, dx=0.1, axis=1)
12071228

12081229
@testing.for_all_dtypes()
1209-
@testing.numpy_cupy_allclose(rtol={numpy.float16: 1e-1, "default": 1e-7})
1230+
@testing.numpy_cupy_allclose(
1231+
rtol={numpy.float16: 1e-1, "default": 1e-7},
1232+
type_check=has_support_aspect64(),
1233+
)
12101234
def test_trapz_1dim_with_x_and_dx(self, xp, dtype):
12111235
a = testing.shaped_arange((5,), xp, dtype)
12121236
x = testing.shaped_arange((5,), xp, dtype)

dpnp/tests/third_party/cupy/testing/_loops.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,12 @@ def numpy_cupy_allclose(
583583
# When `type_check` is `False`, cupy result and numpy result may have
584584
# different dtypes so we can not determine the dtype to use from the
585585
# tolerance associations.
586-
if not type_check:
587-
if isinstance(rtol, dict) or isinstance(atol, dict):
588-
raise TypeError(
589-
"When `type_check` is `False`, `rtol` and `atol` "
590-
"must be supplied as float."
591-
)
586+
# if not type_check:
587+
# if isinstance(rtol, dict) or isinstance(atol, dict):
588+
# raise TypeError(
589+
# "When `type_check` is `False`, `rtol` and `atol` "
590+
# "must be supplied as float."
591+
# )
592592

593593
def check_func(c, n):
594594
rtol1, atol1 = _resolve_tolerance(type_check, c, rtol, atol)

0 commit comments

Comments
 (0)