Skip to content

Commit b7ff36e

Browse files
Merge branch 'master' into feature/elem-wise-strides
2 parents dd2f9a0 + c7e0b6d commit b7ff36e

35 files changed

+1368
-1110
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
uses: conda-incubator/setup-miniconda@v2
4646
with:
4747
activate-environment: dpnp
48-
python-version: 3.7
48+
python-version: 3.8
49+
channels: intel,conda-forge
4950
auto-activate-base: false
5051
- name: Conda info
5152
shell: bash -l {0}
@@ -55,22 +56,26 @@ jobs:
5556
- name: Install sphinx dependencies
5657
shell: bash -l {0}
5758
run: |
58-
conda install numpy cython sphinx sphinx_rtd_theme wheel
59+
conda install sphinx sphinx_rtd_theme
60+
- name: Install dpnp dependencies
61+
shell: bash -l {0}
62+
run: |
63+
conda install dpctl mkl-devel-dpcpp tbb-devel dpcpp_linux-64 cmake=3.19 cython pytest \
64+
-c dppy/label/dev -c intel -c conda-forge
5965
- name: Install cuPy dependencies
6066
shell: bash -l {0}
6167
run: |
6268
conda install -c conda-forge cupy cudatoolkit=10.0
6369
- name: Build library
6470
shell: bash -l {0}
6571
run: |
66-
. /opt/intel/oneapi/setvars.sh
67-
. ./scripts/install_cmake_lin.sh
68-
./0.build.sh
72+
python setup.py build_clib
73+
CC=dpcpp python setup.py build_ext --inplace
74+
python setup.py develop
6975
- name: Build docs
7076
shell: bash -l {0}
7177
run: |
72-
. /opt/intel/oneapi/setvars.sh
73-
./0.builddoc.sh
78+
make html
7479
working-directory: doc
7580
# https://github.com/marketplace/actions/doxygen-action
7681
- name: Build backend docs

0.build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22
THEDIR=$(dirname $(readlink -e ${BASH_SOURCE[0]}))
33

4-
. ${THEDIR}/0.env.sh
4+
# . ${THEDIR}/0.env.sh
55
cd ${THEDIR}
66

77
export DPNP_DEBUG=1
88

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

1212
# inplace build
13-
python setup.py build_ext --inplace
13+
CC=dpcpp python setup.py build_ext --inplace
1414

