Skip to content

Commit 524b89b

Browse files
committed
Add support of numpy 1.24
1 parent 5139df1 commit 524b89b

25 files changed

+77
-106
lines changed

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requirements:
88
host:
99
- python
1010
- setuptools
11-
- numpy >=1.19,<1.23a0
11+
- numpy >=1.19,<1.25a0
1212
- cython
1313
- cmake >=3.19
1414
- dpctl >=0.13

dpnp/backend/include/dpnp_iface_fptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -391,7 +391,7 @@ enum class DPNPFuncType : size_t
391391
DPNP_FT_DOUBLE, /**< analog of numpy.float32 or double */
392392
DPNP_FT_CMPLX64, /**< analog of numpy.complex64 or std::complex<float> */
393393
DPNP_FT_CMPLX128, /**< analog of numpy.complex128 or std::complex<double> */
394-
DPNP_FT_BOOL /**< analog of numpy.bool or numpy.bool_ or bool */
394+
DPNP_FT_BOOL /**< analog of numpy.bool_ or bool */
395395
};
396396

397397
/**

dpnp/backend/kernels/dpnp_krnl_arraycreation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2022, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/src/dpnpc_memory_adapter.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
#include "queue_sycl.hpp"
3131
#include "dpnp_utils.hpp"
3232

33-
static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED,
34-
"The compiler does not meet minimum version requirement");
35-
3633
/**
3734
* @ingroup BACKEND_UTILS
3835
* @brief Adapter for the memory given by parameters in the DPNPC functions

dpnp/backend/src/queue_sycl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include "queue_sycl.hpp"
3232
#include "dpnp_utils.hpp"
3333

34-
static_assert(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_VERSION_REQUIRED,
35-
"The compiler does not meet minimum version requirement");
36-
3734
#if defined(DPNP_LOCAL_QUEUE)
3835
sycl::queue* backend_sycl::queue = nullptr;
3936
#endif

dpnp/dparray.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -462,7 +462,7 @@ cdef class dparray:
462462
return ( < long * > self._dparray_data)[lin_idx]
463463
elif self.dtype == numpy.int32:
464464
return ( < int * > self._dparray_data)[lin_idx]
465-
elif self.dtype == numpy.bool:
465+
elif self.dtype == numpy.bool_:
466466
return ( < cpp_bool * > self._dparray_data)[lin_idx]
467467
elif self.dtype == numpy.complex128:
468468
return ( < double complex * > self._dparray_data)[lin_idx]
@@ -489,7 +489,7 @@ cdef class dparray:
489489
( < long * > self._dparray_data)[lin_idx] = <long > value
490490
elif self.dtype == numpy.int32:
491491
( < int * > self._dparray_data)[lin_idx] = <int > value
492-
elif self.dtype == numpy.bool:
492+
elif self.dtype == numpy.bool_:
493493
( < cpp_bool * > self._dparray_data)[lin_idx] = < cpp_bool > value
494494
elif self.dtype == numpy.complex64:
495495
( < float complex * > self._dparray_data)[lin_idx] = <float complex > value
@@ -876,7 +876,7 @@ cdef class dparray:
876876

877877
"""
878878
879-
if not numpy.issubsctype(self.dtype, numpy.complex):
879+
if not numpy.issubsctype(self.dtype, numpy.complex_):
880880
return self
881881
else:
882882
return conjugate(self)
@@ -889,7 +889,7 @@ cdef class dparray:
889889

890890
"""
891891
892-
if not numpy.issubsctype(self.dtype, numpy.complex):
892+
if not numpy.issubsctype(self.dtype, numpy.complex_):
893893
return self
894894
else:
895895
return conjugate(self)

dpnp/dpnp_algo/dpnp_algo.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ cdef dpnp_DPNPFuncType_to_dtype(size_t type):
276276
elif type == <size_t > DPNP_FT_CMPLX128:
277277
return numpy.complex128
278278
elif type == <size_t > DPNP_FT_BOOL:
279-
return numpy.bool
279+
return numpy.bool_
280280
else:
281281
utils.checker_throw_type_error("dpnp_DPNPFuncType_to_dtype", type)
282282

dpnp/dpnp_algo/dpnp_algo_arraycreation.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -434,7 +434,7 @@ cpdef utils.dpnp_descriptor dpnp_trace(utils.dpnp_descriptor arr, offset=0, axis
434434
return result
435435

436436

437-
cpdef utils.dpnp_descriptor dpnp_tri(N, M=None, k=0, dtype=numpy.float):
437+
cpdef utils.dpnp_descriptor dpnp_tri(N, M=None, k=0, dtype=dpnp.float):
438438
if M is None:
439439
M = N
440440

dpnp/dpnp_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# *****************************************************************************
3-
# Copyright (c) 2016-2022, Intel Corporation
3+
# Copyright (c) 2016-2023, Intel Corporation
44
# All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without
@@ -493,7 +493,7 @@ def conj(self):
493493
494494
"""
495495

496-
if not numpy.issubsctype(self.dtype, numpy.complex):
496+
if not numpy.issubsctype(self.dtype, numpy.complex_):
497497
return self
498498
else:
499499
return dpnp.conjugate(self)
@@ -506,7 +506,7 @@ def conjugate(self):
506506
507507
"""
508508

509-
if not numpy.issubsctype(self.dtype, numpy.complex):
509+
if not numpy.issubsctype(self.dtype, numpy.complex_):
510510
return self
511511
else:
512512
return dpnp.conjugate(self)

dpnp/dpnp_iface_arraycreation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2022, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -1280,7 +1280,7 @@ def trace(x1, offset=0, axis1=0, axis2=1, dtype=None, out=None):
12801280
return call_origin(numpy.trace, x1, offset, axis1, axis2, dtype, out)
12811281

12821282

1283-
def tri(N, M=None, k=0, dtype=numpy.float, **kwargs):
1283+
def tri(N, M=None, k=0, dtype=dpnp.float, **kwargs):
12841284
"""
12851285
An array with ones at and below the given diagonal and zeros elsewhere.
12861286
@@ -1315,7 +1315,7 @@ def tri(N, M=None, k=0, dtype=numpy.float, **kwargs):
13151315
elif not isinstance(k, int):
13161316
pass
13171317
else:
1318-
if dtype is numpy.float:
1318+
if dtype is dpnp.float:
13191319
sycl_queue = dpnp.get_normalized_queue_device(sycl_queue=None, device=None)
13201320
dtype = map_dtype_to_device(dpnp.float64, sycl_queue.sycl_device)
13211321
return dpnp_tri(N, M, k, dtype).get_pyobj()

dpnp/dpnp_iface_mathematical.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2022, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -1545,11 +1545,11 @@ def subtract(x1, x2, dtype=None, out=None, where=True, **kwargs):
15451545
pass
15461546
elif x1_desc and x1_desc.ndim == 0:
15471547
pass
1548-
elif x1_desc and x1_desc.dtype == numpy.bool:
1548+
elif x1_desc and x1_desc.dtype == dpnp.bool:
15491549
pass
15501550
elif x2_desc and x2_desc.ndim == 0:
15511551
pass
1552-
elif x2_desc and x2_desc.dtype == numpy.bool:
1552+
elif x2_desc and x2_desc.dtype == dpnp.bool:
15531553
pass
15541554
elif dtype is not None:
15551555
pass

dpnp/dpnp_iface_statistics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2020, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -299,7 +299,7 @@ def cov(x1, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=
299299
return call_origin(numpy.cov, x1, y, rowvar, bias, ddof, fweights, aweights)
300300

301301

302-
def histogram(a, bins=10, range=None, normed=None, weights=None, density=None):
302+
def histogram(a, bins=10, range=None, density=None, weights=None):
303303
"""
304304
Compute the histogram of a dataset.
305305
For full documentation refer to :obj:`numpy.histogram`.
@@ -323,7 +323,7 @@ def histogram(a, bins=10, range=None, normed=None, weights=None, density=None):
323323
1.0
324324
"""
325325

326-
return call_origin(numpy.histogram, a=a, bins=bins, range=range, normed=normed, weights=weights, density=density)
326+
return call_origin(numpy.histogram, a=a, bins=bins, range=range, density=density, weights=weights)
327327

328328

329329
def max(x1, axis=None, out=None, keepdims=False, initial=None, where=True):

dpnp/dpnp_iface_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# distutils: language = c++
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2020, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -59,19 +59,19 @@
5959
"void"
6060
]
6161

62-
bool = numpy.bool
62+
bool = numpy.bool_
6363
bool_ = numpy.bool_
6464
complex128 = numpy.complex128
6565
complex64 = numpy.complex64
6666
dtype = numpy.dtype
6767
float16 = numpy.float16
6868
float32 = numpy.float32
6969
float64 = numpy.float64
70-
float = numpy.float
70+
float = numpy.float_
7171
int32 = numpy.int32
7272
int64 = numpy.int64
7373
integer = numpy.integer
74-
int = numpy.int
74+
int = numpy.int_
7575
longcomplex = numpy.longcomplex
7676

7777

dpnp/dpnp_utils/dpnp_algo_utils.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -399,7 +399,7 @@ cdef tuple get_shape_dtype(object input_obj):
399399

400400
# shape and dtype does not match with siblings.
401401
if ((return_shape != elem_shape) or (return_dtype != elem_dtype)):
402-
return (elem_shape, numpy.dtype(numpy.object))
402+
return (elem_shape, numpy.dtype(numpy.object_))
403403

404404
list_shape.push_back(len(input_obj))
405405
list_shape.insert(list_shape.end(), return_shape.begin(), return_shape.end())

examples/example4.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2020, Intel Corporation
4+
# Copyright (c) 2016-2023 Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@
4040
"""
4141
for function in [numpy.sqrt, numpy.fabs, numpy.reciprocal, numpy.square, numpy.cbrt, numpy.degrees, numpy.radians]:
4242
print()
43-
for test_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool]:
43+
for test_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool_]:
4444
data = numpy.array([1, 2, 3, 4], dtype=test_type)
4545
result = function(data)
4646
print(f"input:{data.dtype.name:10}: outout:{result.dtype.name:10}: name:{function.__name__}")
@@ -50,8 +50,8 @@
5050
"""
5151
for function in [numpy.equal, numpy.arctan2]:
5252
print()
53-
for input1_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool]:
54-
for input2_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool]:
53+
for input1_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool_]:
54+
for input2_type in [numpy.float64, numpy.float32, numpy.int64, numpy.int32, numpy.bool_]:
5555
data1 = numpy.array([1, 2, 3, 4], dtype=input1_type)
5656
data2 = numpy.array([11, 21, 31, 41], dtype=input2_type)
5757
result = function(data1, data2)

tests/skipped_tests.tbl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,54 +35,42 @@ tests/third_party/intel/test_zero_copy_test1.py::test_dpnp_interaction_with_dpct
3535

3636
tests/test_arraymanipulation.py::TestHstack::test_generator
3737
tests/test_arraymanipulation.py::TestVstack::test_generator
38+
3839
tests/test_dparray.py::test_astype[[]-float64-float64]
3940
tests/test_dparray.py::test_astype[[]-float64-float32]
4041
tests/test_dparray.py::test_astype[[]-float64-int64]
4142
tests/test_dparray.py::test_astype[[]-float64-int32]
4243
tests/test_dparray.py::test_astype[[]-float64-bool]
43-
tests/test_dparray.py::test_astype[[]-float64-bool_]
4444
tests/test_dparray.py::test_astype[[]-float64-complex]
4545
tests/test_dparray.py::test_astype[[]-float32-float64]
4646
tests/test_dparray.py::test_astype[[]-float32-float32]
4747
tests/test_dparray.py::test_astype[[]-float32-int64]
4848
tests/test_dparray.py::test_astype[[]-float32-int32]
4949
tests/test_dparray.py::test_astype[[]-float32-bool]
50-
tests/test_dparray.py::test_astype[[]-float32-bool_]
5150
tests/test_dparray.py::test_astype[[]-float32-complex]
5251
tests/test_dparray.py::test_astype[[]-int64-float64]
5352
tests/test_dparray.py::test_astype[[]-int64-float32]
5453
tests/test_dparray.py::test_astype[[]-int64-int64]
5554
tests/test_dparray.py::test_astype[[]-int64-int32]
5655
tests/test_dparray.py::test_astype[[]-int64-bool]
57-
tests/test_dparray.py::test_astype[[]-int64-bool_]
5856
tests/test_dparray.py::test_astype[[]-int64-complex]
5957
tests/test_dparray.py::test_astype[[]-int32-float64]
6058
tests/test_dparray.py::test_astype[[]-int32-float32]
6159
tests/test_dparray.py::test_astype[[]-int32-int64]
6260
tests/test_dparray.py::test_astype[[]-int32-int32]
6361
tests/test_dparray.py::test_astype[[]-int32-bool]
64-
tests/test_dparray.py::test_astype[[]-int32-bool_]
6562
tests/test_dparray.py::test_astype[[]-int32-complex]
6663
tests/test_dparray.py::test_astype[[]-bool-float64]
6764
tests/test_dparray.py::test_astype[[]-bool-float32]
6865
tests/test_dparray.py::test_astype[[]-bool-int64]
6966
tests/test_dparray.py::test_astype[[]-bool-int32]
7067
tests/test_dparray.py::test_astype[[]-bool-bool]
71-
tests/test_dparray.py::test_astype[[]-bool-bool_]
7268
tests/test_dparray.py::test_astype[[]-bool-complex]
73-
tests/test_dparray.py::test_astype[[]-bool_-float64]
74-
tests/test_dparray.py::test_astype[[]-bool_-float32]
75-
tests/test_dparray.py::test_astype[[]-bool_-int64]
76-
tests/test_dparray.py::test_astype[[]-bool_-int32]
77-
tests/test_dparray.py::test_astype[[]-bool_-bool]
78-
tests/test_dparray.py::test_astype[[]-bool_-bool_]
79-
tests/test_dparray.py::test_astype[[]-bool_-complex]
8069
tests/test_dparray.py::test_astype[[]-complex-float64]
8170
tests/test_dparray.py::test_astype[[]-complex-float32]
8271
tests/test_dparray.py::test_astype[[]-complex-int64]
8372
tests/test_dparray.py::test_astype[[]-complex-int32]
8473
tests/test_dparray.py::test_astype[[]-complex-bool]
85-
tests/test_dparray.py::test_astype[[]-complex-bool_]
8674
tests/test_dparray.py::test_astype[[]-complex-complex]
8775

8876
tests/test_linalg.py::test_cond[None-[[1, 0, -1], [0, 1, 0], [1, 0, 1]]]

0 commit comments

Comments
 (0)