Skip to content

Commit af2f031

Browse files
authored
Merge branch 'master' into update_norm_FFT
2 parents e2fdb83 + a567221 commit af2f031

13 files changed

+144
-42
lines changed

.github/workflows/check-mkl-interfaces.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Merge conda env files
5050
run: |
51-
conda-merge ${{ env.build-with-oneapi-env }} ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }}
51+
conda-merge ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} ${{ env.build-with-oneapi-env }} > ${{ env.environment-file }}
5252
cat ${{ env.environment-file }}
5353
5454
- name: Upload artifact

.github/workflows/conda-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ jobs:
9393
continue-on-error: true
9494
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
9595
env:
96-
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
96+
MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0'
9797

9898
- name: ReBuild conda package
9999
if: steps.build_conda_pkg.outcome == 'failure'
100100
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
101101
env:
102-
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
102+
MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0'
103103

104104
- name: Upload artifact
105105
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Changed
1717

18-
* Extended `dpnp.fft.fftfreq` and `dpnp.fft.rfftfreq` functions to support `dtype` keyword per Python Array API spec 2024.12 [#2384](https://github.com/IntelPython/dpnp/pull/2384)
18+
* Improved performance of `dpnp.nansum`, `dpnp.nanprod`, `dpnp.nancumsum`, and `dpnp.nancumprod` by reusing `dpnp.nan_to_num` function in implementation of the functions [#2339](https://github.com/IntelPython/dpnp/pull/2339)
1919
* Allowed input array of `uint64` dtype in `dpnp.bincount` [#2361](https://github.com/IntelPython/dpnp/pull/2361)
2020
* The vector norms `ord={None, 1, 2, inf}` and the matrix norms `ord={None, 1, 2, inf, "fro", "nuc"}` now consistently return zero for empty arrays, which are arrays with at least one axis of size zero. This change affects `dpnp.linalg.norm`, `dpnp.linalg.vector_norm`, and `dpnp.linalg.matrix_norm`. Previously, dpnp would either raise errors or return zero depending on the parameters provided [#2371](https://github.com/IntelPython/dpnp/pull/2371)
21-
* Improved performance of `dpnp.nansum`, `dpnp.nanprod`, `dpnp.nancumsum`, and `dpnp.nancumprod` by reusing `dpnp.nan_to_num` function in implementation of the functions [#2339](https://github.com/IntelPython/dpnp/pull/2339)
21+
* Extended `dpnp.fft.fftfreq` and `dpnp.fft.rfftfreq` functions to support `dtype` keyword per Python Array API spec 2024.12 [#2384](https://github.com/IntelPython/dpnp/pull/2384)
2222

2323
### Fixed
2424

2525
* Resolved an issue with an incorrect result returned due to missing dependency from the strided kernel on a copy event in `dpnp.erf` [#2378](https://github.com/IntelPython/dpnp/pull/2378)
26+
* Updated `conda create` commands build and install instructions of `Quick start guide` to avoid a compilation error [#2395](https://github.com/IntelPython/dpnp/pull/2395)
2627

2728

2829
## [0.17.0] - 02/26/2025

doc/quick_start_guide.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,18 @@ On Linux:
8888

8989
.. code-block:: bash
9090
91-
conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel onedpl-devel cmake scikit-build ninja pytest -c https://software.repos.intel.com/python/conda/ -c conda-forge
91+
conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \
92+
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
93+
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge
9294
conda activate build-env
9395
9496
On Windows:
9597

9698
.. code-block:: bash
9799
98-
conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel onedpl-devel cmake scikit-build ninja pytest -c https://software.repos.intel.com/python/conda/ -c conda-forge
100+
conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \
101+
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
102+
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge
99103
conda activate build-env
100104
101105
To build and install the package on Linux OS, run:

dpnp/dpnp_iface_types.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,25 @@
3232
This module provides public type interface file for the library
3333
"""
3434

35+
import functools
36+
37+
import dpctl
3538
import dpctl.tensor as dpt
3639
import numpy
3740

41+
import dpnp
42+
3843
from .dpnp_array import dpnp_array
3944

45+
# pylint: disable=no-name-in-module
46+
from .dpnp_utils import get_usm_allocations
47+
4048
__all__ = [
4149
"bool",
4250
"bool_",
4351
"byte",
4452
"cdouble",
53+
"common_type",
4554
"complex128",
4655
"complex64",
4756
"complexfloating",
@@ -145,6 +154,67 @@
145154
pi = numpy.pi
146155

147156

157+
def common_type(*arrays):
158+
"""
159+
Return a scalar type which is common to the input arrays.
160+
161+
The return type will always be an inexact (i.e. floating point or complex)
162+
scalar type, even if all the arrays are integer arrays.
163+
If one of the inputs is an integer array, the minimum precision type
164+
that is returned is the default floating point data type for the device
165+
where the input arrays are allocated.
166+
167+
For full documentation refer to :obj:`numpy.common_type`.
168+
169+
Parameters
170+
----------
171+
arrays: {dpnp.ndarray, usm_ndarray}
172+
Input arrays.
173+
174+
Returns
175+
-------
176+
out: data type
177+
Data type object.
178+
179+
See Also
180+
--------
181+
:obj:`dpnp.dtype` : Create a data type object.
182+
183+
Examples
184+
--------
185+
>>> import dpnp as np
186+
>>> np.common_type(np.arange(2, dtype=np.float32))
187+
numpy.float32
188+
>>> np.common_type(np.arange(2, dtype=np.float32), np.arange(2))
189+
numpy.float64 # may vary
190+
>>> np.common_type(np.arange(4), np.array([45, 6.j]), np.array([45.0]))
191+
numpy.complex128 # may vary
192+
193+
"""
194+
195+
if len(arrays) == 0:
196+
return (
197+
dpnp.float16
198+
if dpctl.select_default_device().has_aspect_fp16
199+
else dpnp.float32
200+
)
201+
202+
dpnp.check_supported_arrays_type(*arrays)
203+
204+
_, exec_q = get_usm_allocations(arrays)
205+
default_float_dtype = dpnp.default_float_type(sycl_queue=exec_q)
206+
dtypes = []
207+
for a in arrays:
208+
if not dpnp.issubdtype(a.dtype, dpnp.number):
209+
raise TypeError("can't get common type for non-numeric array")
210+
if dpnp.issubdtype(a.dtype, dpnp.integer):
211+
dtypes.append(default_float_dtype)
212+
else:
213+
dtypes.append(a.dtype)
214+
215+
return functools.reduce(numpy.promote_types, dtypes).type
216+
217+
148218
# pylint: disable=redefined-outer-name
149219
def finfo(dtype):
150220
"""

dpnp/tests/helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,14 @@ def is_cuda_device(device=None):
346346
return dev.backend == dpctl.backend_type.cuda
347347

348348

349+
def is_gpu_device(device=None):
350+
"""
351+
Return True if a test is running on GPU device, False otherwise.
352+
"""
353+
dev = dpctl.select_default_device() if device is None else device
354+
return dev.has_aspect_gpu
355+
356+
349357
def is_win_platform():
350358
"""
351359
Return True if a test is running on Windows OS, False otherwise.

dpnp/tests/skipped_tests.tbl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,3 @@ tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.
1010
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray(x).astype(dpnp.int8)]
1111

1212
tests/third_party/intel/test_zero_copy_test1.py::test_dpnp_interaction_with_dpctl_memory
13-
14-
tests/test_umath.py::test_umaths[('divmod', 'ii')]
15-
tests/test_umath.py::test_umaths[('divmod', 'll')]
16-
tests/test_umath.py::test_umaths[('divmod', 'ff')]
17-
tests/test_umath.py::test_umaths[('divmod', 'dd')]
18-
tests/test_umath.py::test_umaths[('frexp', 'f')]
19-
tests/test_umath.py::test_umaths[('frexp', 'd')]

dpnp/tests/skipped_tests_cuda.tbl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
tests/test_arithmetic.py::TestArithmetic::test_modf_part1
55
tests/test_arithmetic.py::TestArithmetic::test_modf_part2
66
tests/test_sycl_queue.py::test_modf[cuda:gpu:0]
7-
tests/test_umath.py::test_umaths[('modf', 'f')]
8-
tests/test_umath.py::test_umaths[('modf', 'd')]
97
tests/third_party/cupy/math_tests/test_arithmetic.py::TestArithmeticModf::test_modf
108

119
# random

dpnp/tests/skipped_tests_gpu.tbl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,4 @@ tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp
1717
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]]
1818
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray(x).astype(dpnp.int8)]
1919

20-
tests/test_umath.py::test_umaths[('divmod', 'ii')]
21-
tests/test_umath.py::test_umaths[('divmod', 'll')]
22-
tests/test_umath.py::test_umaths[('divmod', 'ff')]
23-
tests/test_umath.py::test_umaths[('divmod', 'dd')]
24-
tests/test_umath.py::test_umaths[('floor_divide', 'ff')]
25-
tests/test_umath.py::test_umaths[('frexp', 'f')]
26-
tests/test_umath.py::test_umaths[('frexp', 'd')]
27-
2820
tests/third_party/intel/test_zero_copy_test1.py::test_dpnp_interaction_with_dpctl_memory

dpnp/tests/skipped_tests_gpu_no_fp64.tbl

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)