1515
# development build. Root privileges needed
1616
# python setup.py develop

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![codecov](https://codecov.io/gh/IntelPython/dpnp/branch/master/graph/badge.svg)](https://codecov.io/gh/IntelPython/dpnp)
33
[![Build Sphinx](https://github.com/IntelPython/dpnp/workflows/Build%20Sphinx/badge.svg)](https://intelpython.github.io/dpnp)
44

5-
# DPNP: NumPy-like API accelerated with SYCL
5+
# DPNP: NumPy Drop-In Replacement for Intel(R) XPU
66
[API coverage summary](https://intelpython.github.io/dpnp/reference/comparison.html#summary)
77

88
[Full documentation](https://intelpython.github.io/dpnp/)

conda-recipe/activate_env.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

conda-recipe/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# if ONEAPI_ROOT is specified (use all from it)
44
if [ -n "${ONEAPI_ROOT}" ]; then
55
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
6-
# TODO uncomment when CI will be changed
7-
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
6+
export MKLROOT=${ONEAPI_ROOT}/mkl/latest
87
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
8+
export DPLROOT=${ONEAPI_ROOT}/dpl/latest
99
fi
1010

1111
# if DPCPPROOT is specified (work with custom DPCPP)

conda-recipe/meta.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ requirements:
88
host:
99
- python
1010
- setuptools
11-
- numpy >=1.15 # [win or osx or py>=38]
12-
- numpy 1.17 # [linux and py==37]
11+
- numpy 1.19.5
1312
- cython
14-
- cmake >=3.16.5
15-
- dpctl >=0.5.0a0
13+
- cmake 3.19
14+
- dpctl >=0.10
1615
- mkl-devel-dpcpp
1716
- tbb-devel
1817
- wheel
1918
build:
2019
- {{ compiler('dpcpp') }}
2120
run:
2221
- python
23-
- dpctl >=0.5.0a0
22+
- dpctl >=0.10
2423
- dpcpp_cpp_rt >=2021.1.1
2524
- mkl >=2021.1.1
2625
- mkl-dpcpp >=2021.1.1
@@ -30,10 +29,11 @@ build:
3029
number: {{ GIT_DESCRIBE_NUMBER }}
3130
include_recipe: False
3231
script_env:
33-
- _ONEAPI_ROOT # renamed for ignore in CI
34-
- _DPCPPROOT # renamed for ignore in CI
32+
- ONEAPI_ROOT
33+
- DPCPPROOT
3534
- MKLROOT
3635
- TBBROOT
36+
- DPLROOT
3737
- WHEELS_OUTPUT_FOLDER
3838

3939
test:

conda-recipe/run_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# if ONEAPI_ROOT is specified (use all from it)
44
if [ -n "${ONEAPI_ROOT}" ]; then
55
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
6-
# TODO uncomment when CI will be changed
7-
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
6+
export MKLROOT=${ONEAPI_ROOT}/mkl/latest
87
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
8+
export DPLROOT=${ONEAPI_ROOT}/dpl/latest
99
fi
1010

1111
# if DPCPPROOT is specified (work with custom DPCPP)

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
author = 'Intel'
3232

3333
# The short X.Y version
34-
version = '0.8'
34+
version = '0.9'
3535
# The full version, including alpha/beta/rc tags
36-
release = '0.8.0'
36+
release = '0.9.0'
3737

3838

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

dpnp/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
if "numpy" in sys.modules:
4141
warnings.warn("\nDPNP: Module NumPy found. Please load DPNP module before NumPy.\n")
4242

43-
from dpnp.dparray import dparray as ndarray
43+
# from dpnp.dparray import dparray as ndarray
44+
from dpnp.dpnp_array import dpnp_array as ndarray
45+
from dpnp.dpnp_flatiter import flatiter as flatiter
46+
4447
from dpnp.dpnp_iface import *
4548
from dpnp.dpnp_iface import __all__ as _iface__all__
4649
from dpnp.dpnp_iface_types import *

dpnp/backend/CMakeLists.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
2929

30-
# set(DPNP_VERSION 0.8.0)
31-
# set(DPNP_API_VERSION 0.8)
30+
# set(DPNP_VERSION 0.9.0)
31+
# set(DPNP_API_VERSION 0.9)
3232

3333
# set directory where the custom finders live
3434
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
@@ -38,14 +38,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
3838
# -----------------------------------------------------------------------------------------------
3939
if(DEFINED ENV{ONEAPI_ROOT})
4040
set(DPNP_ONEAPI_ROOT "$ENV{ONEAPI_ROOT}" CACHE PATH "Folder contains oneapi tool set")
41-
else()
42-
if(UNIX)
43-
set(DPNP_ONEAPI_ROOT "/opt/intel/oneapi" CACHE PATH "Folder contains oneapi tool set")
44-
elseif(WIN32)
45-
set(DPNP_ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI" CACHE PATH "Folder contains oneapi tool set")
46-
else()
47-
message(FATAL_ERROR "Unsupported system ${CMAKE_SYSTEM}")
48-
endif()
4941
endif()
5042

5143
option(DPNP_STATIC_LIB_ENABLE "Enable build DPNP static library" FALSE)
@@ -253,8 +245,8 @@ target_link_libraries(dpnp_backend_c PUBLIC ${DPNP_MATHLIB_DEP_LIBS})
253245

254246
# Parallel STL from DPC++
255247
if(NOT WIN32)
256-
find_package(PSTL REQUIRED)
257-
target_include_directories(dpnp_backend_c PUBLIC ${PSTL_INCLUDE_DIR})
248+
find_package(DPL REQUIRED)
249+
target_include_directories(dpnp_backend_c PUBLIC ${DPL_INCLUDE_DIR})
258250
endif()
259251

260252
# SYCL queue manager

dpnp/backend/cmake/Modules/FindPSTL.cmake renamed to dpnp/backend/cmake/Modules/FindDPL.cmake

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,30 @@
2424
# *****************************************************************************
2525

2626
# The following variables are optionally searched for defaults
27-
# PSTL_ROOT_DIR: Base directory where all components are found
27+
# DPLROOT: Environment variable to specify custom search place
28+
# ONEAPI_ROOT: Environment variable to specify search place from oneAPI
2829
#
2930
# The following are set after configuration is done:
30-
# PSTL_FOUND
31-
# PSTL_INCLUDE_DIR
31+
# DPL_FOUND
32+
# DPL_INCLUDE_DIR
3233

3334
include(FindPackageHandleStandardArgs)
3435

35-
set(PSTL_ROOT_DIR
36-
"${DPNP_ONEAPI_ROOT}/dpl"
37-
CACHE PATH "Folder contains PSTL headers")
36+
set(DPNP_ONEAPI_DPL "$ENV{DPNP_ONEAPI_ROOT}/dpl/latest" CACHE PATH "Folder contains DPL files from ONEAPI_ROOT")
37+
38+
if(DEFINED ENV{DPLROOT})
39+
set(DPNP_DPLROOT "$ENV{DPLROOT}" CACHE PATH "Folder contains DPL files from DPLROOT")
40+
endif()
3841

3942
find_path(
40-
PSTL_INCLUDE_DIR oneapi/dpl/algorithm
41-
HINTS ENV CONDA_PREFIX ${PSTL_ROOT_DIR} # search order is important
42-
PATH_SUFFIXES include latest/linux/include
43-
DOC "Path to PSTL include files")
43+
DPL_INCLUDE_DIR oneapi/dpl/algorithm
44+
HINTS ${DPNP_DPLROOT} ${DPNP_ONEAPI_DPL} ENV CONDA_PREFIX ENV PREFIX # search order is important
45+
PATH_SUFFIXES include linux/include
46+
DOC "Path to DPL include files")
4447

45-
find_package_handle_standard_args(PSTL DEFAULT_MSG PSTL_INCLUDE_DIR)
48+
find_package_handle_standard_args(DPL DEFAULT_MSG DPL_INCLUDE_DIR)
4649

47-
if(PSTL_FOUND)
48-
message(STATUS "Found PSTL: (include: ${PSTL_INCLUDE_DIR})")
49-
# mark_as_advanced(PSTL_ROOT_DIR PSTL_INCLUDE_DIR)
50+
if(DPL_FOUND)
51+
message(STATUS "Found DPL: (include: ${DPL_INCLUDE_DIR})")
52+
# mark_as_advanced(DPNP_DPLROOT DPL_INCLUDE_DIR)
5053
endif()

dpnp/backend/cmake/Modules/FindMathLib.cmake

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
# *****************************************************************************
2525

2626
# The following variables are optionally searched for defaults
27-
# MATHLIB_ROOT_DIR: Base directory where all components are found
27+
# MKLROOT: Environment variable to specify custom search place
28+
# ONEAPI_ROOT: Environment variable to specify search place from oneAPI
2829
#
2930
# The following are set after configuration is done:
3031
# MATHLIB_FOUND
@@ -33,9 +34,11 @@
3334

3435
include(FindPackageHandleStandardArgs)
3536

36-
set(MATHLIB_ROOT_DIR
37-
"${DPNP_ONEAPI_ROOT}/mkl"
38-
CACHE PATH "Folder contains mathlib")
37+
set(DPNP_ONEAPI_MKL "$ENV{DPNP_ONEAPI_ROOT}/mkl/latest" CACHE PATH "Folder contains Math Lib files from ONEAPI_ROOT")
38+
39+
if(DEFINED ENV{MKLROOT})
40+
set(DPNP_MKLROOT "$ENV{MKLROOT}" CACHE PATH "Folder contains Math Lib files from MKLROOT")
41+
endif()
3942

4043
if(UNIX)
4144
set(MATHLIB_SYCL_LIB
@@ -51,14 +54,14 @@ endif()
5154

5255
find_path(
5356
MATHLIB_INCLUDE_DIR oneapi/mkl.hpp
54-
HINTS ENV CONDA_PREFIX ENV PREFIX ${MATHLIB_ROOT_DIR} # search order is important
55-
PATH_SUFFIXES include latest/include
57+
HINTS ${DPNP_MKLROOT} ${DPNP_ONEAPI_MKL} ENV CONDA_PREFIX ENV PREFIX # search order is important
58+
PATH_SUFFIXES include include
5659
DOC "Path to mathlib include files")
5760

5861
find_path(
5962
MATHLIB_LIBRARY_DIR ${MATHLIB_SYCL_LIB}
60-
HINTS ENV CONDA_PREFIX ENV PREFIX ${MATHLIB_ROOT_DIR} # search order is important
61-
PATH_SUFFIXES lib latest/lib/intel64
63+
HINTS ${DPNP_MKLROOT} ${DPNP_ONEAPI_MKL} ENV CONDA_PREFIX ENV PREFIX # search order is important
64+
PATH_SUFFIXES lib lib/intel64
6265
DOC "Path to mathlib library files")
6366

6467
# TODO implement recurcive searching file (GLOB_RECURSE MY_PATH "/opt/intel/*/mkl.hpp")
@@ -68,5 +71,5 @@ find_package_handle_standard_args(MathLib DEFAULT_MSG MATHLIB_INCLUDE_DIR MATHLI
6871

6972
if(MathLib_FOUND)
7073
message(STATUS "Found MathLib: (include: ${MATHLIB_INCLUDE_DIR}, library: ${MATHLIB_LIBRARY_DIR})")
71-
mark_as_advanced(MATHLIB_ROOT_DIR MATHLIB_INCLUDE_DIR MATHLIB_LIBRARY_DIR)
74+
# mark_as_advanced(DPNP_MKLROOT MATHLIB_INCLUDE_DIR MATHLIB_LIBRARY_DIR)
7275
endif()

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.8.0
41+
PROJECT_NUMBER = 0.9.0
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/kernels/dpnp_krnl_common.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ cl::sycl::event dot(cl::sycl::queue& queue,
8484
size_t input1_strides,
8585
size_t input2_strides,
8686
size_t size,
87-
const cl::sycl::vector_class<cl::sycl::event>& dependencies = {})
87+
const std::vector<cl::sycl::event>& dependencies = {})
8888
{
8989
(void)dependencies;
9090

@@ -326,9 +326,7 @@ void dpnp_dot_c(void* result_out,
326326
}
327327
}
328328

329-
// deprecated? can be replaced with std::vector<cl::sycl::event>
330-
cl::sycl::vector_class<cl::sycl::event> dot_events;
331-
// std::vector<cl::sycl::event> dot_events;
329+
std::vector<cl::sycl::event> dot_events;
332330
dot_events.reserve(result_size);
333331

334332
size_t dot_st1 = ext_input1_strides[ext_input1_ndim - 1];
@@ -407,6 +405,15 @@ void dpnp_eig_c(const void* array_in, void* result1, void* result2, size_t size)
407405
const std::int64_t scratchpad_size = mkl_lapack::syevd_scratchpad_size<double>(
408406
DPNP_QUEUE, oneapi::mkl::job::vec, oneapi::mkl::uplo::upper, size, lda);
409407

408+
// https://github.com/IntelPython/dpnp/issues/1005
409+
// Test tests/test_linalg.py::test_eig_arange raises 2 issues in dpnp_eig_c on CPU
410+
// 1. Call of mkl_lapack::syevd_scratchpad_size<double> returns wrong value that causes out of memory issue.
411+
// 2. Call of the function oneapi::mkl::lapack::syevd causes segfault.
412+
// Example of the command to reproduce the issues:
413+
// SYCL_DEVICE_FILTER=cpu pytest tests/test_linalg.py::test_eig_arange[2-float64]
414+
// High-level reason of the issues is numpy is imported before dpnp in third party tests.
415+
// Low-level reason of the issues could be related to MKL runtime library loaded during numpy import.
416+
410417
double* scratchpad = reinterpret_cast<double*>(dpnp_memory_alloc_c(scratchpad_size * sizeof(double)));
411418

412419
event = mkl_lapack::syevd(DPNP_QUEUE, // queue
@@ -564,9 +571,9 @@ void dpnp_matmul_c(void* result_out,
564571
}
565572

566573
cl::sycl::event event;
567-
DPNPC_ptr_adapter<_DataType> input1_ptr(input1_in, size_m * size_k, true);
568-
DPNPC_ptr_adapter<_DataType> input2_ptr(input2_in, size_k * size_n, true);
569-
DPNPC_ptr_adapter<_DataType> result_ptr(result_out, size_m * size_n, true, true);
574+
DPNPC_ptr_adapter<_DataType> input1_ptr(input1_in, size_m * size_k);
575+
DPNPC_ptr_adapter<_DataType> input2_ptr(input2_in, size_k * size_n);
576+
DPNPC_ptr_adapter<_DataType> result_ptr(result_out, size_m * size_n, false, true);
570577
_DataType* array_1 = input1_ptr.get_ptr();
571578
_DataType* array_2 = input2_ptr.get_ptr();
572579
_DataType* result = result_ptr.get_ptr();

dpnp/backend/kernels/dpnp_krnl_linalg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void dpnp_qr_c(void* array1_in, void* result1, void* result2, void* result3, siz
455455
_ComputeDT* geqrf_scratchpad =
456456
reinterpret_cast<_ComputeDT*>(dpnp_memory_alloc_c(geqrf_scratchpad_size * sizeof(_ComputeDT)));
457457

458-
cl::sycl::vector_class<cl::sycl::event> depends(1);
458+
std::vector<cl::sycl::event> depends(1);
459459
set_barrier_event(DPNP_QUEUE, depends);
460460

461461
event =

0 commit comments

Comments
 (0)