Skip to content

Commit ac54e3f

Browse files
committed
Merge changes for OOC release 0.10.3
Out of cycle release to distribute the fix of #1210 to intel channel on Anaconda. Temporary pin `dpcpp-cpp-rt` on `2022.2.0` version to be able to build DPNP in internal CI.
2 parents e97a9a9 + f9e85b5 commit ac54e3f

File tree

16 files changed

+214
-102
lines changed

16 files changed

+214
-102
lines changed

.github/workflows/conda-package.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ jobs:
169169
strategy:
170170
matrix:
171171
python: ['3.8', '3.9']
172-
dpctl: ['0.13.0']
173172
experimental: [false]
174173

175174
continue-on-error: ${{ matrix.experimental }}
@@ -239,7 +238,7 @@ jobs:
239238
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
240239
241240
- name: Install dpnp
242-
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
241+
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
243242
env:
244243
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
245244

@@ -270,7 +269,6 @@ jobs:
270269
strategy:
271270
matrix:
272271
python: ['3.8', '3.9']
273-
dpctl: ['0.13.0']
274272
experimental: [false]
275273

276274
continue-on-error: ${{ matrix.experimental }}
@@ -344,7 +342,7 @@ jobs:
344342
echo PACKAGE_VERSION: %PACKAGE_VERSION%
345343
(echo PACKAGE_VERSION=%PACKAGE_VERSION%) >> %GITHUB_ENV%
346344
347-
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% dpctl=${{ matrix.dpctl }} python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile
345+
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile
348346
env:
349347
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
350348

@@ -369,7 +367,7 @@ jobs:
369367
- name: Install dpnp
370368
run: |
371369
@echo on
372-
conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
370+
conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
373371
env:
374372
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
375373

conda-recipe/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ requirements:
1212
- cython
1313
- cmake >=3.19
1414
- dpctl >=0.13
15+
- dpcpp-cpp-rt 2022.2.0
1516
- mkl-devel-dpcpp {{ environ.get('MKL_VER', '>=2021.1.1') }}
1617
- tbb-devel
1718
- wheel

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# The short X.Y version
3434
version = '0.10'
3535
# The full version, including alpha/beta/rc tags
36-
release = '0.10.2'
36+
release = '0.10.3'
3737

3838

3939
# -- General configuration ---------------------------------------------------

dpnp/backend/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
2929

30-
# set(DPNP_VERSION 0.10.2)
30+
# set(DPNP_VERSION 0.10.3)
3131
# set(DPNP_API_VERSION 0.10)
3232

3333
# set directory where the custom finders live

dpnp/backend/doc/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "DPNP C++ backend kernel library"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.10.2
41+
PROJECT_NUMBER = 0.10.3
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

dpnp/backend/include/dpnp_iface_fptr.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, 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
@@ -69,7 +69,6 @@ enum class DPNPFuncName : size_t
6969
DPNP_FN_ANY, /**< Used in numpy.any() impl */
7070
DPNP_FN_ANY_EXT, /**< Used in numpy.any() impl, requires extra parameters */
7171
DPNP_FN_ARANGE, /**< Used in numpy.arange() impl */
72-
DPNP_FN_ARANGE_EXT, /**< Used in numpy.arange() impl, requires extra parameters */
7372
DPNP_FN_ARCCOS, /**< Used in numpy.arccos() impl */
7473
DPNP_FN_ARCCOS_EXT, /**< Used in numpy.arccos() impl, requires extra parameters */
7574
DPNP_FN_ARCCOSH, /**< Used in numpy.arccosh() impl */

dpnp/backend/kernels/dpnp_krnl_arraycreation.cpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, 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
@@ -90,18 +90,41 @@ void dpnp_arange_c(size_t start, size_t step, void* result1, size_t size)
9090
size,
9191
dep_event_vec_ref);
9292
DPCTLEvent_WaitAndThrow(event_ref);
93+
DPCTLEvent_Delete(event_ref);
9394
}
9495

