Skip to content

Commit bdeaf12

Browse files
authored
Merge branch 'master' into exception_on_numpy_fallback
2 parents aa3e191 + ebe4f2a commit bdeaf12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3277
-1129
lines changed

.github/workflows/build-sphinx.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ jobs:
7171

7272
- name: Install dpnp dependencies
7373
run: |
74-
conda install dpctl mkl-devel-dpcpp tbb-devel dpcpp_linux-64 cmake cython pytest \
75-
-c dppy/label/dev -c intel -c conda-forge
74+
conda install dpctl mkl-devel-dpcpp onedpl-devel tbb-devel dpcpp_linux-64 \
75+
cmake cython pytest -c dppy/label/dev -c intel -c conda-forge
7676
7777
- name: Install cuPy dependencies
7878
run: conda install -c conda-forge cupy cudatoolkit=10.0
@@ -84,7 +84,7 @@ jobs:
8484
8585
- name: Build library
8686
run: |
87-
DPLROOT=/opt/intel/oneapi/dpl/latest python setup.py build_clib
87+
python setup.py build_clib
8888
CC=dpcpp python setup.py build_ext --inplace
8989
python setup.py develop
9090

.github/workflows/conda-package.yml

+10-26
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ jobs:
4040
with:
4141
fetch-depth: 0
4242

43-
- name: Checkout oneDPL
44-
uses: actions/[email protected]
45-
with:
46-
repository: oneapi-src/oneDPL
47-
path: oneDPL
48-
ref: oneDPL-2021.7.0-release
49-
5043
- name: Setup miniconda
5144
uses: conda-incubator/[email protected]
5245
with:
@@ -76,8 +69,6 @@ jobs:
7669
7770
- name: Build conda package
7871
run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe
79-
env:
80-
DPLROOT: '${{ github.workspace }}/oneDPL'
8172

8273
- name: Upload artifact
8374
uses: actions/[email protected]
@@ -110,13 +101,6 @@ jobs:
110101
with:
111102
fetch-depth: 0
112103

113-
- name: Checkout oneDPL
114-
uses: actions/[email protected]
115-
with:
116-
repository: oneapi-src/oneDPL
117-
path: oneDPL
118-
ref: oneDPL-2021.7.0-release
119-
120104
- name: Setup miniconda
121105
uses: conda-incubator/[email protected]
122106
with:
@@ -148,8 +132,6 @@ jobs:
148132

149133
- name: Build conda package
150134
run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe
151-
env:
152-
DPLROOT: '%GITHUB_WORKSPACE%\oneDPL'
153135

154136
- name: Upload artifact
155137
uses: actions/[email protected]
@@ -169,7 +151,6 @@ jobs:
169151
strategy:
170152
matrix:
171153
python: ['3.8', '3.9']
172-
dpctl: ['0.13.0']
173154
experimental: [false]
174155

175156
continue-on-error: ${{ matrix.experimental }}
@@ -239,7 +220,7 @@ jobs:
239220
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
240221
241222
- name: Install dpnp
242-
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
223+
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
243224
env:
244225
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
245226

@@ -248,12 +229,15 @@ jobs:
248229

249230
- name: Smoke test
250231
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"
232+
env:
233+
OCL_ICD_FILENAMES: 'libintelocl.so'
251234

252235
# TODO: run the whole scope once the issues on CPU are resolved
253236
- name: Run tests
254-
run: python -m pytest -q -ra --disable-warnings -vv test_arraycreation.py test_dparray.py test_mathematical.py test_special.py
237+
run: |
238+
python -m pytest -q -ra --disable-warnings -vv test_arraycreation.py test_dparray.py test_fft.py test_linalg.py test_mathematical.py test_random_state.py test_special.py
255239
env:
256-
SYCL_ENABLE_HOST_DEVICE: '1'
240+
OCL_ICD_FILENAMES: 'libintelocl.so'
257241
working-directory: ${{ env.tests-path }}
258242

259243
test_windows:
@@ -268,7 +252,6 @@ jobs:
268252
strategy:
269253
matrix:
270254
python: ['3.8', '3.9']
271-
dpctl: ['0.13.0']
272255
experimental: [false]
273256

274257
continue-on-error: ${{ matrix.experimental }}
@@ -342,7 +325,7 @@ jobs:
342325
echo PACKAGE_VERSION: %PACKAGE_VERSION%
343326
(echo PACKAGE_VERSION=%PACKAGE_VERSION%) >> %GITHUB_ENV%
344327
345-
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% dpctl=${{ matrix.dpctl }} python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile
328+
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} ${{ env.TEST_CHANNELS }} --only-deps --dry-run > lockfile
346329
env:
347330
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
348331

