Skip to content

Commit abf15df

Browse files
Merge remote-tracking branch 'origin/master' into revert-kw-workaround
2 parents 4165afe + 20c5d3c commit abf15df

File tree

19 files changed

+1260
-80
lines changed

19 files changed

+1260
-80
lines changed

.github/workflows/conda-package.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
python: ['3.8', '3.9', '3.10']
21+
python: ['3.8', '3.9', '3.10', '3.11']
2222
steps:
2323
- uses: actions/checkout@v3
2424
with:
@@ -63,7 +63,7 @@ jobs:
6363

6464
strategy:
6565
matrix:
66-
python: ['3.8', '3.9', '3.10']
66+
python: ['3.8', '3.9', '3.10', '3.11']
6767
env:
6868
conda-bld: C:\Miniconda\conda-bld\win-64\
6969
steps:
@@ -102,7 +102,7 @@ jobs:
102102

103103
strategy:
104104
matrix:
105-
python: ['3.8', '3.9', '3.10']
105+
python: ['3.8', '3.9', '3.10', '3.11']
106106
experimental: [false]
107107
runner: [ubuntu-20.04]
108108
continue-on-error: ${{ matrix.experimental }}
@@ -185,7 +185,7 @@ jobs:
185185
shell: cmd /C CALL {0}
186186
strategy:
187187
matrix:
188-
python: ['3.8', '3.9', '3.10']
188+
python: ['3.8', '3.9', '3.10', '3.11']
189189
experimental: [false]
190190
runner: [windows-latest]
191191
continue-on-error: ${{ matrix.experimental }}
@@ -300,7 +300,7 @@ jobs:
300300
runs-on: ubuntu-20.04
301301
strategy:
302302
matrix:
303-
python: ['3.8', '3.9', '3.10']
303+
python: ['3.8', '3.9', '3.10', '3.11']
304304
steps:
305305
- name: Download artifact
306306
uses: actions/download-artifact@v3
@@ -324,7 +324,7 @@ jobs:
324324
runs-on: windows-latest
325325
strategy:
326326
matrix:
327-
python: ['3.8', '3.9', '3.10']
327+
python: ['3.8', '3.9', '3.10', '3.11']
328328
steps:
329329
- name: Download artifact
330330
uses: actions/download-artifact@v3