9596
template <typename _DataType>
9697
void (*dpnp_arange_default_c)(size_t, size_t, void*, size_t) = dpnp_arange_c<_DataType>;
9798

98-
template <typename _DataType>
99-
DPCTLSyclEventRef (*dpnp_arange_ext_c)(DPCTLSyclQueueRef,
100-
size_t,
101-
size_t,
102-
void*,
103-
size_t,
104-
const DPCTLEventVectorRef) = dpnp_arange_c<_DataType>;
99+
// Explicit instantiation of the function, since dpnp_arange_c() is used by other template functions,
100+
// but implicit instantiation is not applied anymore.
101+
template DPCTLSyclEventRef dpnp_arange_c<int32_t>(DPCTLSyclQueueRef,
102+
size_t,
103+
size_t,
104+
void*,
105+
size_t,
106+
const DPCTLEventVectorRef);
107+
108+
template DPCTLSyclEventRef dpnp_arange_c<int64_t>(DPCTLSyclQueueRef,
109+
size_t,
110+
size_t,
111+
void*,
112+
size_t,
113+
const DPCTLEventVectorRef);
114+
115+
template DPCTLSyclEventRef dpnp_arange_c<float>(DPCTLSyclQueueRef,
116+
size_t,
117+
size_t,
118+
void*,
119+
size_t,
120+
const DPCTLEventVectorRef);
121+
122+
template DPCTLSyclEventRef dpnp_arange_c<double>(DPCTLSyclQueueRef,
123+
size_t,
124+
size_t,
125+
void*,
126+
size_t,
127+
const DPCTLEventVectorRef);
105128

