Skip to content

Commit de9f2db

Browse files
authored
Merge pull request #672 from IntelPython/master
Merge master to gold/2021
2 parents 6100e77 + 19fcc96 commit de9f2db

File tree

88 files changed

+9605
-3429
lines changed

Some content is hidden

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

88 files changed

+9605
-3429
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![Build Sphinx](https://github.com/IntelPython/dpnp/workflows/Build%20Sphinx/badge.svg)](https://intelpython.github.io/dpnp)
44

55
# DPNP: NumPy-like API accelerated with SYCL
6+
[API coverage summary](https://intelpython.github.io/dpnp/reference/comparison.html#summary)
67

7-
Full documentation: https://intelpython.github.io/dpnp/
8+
[Full documentation](https://intelpython.github.io/dpnp/)
89

9-
DPNP C++ backend documentation: https://intelpython.github.io/dpnp/backend_doc/
10+
[DPNP C++ backend documentation](https://intelpython.github.io/dpnp/backend_doc/)
1011

1112
The project contains:
1213
- Python interface with NumPy-like API

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ requirements:
1010
- setuptools
1111
- numpy-devel >=1.18
1212
- cython
13-
- cmake
13+
- cmake >=3.16.5
1414
- dpctl >=0.5.0a0
1515
- mkl-devel >=2021.1.1
1616
- wheel

doc/comparison_generator.py

Lines changed: 104 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
import inspect
33

44

5+
def calc_totals(base_mod, ref_mods, cls):
6+
base_obj, _ = import_mod(base_mod, cls)
7+
base_funcs = get_functions(base_obj)
8+
9+
totals = [len(base_funcs)]
10+
for ref_mod in ref_mods:
11+
ref_obj, _ = import_mod(ref_mod, cls)
12+
ref_funcs = get_functions(ref_obj)
13+
14+
totals.append(len(ref_funcs & base_funcs))
15+
16+
return totals
17+
18+
519
def get_functions(obj):
620
funcs = []
721
for n, _ in inspect.getmembers(obj):
@@ -31,19 +45,11 @@ def import_mod(mod, cls):
3145

3246

3347
def generate_totals(base_mod, ref_mods, base_type, ref_types, cls):
34-
base_obj, _ = import_mod(base_mod, cls)
35-
base_funcs = get_functions(base_obj)
36-
3748
all_types = [base_type] + ref_types
3849
header = ', '.join('**{} Total**'.format(t) for t in all_types)
3950
header = ' {}'.format(header)
4051

41-
totals = [len(base_funcs)]
42-
for ref_mod in ref_mods:
43-
ref_obj, _ = import_mod(ref_mod, cls)
44-
ref_funcs = get_functions(ref_obj)
45-
46-
totals.append(len(ref_funcs & base_funcs))
52+
totals = calc_totals(base_mod, ref_mods, cls)
4753

4854
cells = ', '.join(str(t) for t in totals)
4955
total = ' {}'.format(cells)
@@ -87,6 +93,93 @@ def section(header, base_mod, ref_mods, base_type, ref_types, cls=None):
8793
return [header, '~' * len(header), ''] + comparison_rst + ['']
8894

8995

96+
def generate_totals_numbers(header, base_mod, ref_mods, cls=None):
97+
base_obj, _ = import_mod(base_mod, cls)
98+
base_funcs = get_functions(base_obj)
99+
100+
counter_funcs = [len(base_funcs)]
101+
for ref_mod in ref_mods:
102+
ref_obj, _ = import_mod(ref_mod, cls)
103+
ref_funcs = get_functions(ref_obj)
104+
105+
counter_funcs.append(len(ref_funcs & base_funcs))
106+
107+
totals = [header] + calc_totals(base_mod, ref_mods, cls)
108+
109+
cells = ', '.join(str(t) for t in totals)
110+
total = ' {}'.format(cells)
111+
112+
return total, counter_funcs
113+
114+
115+
def generate_table_numbers(base_mod, ref_mods, base_type, ref_types, cls=None):
116+
all_types = ['Name'] + [base_type] + ref_types
117+
header = ', '.join('**{}**'.format(t) for t in all_types)
118+
header = ' {}'.format(header)
119+
120+
rows = []
121+
counters_funcs = []
122+
123+
totals = []
124+
totals_, counters_funcs_ = generate_totals_numbers('Module-Level', base_mod, ref_mods)
125+
totals.append(totals_)
126+
counters_funcs.append(counters_funcs_)
127+
cells = ', '.join(str(t) for t in totals)
128+
total = ' {}'.format(cells)
129+
rows.append(total)
130+
131+
totals = []
132+
totals_, counters_funcs_ = generate_totals_numbers('Multi-Dimensional Array', base_mod, ref_mods, cls='ndarray')
133+
totals.append(totals_)
134+
counters_funcs.append(counters_funcs_)
135+
cells = ', '.join(str(t) for t in totals)
136+
total = ' {}'.format(cells)
137+
rows.append(total)
138+
139+
totals = []
140+
totals_, counters_funcs_ = generate_totals_numbers('Linear Algebra', base_mod + '.linalg',
141+
[m + '.linalg' for m in ref_mods])
142+
totals.append(totals_)
143+
counters_funcs.append(counters_funcs_)
144+
cells = ', '.join(str(t) for t in totals)
145+
total = ' {}'.format(cells)
146+
rows.append(total)
147+
148+
totals = []
149+
totals_, counters_funcs_ = generate_totals_numbers('Discrete Fourier Transform', base_mod + '.fft',
150+
[m + '.fft' for m in ref_mods])
151+
totals.append(totals_)
152+
counters_funcs.append(counters_funcs_)
153+
cells = ', '.join(str(t) for t in totals)
154+
total = ' {}'.format(cells)
155+
rows.append(total)
156+
157+
totals = []
158+
totals_, counters_funcs_ = generate_totals_numbers('Random Sampling', base_mod + '.random',
159+
[m + '.random' for m in ref_mods])
160+
totals.append(totals_)
161+
counters_funcs.append(counters_funcs_)
162+
cells = ', '.join(str(t) for t in totals)
163+
total = ' {}'.format(cells)
164+
rows.append(total)
165+
166+
counter_functions = []
167+
for i in range(len(counters_funcs[0])):
168+
counter = 0
169+
for j in range(len(counters_funcs)):
170+
counter += counters_funcs[j][i]
171+
counter_functions.append('{}'.format(counter))
172+
173+
summary = ['Total'] + counter_functions
174+
cells = ', '.join(str(t) for t in summary)
175+
summary_total = ' {}'.format(cells)
176+
rows.append(summary_total)
177+
178+
comparison_rst = ['.. csv-table::', ''] + [header] + rows
179+
180+
return ['Summary', '~' * len('Summary'), ''] + comparison_rst + ['']
181+
182+
90183
def generate():
91184
ref_mods = []
92185
ref_types = []
@@ -119,6 +212,8 @@ def generate():
119212
header = ' / '.join([base_ver] + ref_vers) + ' APIs'
120213
buf = ['**{}**'.format(header), '']
121214

215+
buf += generate_table_numbers(
216+
base_mod, ref_mods, base_type, ref_types)
122217
buf += section(
123218
'Module-Level',
124219
base_mod, ref_mods, base_type, ref_types)

doc/reference/creation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Basic creation routines
2020
dpnp.zeros_like
2121
dpnp.full
2222
dpnp.full_like
23+
dpnp.vander
2324

2425

2526
Creation from other data

doc/reference/math.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ Sums, products, differences
6767
dpnp.sum
6868
dpnp.cumprod
6969
dpnp.cumsum
70+
dpnp.nancumprod
71+
dpnp.nancumsum
7072
dpnp.nansum
7173
dpnp.nanprod
74+
dpnp.cross
7275
dpnp.diff
76+
dpnp.ediff1d
77+
dpnp.gradient
78+
dpnp.trapz
7379

7480

7581
Exponents and logarithms

dpnp/backend/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ else()
4242
if(UNIX)
4343
set(DPNP_ONEAPI_ROOT "/opt/intel/oneapi" CACHE PATH "Folder contains oneapi tool set")
4444
elseif(WIN32)
45-
set(DPNP_ONEAPI_ROOT "C:\Program Files (x86)\Intel\oneAPI" CACHE PATH "Folder contains oneapi tool set")
45+
set(DPNP_ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI" CACHE PATH "Folder contains oneapi tool set")
4646
else()
4747
message(FATAL_ERROR "Unsupported system ${CMAKE_SYSTEM}")
4848
endif()
@@ -54,6 +54,10 @@ option(DPNP_INSTALL_STRUCTURED "if FALSE, install package files into same direct
5454
option(DPNP_SYCL_QUEUE_MGR_ENABLE "Use external manager for SYCL queue" FALSE)
5555
option(DPNP_BACKEND_TESTS "Enable DPNP tests" FALSE)
5656

57+
if(DEFINED ENV{DPNP_DEBUG})
58+
set(DPNP_DEBUG_ENABLE $ENV{DPNP_DEBUG})
59+
endif()
60+
5761
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
5862
message(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
5963
message(STATUS "CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
@@ -171,6 +175,7 @@ set(DPNP_SRC
171175
kernels/dpnp_krnl_fft.cpp
172176
kernels/dpnp_krnl_indexing.cpp
173177
kernels/dpnp_krnl_linalg.cpp
178+
kernels/dpnp_krnl_logic.cpp
174179
kernels/dpnp_krnl_manipulation.cpp
175180
kernels/dpnp_krnl_mathematical.cpp
176181
kernels/dpnp_krnl_random.cpp
@@ -214,7 +219,6 @@ if(UNIX)
214219
# -DMKL_ILP64 -I"${MKLROOT}/include"
215220
# -lmkl_sycl -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lsycl -lOpenCL -lpthread -lm -ldl
216221
set(DPNP_MATHLIB_DEP_LIBS
217-
mkl_rt
218222
mkl_sycl
219223
mkl_intel_ilp64
220224
mkl_sequential
@@ -230,7 +234,6 @@ elseif(WIN32)
230234
# -DMKL_ILP64 -I"%MKLROOT%\include"
231235
# mkl_sycl_dll.lib mkl_intel_ilp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib sycl.lib OpenCL.lib
232236
set(DPNP_MATHLIB_DEP_LIBS
233-
mkl_rt
234237
mkl_sycl # _dll
235238
mkl_intel_ilp64 # _dll
236239
mkl_sequential # _dll

dpnp/backend/examples/example9.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* to calculate sum of the given elements vector
3131
*
3232
* Possible compile line:
33-
* clang++ -g -fPIC examples/example9.cpp -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example9
33+
* clang++ dpnp/backend/examples/example9.cpp -Idpnp -Idpnp/backend/include -Ldpnp -Wl,-rpath='$ORIGIN'/dpnp -ldpnp_backend_c -o example9
3434
*
3535
*/
3636

@@ -54,7 +54,7 @@ int main(int, char**)
5454
result_verification += i;
5555
}
5656

57-
dpnp_sum_c<long>(array, &result, size);
57+
dpnp_sum_c<long, long>(&result, array, &size, 1, NULL, 0, NULL, NULL);
5858

5959
std::cout << "SUM() value: " << result << " verification value: " << result_verification << std::endl;
6060

0 commit comments

Comments
 (0)