CHANGELOG.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,97 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [dev]
8+
9+
### Added
10+
### Changed
11+
### Fixed
12+
13+
## [0.14.5] - 07/17/2023
14+
15+
### Added
16+
17+
* Added `dpctl.tensor.log2` and `dpctl.tensor.log10`: [#1267](https://github.com/IntelPython/dpctl/pull/1267)
18+
* Added `dpctl.tensor.negative`, `dpctl.tensor.positive`, `dpctl.tensor.square` [#1268](https://github.com/IntelPython/dpctl/pull/1268)
19+
* Added `dpctl.tensor.logical_not`, `dpctl.tensor.logical_and`, `dpctl.tensor.logical_or`, `dpctl.tensor.logical_xor` [#1270](https://github.com/IntelPython/dpctl/pull/1270)
20+
21+
### Changed
22+
23+
* `dpctl.tensor.astype` behavior for `newdtype=None` changes [#1261](https://github.com/IntelPython/dpctl/pull/1262)
24+
* `dpctl.tensor.usm_ndaray` constructor default value of `dtype` keyword argument changed to `None`: [#1265](https://github.com/IntelPython/dpctl/pull/1265)
25+
* Support for `out` arguments that overlap with inputs for unary elementwise functions[#1281](https://github.com/IntelPython/dpctl/pull/1281)
26+
* Copying from one array to another a no-op if both arrays view into the same memory [#1284](https://github.com/IntelPython/dpctl/pull/1284)
27+
28+
## [0.14.4] - 06/14/2023
29+
30+
### Added
31+
32+
* Added `dpctl.tensor.less_equal`, `dpctl.tensor.greater`, `dpctl.tensor.greater_equal`: [#1239](https://github.com/IntelPython/dpctl/pull/1239)
33+
34+
### Changed
35+
36+
* Optimized in-place arithmetic operations for updating matrix with rows/columns via broadcasting: [#1244](https://github.com/IntelPython/dpctl/pull/1244)
37+
38+
### Fixed
39+
40+
* Fixed handling of 0d arrays in `dpctl.tensor.sum`: [#1238](https://github.com/IntelPython/dpctl/pull/1238)
41+
42+
## [0.14.3] - 06/13/2023
43+
44+
### Added
45+
46+
* Added support of `axis=None` in `dpctl.tensor.concat` [#1125](https://github.com/IntelPython/dpctl/pull/1125)
47+
* Added caching for `dpctl.SyclDevice.filter_string` property [#1127](https://github.com/IntelPython/dpctl/pull/1127)
48+
* Added `dpctl.tensor.isdtype` from array API [#1133](https://github.com/IntelPython/dpctl/pull/1133)
49+
* Added `dpctl.tensor.unstack`, `dpctl.tensor.moveaxis`, `dpctl.tensor.swapaxes` [#1137](https://github.com/IntelPython/dpctl/pull/1137), [#1174](https://github.com/IntelPython/dpctl/pull/1174)
50+
* Allow for mutation of `dpctl.tensor.usm_ndarray.flags.writable` [#1141](https://github.com/IntelPython/dpctl/pull/1141)
51+
* Added `dpctl.tensor.where` from array API [#1147](https://github.com/IntelPython/dpctl/pull/1147)
52+
* Include libtensor headers in `dpctl` installation layout [#1185](https://github.com/IntelPython/dpctl/pull/1185)
53+
* Added new properties of `dpctl.tensor.usm_ndarray` object [#1199](https://github.com/IntelPython/dpctl/pull/1199)
54+
* Added a list of unary and binary elementwise functions from array API:
55+
- [#1203](https://github.com/IntelPython/dpctl/pull/1203): `dpctl.tensor.add`, `dpctl.tensor.divide`, `dpctl.tensor.isnan`, `dpctl.tensor.isinf`, `dpctl.tensor.isfinite`, `dpctl.tensor.cos`, `dpctl.tensor.abs`, `dpctl.tensor.equal`
56+
- [#1205](https://github.com/IntelPython/dpctl/pull/1205): `dpctl.tensor.sqrt`
57+
- [#1209](https://github.com/IntelPython/dpctl/pull/1209): implements `out` keyword argument
58+
- [#1211](https://github.com/IntelPython/dpctl/pull/1211): `dpctl.tensor.multiply`, `dpctl.tensor.subtract`
59+
- [#1214](https://github.com/IntelPython/dpctl/pull/1214): `dpctl.tensor.not_equal`
60+
- [#1216](https://github.com/IntelPython/dpctl/pull/1216): `dpctl.tensor.exp`, `dpctl.tensor.sin`
61+
- [#1217](https://github.com/IntelPython/dpctl/pull/1217): `dpctl.tensor.real`, `dpctl.tensor.imag`, `dpctl.tensor.proj`
62+
- [#1218](https://github.com/IntelPython/dpctl/pull/1218): `dpctl.tensor.log`, `dpctl.tensor.log1p`, `dpctl.tensor.expm1`
63+
- [#1221](https://github.com/IntelPython/dpctl/pull/1221): `dpctl.tensor.floor_divide`
64+
- [#1235](https://github.com/IntelPython/dpctl/pull/1235): `dpctl.tensor.less`
65+
- [#1237](https://github.com/IntelPython/dpctl/pull/1237): in-place support for addition, multiplication and subtraction
66+
* Added `dpctl.tensor.all` and `dpctl.tensor.any` [#1204](https://github.com/IntelPython/dpctl/pull/1204)
67+
* Added `dpctl.tensor.sum` [#1210](https://github.com/IntelPython/dpctl/pull/1210)
68+
69+
### Changed
70+
71+
* Updated examples of native Python extensions built using `dpctl` [#1108](https://github.com/IntelPython/dpctl/pull/1108)
72+
* Used security flags to compile and link native extensions of `dpctl` [#1109](https://github.com/IntelPython/dpctl/pull/1109)
73+
* Changed types of `dpctl.tensor.finfo` and `dpctl.tensor.iinfo` output structure per array API spec [#1110](https://github.com/IntelPython/dpctl/pull/1110)
74+
* Consolidated multiple USM temporaries life-time management `host_task`s to improve test suite stability [#1111](https://github.com/IntelPython/dpctl/pull/1111)
75+
* MAINT: Improved cmake target dependency tracking [#1112](https://github.com/IntelPython/dpctl/pull/1112)
76+
* MAINT: Improved docstrings for existing `dpctl.tensor` functions [#1123](https://github.com/IntelPython/dpctl/pull/1123)
77+
* Changed default value of `mode` keyword in `dpctl.tensor.take` and `dpctl.take.put` from `clip` to `wrap` [#1132](https://github.com/IntelPython/dpctl/pull/1132)
78+
* Added support for (nested) sequence of `dpctl.tensor.usm_ndarray` objects in `dpctl.tensor.asarray` [#1139](https://github.com/IntelPython/dpctl/pull/1139)
79+
* Improved exception handling in `dpctl.tensor.usm_ndarray.__setitem__` special method [#1146](https://github.com/IntelPython/dpctl/pull/1146)
80+
* Simplified implementation of copy-and-cast kernels and removed special casing for 2D arrays to conserve binary size [#1165](https://github.com/IntelPython/dpctl/pull/1165)
81+
* Improved speed of `dpctl.tensor.usm_ndarray` printing functionality [#1187](https://github.com/IntelPython/dpctl/pull/1187)
82+
* Require DPC++ RT 2023.1 to build and run `dpctl` [#1195](ttps://github.com/IntelPython/dpctl/pull/1195)
83+
* Compile offloading native extensions with `-fno-sycl-id-queries-fit-in-int` fixing [gh-1184](https://github.com/IntelPython/dpctl/issues/1184), [#1200](https://github.com/IntelPython/dpctl/pull/1200)
84+
* Transition to conda-forge ecosystem [#1213](https://github.com/IntelPython/dpctl/pull/1213)
85+
86+
87+
88+
### Fixed
89+
90+
* Fix to add empty values check for `dpctl.tensor.place` [#1105](https://github.com/IntelPython/dpctl/pull/1105), [#1106](https://github.com/IntelPython/dpctl/pull/1106)
91+
* Fixed [gh-1089](https://github.com/IntelPython/dpctl/issues/1089) by improving `dpctl.tensor.asarray` handling of NumPy arrays viewing into host-accessible USM allocation objects.
92+
* MAINT: Fixed build break with newer GCC and SYCLOS [#1118](https://github.com/IntelPython/dpctl/pull/1118)
93+
* Fixed a bug in basic indexing of `dpctl.tensor.usm_ndarray` [#1136](https://github.com/IntelPython/dpctl/pull/1136)
94+
95+
96+
97+
798
## [0.14.2] - 03/07/2023
899

9100
### Fixed

conda-recipe/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# activation scripts.
66
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib"
77

8+
# This is necessary to help DPC++ find Intel libraries such as SVML, IRNG, etc in build prefix
9+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib"
10+
811
# Intel LLVM must cooperate with compiler and sysroot from conda
912
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
1013
export ICPXCFG="$(pwd)/icpx_for_conda.cfg"

docs/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "Data-parallel Control (dpctl)"
35+
PROJECT_NAME = "Data Parallel Control (dpctl)"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

docs/conf.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import extlinks_gen as urlgen
3636

3737
# -- Project information -----------------------------------------------------
3838

39-
project = "Data-parallel Control (dpctl)"
39+
project = "Data Parallel Control (dpctl)"
4040
copyright = "2020-21, Intel Corp."
4141
author = "Intel Corp."
4242

docs/docfiles/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Welcome to the Data-parallel Control (dpctl) Documentation!
1+
Welcome to the Data Parallel Control (dpctl) Documentation!
22
===========================================================
33

4-
The data-parallel control (dpctl) library provides C and Python bindings for
4+
The Data Parallel Control (dpctl) package provides C and Python bindings for
55
:sycl_spec_2020:`SYCL 2020 <>`. The SYCL 2020 features supported by dpctl are
66
limited to those included by Intel(R) DPC++ compiler and specifically cover the
77
SYCL runtime classes described in :sycl_runtime_classes:`Section 4.6 <>`

dpctl/tensor/__init__.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@
9494
from ._elementwise_funcs import (
9595
abs,
9696
add,
97+
ceil,
9798
conj,
9899
cos,
99100
divide,
100101
equal,
101102
exp,
102103
expm1,
104+
floor,
103105
floor_divide,
104106
greater,
105107
greater_equal,
@@ -128,6 +130,7 @@
128130
sqrt,
129131
square,
130132
subtract,
133+
trunc,
131134
)
132135
from ._reduction import sum
133136

@@ -208,16 +211,21 @@
208211
"inf",
209212
"abs",
210213
"add",
214+
"ceil",
211215
"conj",
212216
"cos",
217+
"divide",
218+
"equal",
213219
"exp",
214220
"expm1",
221+
"floor",
222+
"floor_divide",
215223
"greater",
216224
"greater_equal",
217225
"imag",
226+
"isfinite",
218227
"isinf",
219228
"isnan",
220-
"isfinite",
221229
"less",
222230
"less_equal",
223231
"log",
@@ -228,19 +236,17 @@
228236
"log1p",
229237
"log2",
230238
"log10",
239+
"multiply",
231240
"negative",
241+
"not_equal",
232242
"positive",
243+
"pow",
233244
"proj",
234245
"real",
235246
"sin",
236247
"sqrt",
237248
"square",
238-
"divide",
239-
"multiply",
240-
"pow",
241249
"subtract",
242-
"equal",
243-
"not_equal",
244250
"sum",
245-
"floor_divide",
251+
"trunc",
246252
]

dpctl/tensor/_elementwise_common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ def __call__(self, x, out=None, order="K"):
5858
x.dtype, self.result_type_resolver_fn_, x.sycl_device
5959
)
6060
if res_dt is None:
61-
raise RuntimeError
61+
raise TypeError(
62+
f"function '{self.name_}' does not support input type "
63+
f"({x.dtype}), "
64+
"and the input could not be safely coerced to any "
65+
"supported types according to the casting rule ''safe''."
66+
)
6267

6368
orig_out = out
6469
if out is not None:

dpctl/tensor/_elementwise_funcs.py

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,30 @@
114114
# FIXME: implement B07
115115

116116
# U09: ==== CEIL (x)
117-
# FIXME: implement U09
117+
_ceil_docstring = """
118+
ceil(x, out=None, order='K')
119+
120+
Returns the ceiling for each element `x_i` for input array `x`.
121+
The ceil of the scalar `x` is the smallest integer `i`, such that `i >= x`.
122+
123+
Args:
124+
x (usm_ndarray):
125+
Input array, expected to have numeric data type.
126+
out ({None, usm_ndarray}, optional):
127+
Output array to populate.
128+
Array have the correct shape and the expected data type.
129+
order ("C","F","A","K", optional):
130+
Memory layout of the newly output array, if parameter `out` is `None`.
131+
Default: "K".
132+
Returns:
133+
usm_narray:
134+
An array containing the element-wise ceiling of input array.
135+
The returned array has the same data type as `x`.
136+
"""
137+
138+
ceil = UnaryElementwiseFunc(
139+
"ceil", ti._ceil_result_type, ti._ceil, _ceil_docstring
140+
)
118141

119142
# U10: ==== CONJ (x)
120143
_conj_docstring = """
@@ -271,7 +294,30 @@
271294
)
272295

273296
# U15: ==== FLOOR (x)
274-
# FIXME: implement U15
297+
_floor_docstring = """
298+
floor(x, out=None, order='K')
299+
300+
Returns the floor for each element `x_i` for input array `x`.
301+
The floor of the scalar `x` is the largest integer `i`, such that `i <= x`.
302+
303+
Args:
304+
x (usm_ndarray):
305+
Input array, expected to have numeric data type.
306+
out ({None, usm_ndarray}, optional):
307+
Output array to populate.
308+
Array have the correct shape and the expected data type.
309+
order ("C","F","A","K", optional):
310+
Memory layout of the newly output array, if parameter `out` is `None`.
311+
Default: "K".
312+
Returns:
313+
usm_narray:
314+
An array containing the element-wise floor of input array.
315+
The returned array has the same data type as `x`.
316+
"""
317+
318+
floor = UnaryElementwiseFunc(
319+
"floor", ti._floor_result_type, ti._floor, _floor_docstring
320+
)
275321

276322
# B10: ==== FLOOR_DIVIDE (x1, x2)
277323
_floor_divide_docstring_ = """
@@ -1031,4 +1077,29 @@
10311077
# FIXME: implement U35
10321078

10331079
# U36: ==== TRUNC (x)
1034-
# FIXME: implement U36
1080+
_trunc_docstring = """
1081+
trunc(x, out=None, order='K')
1082+
1083+
Returns the truncated value for each element `x_i` for input array `x`.
1084+
The truncated value of the scalar `x` is the nearest integer i which is
1085+
closer to zero than `x` is. In short, the fractional part of the
1086+
signed number `x` is discarded.
1087+
1088+
Args:
1089+
x (usm_ndarray):
1090+
Input array, expected to have numeric data type.
1091+
out ({None, usm_ndarray}, optional):
1092+
Output array to populate.
1093+
Array have the correct shape and the expected data type.
1094+
order ("C","F","A","K", optional):
1095+
Memory layout of the newly output array, if parameter `out` is `None`.
1096+
Default: "K".
1097+
Returns:
1098+
usm_narray:
1099+
An array containing the element-wise truncated value of input array.
1100+
The returned array has the same data type as `x`.
1101+
"""
1102+
1103+
trunc = UnaryElementwiseFunc(
1104+
"trunc", ti._trunc_result_type, ti._trunc, _trunc_docstring
1105+
)

dpctl/tensor/_reduction.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def sum(arr, axis=None, dtype=None, keepdims=False):
123123

124124
res_usm_type = arr.usm_type
125125
if arr.size == 0:
126+
if keepdims:
127+
res_shape = res_shape + (1,) * red_nd
128+
inv_perm = sorted(range(nd), key=lambda d: perm[d])
129+
res_shape = tuple(res_shape[i] for i in inv_perm)
126130
return dpt.zeros(
127131
res_shape, dtype=res_dt, usm_type=res_usm_type, sycl_queue=q
128132
)

0 commit comments

Comments
 (0)