106129
template <typename _DataType>
107130
DPCTLSyclEventRef dpnp_diag_c(DPCTLSyclQueueRef q_ref,
@@ -1287,11 +1310,6 @@ void func_map_init_arraycreation(func_map_t& fmap)
12871310
fmap[DPNPFuncName::DPNP_FN_ARANGE][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_arange_default_c<float>};
12881311
fmap[DPNPFuncName::DPNP_FN_ARANGE][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_arange_default_c<double>};
12891312

1290-
fmap[DPNPFuncName::DPNP_FN_ARANGE_EXT][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_arange_ext_c<int32_t>};
1291-
fmap[DPNPFuncName::DPNP_FN_ARANGE_EXT][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_arange_ext_c<int64_t>};
1292-
fmap[DPNPFuncName::DPNP_FN_ARANGE_EXT][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_arange_ext_c<float>};
1293-
fmap[DPNPFuncName::DPNP_FN_ARANGE_EXT][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_arange_ext_c<double>};
1294-
12951313
fmap[DPNPFuncName::DPNP_FN_DIAG][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_diag_default_c<int32_t>};
12961314
fmap[DPNPFuncName::DPNP_FN_DIAG][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_diag_default_c<int64_t>};
12971315
fmap[DPNPFuncName::DPNP_FN_DIAG][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_diag_default_c<float>};

dpnp/dparray.pyx

Lines changed: 63 additions & 3 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-2022, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -33,23 +33,77 @@ using USB interface for an Intel GPU device.
3333
3434
"""
3535

36+
import warnings
3637

3738
from libcpp cimport bool as cpp_bool
3839

3940
from dpnp.dpnp_iface_types import *
40-
from dpnp.dpnp_iface import *
41+
42+
# It's prohibeted to use 'import *' from 'dpnp.dpnp_iface_arraycreation' module here,
43+
# because module has 'array' function, but cython has already imported 'array' by default.
44+
# It would cause import collision. Thus instead import each function explicitly.
45+
from dpnp.dpnp_iface_arraycreation import (
46+
arange,
47+
array,
48+
asanyarray,
49+
asarray,
50+
ascontiguousarray,
51+
copy,
52+
diag,
53+
diagflat,
54+
empty,
55+
empty_like,
56+
eye,
57+
frombuffer,
58+
fromfile,
59+
fromfunction,
60+
fromiter,
61+
fromstring,
62+
full,
63+
full_like,
64+
geomspace,
65+
identity,
66+
linspace,
67+
loadtxt,
68+
logspace,
69+
meshgrid,
70+
mgrid,
71+
ogrid,
72+
ones,
73+
ones_like,
74+
ptp,
75+
trace,
76+
tri,
77+
tril,
78+
triu,
79+
vander,
80+
zeros,
81+
zeros_like
82+
)
83+
from dpnp.dpnp_iface_bitwise import *
84+
from dpnp.dpnp_iface_counting import *
85+
from dpnp.dpnp_iface_indexing import *
86+
from dpnp.dpnp_iface_libmath import *
87+
from dpnp.dpnp_iface_linearalgebra import *
88+
from dpnp.dpnp_iface_logic import *
89+
from dpnp.dpnp_iface_manipulation import *
90+
from dpnp.dpnp_iface_mathematical import *
91+
from dpnp.dpnp_iface_searching import *
92+
from dpnp.dpnp_iface_sorting import *
93+
from dpnp.dpnp_iface_statistics import *
94+
from dpnp.dpnp_iface_trigonometric import *
4195

4296
# to avoid interference with Python internal functions
4397
from dpnp.dpnp_iface import sum as iface_sum
4498
from dpnp.dpnp_iface import prod as iface_prod
4599
from dpnp.dpnp_iface import get_dpnp_descriptor as iface_get_dpnp_descriptor
46100

47-
from dpnp.dpnp_algo cimport *
48101
from dpnp.dpnp_iface_statistics import min, max # TODO do the same as for iface_sum
49102
from dpnp.dpnp_iface_logic import all, any # TODO do the same as for iface_sum
50103
import numpy
51104
cimport numpy
52105

106+
from dpnp.dpnp_algo cimport *
53107
cimport dpnp.dpnp_utils as utils
54108

55109

@@ -124,6 +178,12 @@ cdef class dparray:
124178

125179
"""
126180
181+
with warnings.catch_warnings():
182+
warnings.filterwarnings("default", category=DeprecationWarning)
183+
warnings.warn("dpnp.dparray class is deprecated, use dpnp.dpnp_array class instead",
184+
DeprecationWarning,
185+
stacklevel=2)
186+
127187
def __init__(self, shape, dtype=float64, memptr=None, strides=None, order=b'C'):
128188
cdef Py_ssize_t shape_it = 0
129189
cdef Py_ssize_t strides_it = 0

dpnp/dpnp_algo/dpnp_algo.pxd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ cdef extern from "dpnp_iface_fptr.hpp" namespace "DPNPFuncName": # need this na
4545
DPNP_FN_ANY
4646
DPNP_FN_ANY_EXT
4747
DPNP_FN_ARANGE
48-
DPNP_FN_ARANGE_EXT
4948
DPNP_FN_ARCCOS
5049
DPNP_FN_ARCCOS_EXT
5150
DPNP_FN_ARCCOSH
@@ -519,7 +518,6 @@ cpdef dpnp_descriptor dpnp_matmul(dpnp_descriptor in_array1, dpnp_descriptor in_
519518
"""
520519
Array creation routines
521520
"""
522-
cpdef dpnp_descriptor dpnp_arange(start, stop, step, dtype)
523521
cpdef dpnp_descriptor dpnp_init_val(shape, dtype, value)
524522
cpdef dpnp_descriptor dpnp_full(result_shape, value_in, result_dtype) # same as dpnp_init_val
525523
cpdef dpnp_descriptor dpnp_copy(dpnp_descriptor x1)

dpnp/dpnp_algo/dpnp_algo.pyx

Lines changed: 1 addition & 38 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-2022, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,6 @@ import numpy
5050

5151

5252
__all__ = [
53-
"dpnp_arange",
5453
"dpnp_astype",
5554
"dpnp_flatten",
5655
"dpnp_init_val",
@@ -74,9 +73,6 @@ include "dpnp_algo_statistics.pyx"
7473
include "dpnp_algo_trigonometric.pyx"
7574

7675

77-
ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_arange_t)(c_dpctl.DPCTLSyclQueueRef,
78-
size_t, size_t, void *, size_t,
79-
const c_dpctl.DPCTLEventVectorRef)
8076
ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_astype_t)(c_dpctl.DPCTLSyclQueueRef,
8177
const void *, void * , const size_t,
8278
const c_dpctl.DPCTLEventVectorRef)
@@ -92,39 +88,6 @@ ctypedef c_dpctl.DPCTLSyclEventRef(*fptr_dpnp_initval_t)(c_dpctl.DPCTLSyclQueueR
9288
const c_dpctl.DPCTLEventVectorRef)
9389

9490

95-
cpdef utils.dpnp_descriptor dpnp_arange(start, stop, step, dtype):
96-
obj_len = int(numpy.ceil((stop - start) / step))
97-
if obj_len < 0:
98-
raise ValueError(f"DPNP dpnp_arange(): Negative array size (start={start},stop={stop},step={step})")
99-
100-
cdef tuple obj_shape = utils._object_to_tuple(obj_len)
101-
102-
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(dtype)
103-
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_ARANGE_EXT, param1_type, param1_type)
104-
105-
cdef utils.dpnp_descriptor result = utils.create_output_descriptor(obj_shape, kernel_data.return_type, None)
106-
107-
# for i in range(result.size):
108-
# result[i] = start + i
109-
110-
result_sycl_queue = result.get_array().sycl_queue
111-
112-
cdef c_dpctl.SyclQueue q = <c_dpctl.SyclQueue> result_sycl_queue
113-
cdef c_dpctl.DPCTLSyclQueueRef q_ref = q.get_queue_ref()
114-
115-
cdef fptr_dpnp_arange_t func = <fptr_dpnp_arange_t > kernel_data.ptr
116-
cdef c_dpctl.DPCTLSyclEventRef event_ref = func(q_ref,
117-
start,
118-
step,
119-
result.get_data(),
120-
result.size,
121-
NULL) # dep_events_ref)
122-
with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
123-
c_dpctl.DPCTLEvent_Delete(event_ref)
124-
125-
return result
126-
127-
12891
cpdef utils.dpnp_descriptor dpnp_astype(utils.dpnp_descriptor x1, dtype):
12992
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(x1.dtype)
13093
cdef DPNPFuncType param2_type = dpnp_dtype_to_DPNPFuncType(dtype)

dpnp/dpnp_container.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,43 @@
3434
"""
3535

3636

37+
import dpctl.utils as dpu
3738
import dpctl.tensor as dpt
3839

3940
from dpnp.dpnp_array import dpnp_array
4041
import dpnp
4142

4243

4344
__all__ = [
45+
"arange",
4446
"asarray",
4547
"empty",
4648
]
4749

4850

51+
def arange(start,
52+
/,
53+
stop=None,
54+
step=1,
55+
*,
56+
dtype=None,
57+
device=None,
58+
usm_type="device",
59+
sycl_queue=None):
60+
"""Validate input parameters before passing them into `dpctl.tensor` module"""
61+
dpu.validate_usm_type(usm_type, allow_none=False)
62+
sycl_queue_normalized = dpnp.get_normalized_queue_device(sycl_queue=sycl_queue, device=device)
63+
64+
array_obj = dpt.arange(start,
65+
stop=stop,
66+
step=step,
67+
dtype=dtype,
68+
usm_type=usm_type,
69+
sycl_queue=sycl_queue_normalized)
70+
71+
return dpnp_array(array_obj.shape, buffer=array_obj)
72+
73+
4974
def asarray(x1,
5075
dtype=None,
5176
copy=False,

0 commit comments

Comments
 (0)