@@ -367,7 +350,7 @@ jobs:
367350
- name: Install dpnp
368351
run: |
369352
@echo on
370-
conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} dpctl=${{ matrix.dpctl }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
353+
conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
371354
env:
372355
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
373356

@@ -426,7 +409,8 @@ jobs:
426409

427410
# TODO: run the whole scope once the issues on CPU are resolved
428411
- name: Run tests
429-
run: python -m pytest -q -ra --disable-warnings -vv test_arraycreation.py test_dparray.py test_mathematical.py test_special.py
412+
run: |
413+
python -m pytest -q -ra --disable-warnings -vv test_arraycreation.py test_dparray.py test_fft.py test_linalg.py test_mathematical.py test_random_state.py test_special.py
430414
working-directory: ${{ env.tests-path }}
431415

432416
upload_linux:

0.build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd ${THEDIR}
77
export DPNP_DEBUG=1
88

99
python setup.py clean
10-
DPLROOT=/opt/intel/oneapi/dpl/latest python setup.py build_clib
10+
python setup.py build_clib
1111

1212
# inplace build
1313
CC=dpcpp python setup.py build_ext --inplace

conda-recipe/meta.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ requirements:
88
host:
99
- python
1010
- setuptools
11-
- numpy >=1.19,<1.22a0
11+
- numpy >=1.19,<1.23a0
1212
- cython
1313
- cmake >=3.19
1414
- dpctl >=0.13
1515
- mkl-devel-dpcpp {{ environ.get('MKL_VER', '>=2021.1.1') }}
16+
- onedpl-devel
1617
- tbb-devel
1718
- wheel
1819
build:

doc/conf.py

+1-1
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/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
from dpnp.dpnp_array import dpnp_array as ndarray
4646
from dpnp.dpnp_flatiter import flatiter as flatiter
4747

48+
from dpnp.dpnp_iface_types import *
4849
from dpnp.dpnp_iface import *
4950
from dpnp.dpnp_iface import __all__ as _iface__all__
50-
from dpnp.dpnp_iface_types import *
5151
from dpnp.version import __version__
5252

5353

dpnp/backend/CMakeLists.txt

+2-1
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
@@ -218,6 +218,7 @@ set(DPNP_SRC
218218
src/memory_sycl.cpp
219219
src/queue_sycl.cpp
220220
src/verbose.cpp
221+
src/dpnp_random_state.cpp
221222
)
222223

223224
if(DPNP_STATIC_LIB_ENABLE)

dpnp/backend/doc/Doxyfile

+1-1
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

+1-3
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 */
@@ -315,7 +314,6 @@ enum class DPNPFuncName : size_t
315314
DPNP_FN_RNG_STANDARD_GAMMA, /**< Used in numpy.random.standard_gamma() impl */
316315
DPNP_FN_RNG_STANDARD_GAMMA_EXT, /**< Used in numpy.random.standard_gamma() impl, requires extra parameters */
317316
DPNP_FN_RNG_STANDARD_NORMAL, /**< Used in numpy.random.standard_normal() impl */
318-
DPNP_FN_RNG_STANDARD_NORMAL_EXT, /**< Used in numpy.random.standard_normal() impl */
319317
DPNP_FN_RNG_STANDARD_T, /**< Used in numpy.random.standard_t() impl */
320318
DPNP_FN_RNG_STANDARD_T_EXT, /**< Used in numpy.random.standard_t() impl, requires extra parameters */
321319
DPNP_FN_RNG_TRIANGULAR, /**< Used in numpy.random.triangular() impl */

dpnp/backend/include/dpnp_iface_random.hpp

+16-18
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
@@ -438,18 +438,20 @@ INP_DLLEXPORT void
438438
* @brief math library implementation of random number generator (normal continious distribution)
439439
*
440440
* @param [in] q_ref Reference to SYCL queue.
441-
* @param [out] result Output array.
441+
* @param [out] result_out Output array.
442442
* @param [in] mean Mean value.
443443
* @param [in] stddev Standard deviation.
444444
* @param [in] size Number of elements in `result` arrays.
445+
* @param [in] random_state_in Pointer on random state.
445446
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
446447
*/
447448
template <typename _DataType>
448449
INP_DLLEXPORT DPCTLSyclEventRef dpnp_rng_normal_c(DPCTLSyclQueueRef q_ref,
449-
void* result,
450-
const _DataType mean,
451-
const _DataType stddev,
452-
const size_t size,
450+
void* result_out,
451+
const double mean,
452+
const double stddev,
453+
const int64_t size,
454+
void* random_state_in,
453455
const DPCTLEventVectorRef dep_event_vec_ref);
454456

455457
template <typename _DataType>
@@ -629,17 +631,11 @@ INP_DLLEXPORT void dpnp_rng_standard_gamma_c(void* result, const _DataType shape
629631
* @brief math library implementation of random number generator (standard normal distribution)
630632
*
631633
* @param [in] q_ref Reference to SYCL queue.
632-
* @param [out] result Output array.
634+
* @param [out] result_out Output array.
633635
* @param [in] size Number of elements in `result` arrays.
634636
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
635637
*/
636638
template <typename _DataType>
637-
INP_DLLEXPORT DPCTLSyclEventRef dpnp_rng_standard_normal_c(DPCTLSyclQueueRef q_ref,
638-
void* result,
639-
const size_t size,
640-
const DPCTLEventVectorRef dep_event_vec_ref);
641-
642-
template <typename _DataType>
643639
INP_DLLEXPORT void dpnp_rng_standard_normal_c(void* result, const size_t size);
644640

645641
/**
@@ -692,18 +688,20 @@ INP_DLLEXPORT void dpnp_rng_triangular_c(
692688
* @brief math library implementation of random number generator (uniform distribution)
693689
*
694690
* @param [in] q_ref Reference to SYCL queue.
695-
* @param [out] result Output array.
691+
* @param [out] result_out Output array.
696692
* @param [in] low Left bound of array values.
697693
* @param [in] high Right bound of array values.
698694
* @param [in] size Number of elements in `result` array.
695+
* @param [in] random_state_in Pointer on random state.
699696
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
700697
*/
701698
template <typename _DataType>
702699
INP_DLLEXPORT DPCTLSyclEventRef dpnp_rng_uniform_c(DPCTLSyclQueueRef q_ref,
703-
void* result,
704-
const long low,
705-
const long high,
706-
const size_t size,
700+
void* result_out,
701+
const double low,
702+
const double high,
703+
const int64_t size,
704+
void* random_state_in,
707705
const DPCTLEventVectorRef dep_event_vec_ref);
708706

709707
template <typename _DataType>

dpnp/backend/kernels/dpnp_krnl_arraycreation.cpp

+31-13
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>};

0 commit comments

Comments
 (0)