Skip to content

Commit d63f650

Browse files
Merge pull request #1396 from IntelPython/master
Merge 0.14.6dev5 into gold/2021
2 parents 5a9d816 + 51d994a commit d63f650

File tree

71 files changed

+1824
-487
lines changed

Some content is hidden

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

71 files changed

+1824
-487
lines changed

.github/workflows/conda-package.yml

Lines changed: 10 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', '3.11']
21+
python: ['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', '3.11']
66+
python: ['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', '3.11']
105+
python: ['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', '3.11']
188+
python: ['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', '3.11']
303+
python: ['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', '3.11']
327+
python: ['3.9', '3.10', '3.11']
328328
steps:
329329
- name: Download artifact
330330
uses: actions/download-artifact@v3
@@ -608,7 +608,11 @@ jobs:
608608
echo "Array API standard conformance tests failed to run for dpctl=$PACKAGE_VERSION."
609609
exit 1
610610
fi
611+
- name: Output API summary
612+
shell: bash -l {0}
613+
run: echo "::notice ${{ env.MESSAGE }}"
611614
- name: Post result to PR
615+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
612616
uses: mshick/add-pr-comment@v1
613617
with:
614618
message: |

.github/workflows/generate-docs.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
5050
shell: bash -l {0}
5151
run: |
52-
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
52+
pip install numpy cython setuptools scikit-build cmake sphinx"<7.2" sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
5353
- name: Checkout repo
5454
uses: actions/checkout@v3
5555
with:
@@ -76,7 +76,7 @@ jobs:
7676
mv ../cmake-install/docs/docs ~/docs
7777
git clean -dfx
7878
- name: Publish docs
79-
if: ${{ github.ref == 'refs/heads/master' }}
79+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/master' }}
8080
shell: bash -l {0}
8181
run: |
8282
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
@@ -91,8 +91,15 @@ jobs:
9191
git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
9292
git commit -m "Latest docs."
9393
git push tokened_docs gh-pages
94+
- name: Save built docs as an artifact
95+
if: ${{ github.event.pull_request && github.event.pull_request.head.repo.fork && github.event.action != 'closed'}}
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: ${{ env.PACKAGE_NAME }} rendered documentation
99+
path: ~/docs
100+
94101
- name: Publish pull-request docs
95-
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
102+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }}
96103
env:
97104
PR_NUM: ${{ github.event.number }}
98105
shell: bash -l {0}
@@ -111,7 +118,7 @@ jobs:
111118
git commit -m "Docs for pull request ${PR_NUM}"
112119
git push tokened_docs gh-pages
113120
- name: Unpublish pull-request docs
114-
if: ${{ github.event.pull_request && github.event.action == 'closed' }}
121+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }}
115122
env:
116123
PR_NUM: ${{ github.event.number }}
117124
shell: bash -l {0}
@@ -128,7 +135,7 @@ jobs:
128135
git commit -m "Removing docs for closed pull request ${PR_NUM}"
129136
git push tokened_docs gh-pages
130137
- name: Comment with URL to published pull-request docs
131-
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
138+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }}
132139
env:
133140
PR_NUM: ${{ github.event.number }}
134141
uses: mshick/add-pr-comment@v1
@@ -138,7 +145,7 @@ jobs:
138145
repo-token: ${{ secrets.GITHUB_TOKEN }}
139146
repo-token-user-login: 'github-actions[bot]'
140147
- name: Comment with URL about removal of PR docs
141-
if: ${{ github.event.pull_request && github.event.action == 'closed' }}
148+
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }}
142149
env:
143150
PR_NUM: ${{ github.event.number }}
144151
uses: mshick/add-pr-comment@v1

.github/workflows/os-llvm-sycl-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@ jobs:
9797
- name: Install system components
9898
shell: bash -l {0}
9999
run: |
100-
sudo apt-get install ninja-build libtinfo5
100+
sudo apt-get install libtinfo5
101101
102102
- name: Setup Python
103103
uses: actions/setup-python@v4
104104
with:
105-
python-version: '3.9'
105+
python-version: '3.11'
106106
architecture: x64
107107

108108
- name: Install dpctl dependencies
109109
shell: bash -l {0}
110110
run: |
111-
pip install numpy cython setuptools pytest scikit-build cmake
111+
pip install numpy cython setuptools pytest scikit-build cmake ninja
112112
113113
- name: Checkout repo
114114
uses: actions/checkout@v3

cmake/FindDpctl.cmake

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@
1717
#
1818

1919
if(NOT Dpctl_FOUND)
20-
set(_find_extra_args)
21-
if(Dpctl_FIND_REQUIRED)
22-
list(APPEND _find_extra_args REQUIRED)
23-
endif()
24-
if(Dpctl_FIND_QUIET)
25-
list(APPEND _find_extra_args QUIET)
26-
endif()
27-
find_package(PythonInterp ${_find_extra_args})
28-
find_package(PythonLibs ${_find_extra_args})
20+
find_package(Python 3.9 REQUIRED
21+
COMPONENTS Interpreter Development.Module)
2922

3023
if(PYTHON_EXECUTABLE)
3124
execute_process(COMMAND "${PYTHON_EXECUTABLE}"

conda-recipe/run_test.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"%PYTHON%" -c "import dpctl; print(dpctl.__version__)"
44
if errorlevel 1 exit 1
55

6-
"%PYTHON%" -c "import dpctl; dpctl.lsplatform()"
6+
"%PYTHON%" -m dpctl -f
77
if errorlevel 1 exit 1
88

9-
python -m pytest -q -p no:faulthandler -ra --disable-warnings --pyargs dpctl -vv
9+
python -m pytest -q -ra --disable-warnings --pyargs dpctl -vv
1010
if errorlevel 1 exit 1

conda-recipe/run_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
set -e
44

55
${PYTHON} -c "import dpctl; print(dpctl.__version__)"
6-
${PYTHON} -c "import dpctl; dpctl.lsplatform(verbosity=2)"
7-
${PYTHON} -m pytest -q -ra --disable-warnings -p no:faulthandler --cov dpctl --cov-report term-missing --pyargs dpctl -vv
6+
${PYTHON} -m dpctl -f
7+
${PYTHON} -m pytest -q -ra --disable-warnings --cov dpctl --cov-report term-missing --pyargs dpctl -vv

dpctl/_sycl_context.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ cdef class SyclContext(_SyclContext):
114114
ctx = dpctl.SyclContext()
115115
print(ctx.get_devices())
116116
117-
- Invoking the constuctor with a specific filter string that creates a
117+
- Invoking the constructor with a specific filter string that creates a
118118
context for the device corresponding to the filter string.
119119
120120
:Example:
@@ -127,7 +127,7 @@ cdef class SyclContext(_SyclContext):
127127
d = ctx.get_devices()[0]
128128
assert(d.is_gpu)
129129
130-
- Invoking the constuctor with a :class:`dpctl.SyclDevice` object
130+
- Invoking the constructor with a :class:`dpctl.SyclDevice` object
131131
creates a context for that device.
132132
133133
:Example:
@@ -141,7 +141,7 @@ cdef class SyclContext(_SyclContext):
141141
d = ctx.get_devices()[0]
142142
assert(d.is_gpu)
143143
144-
- Invoking the constuctor with a list of :class:`dpctl.SyclDevice`
144+
- Invoking the constructor with a list of :class:`dpctl.SyclDevice`
145145
objects creates a common context for all the devices. This
146146
constructor call is especially useful when creation a context for
147147
multiple sub-devices.
@@ -159,7 +159,7 @@ cdef class SyclContext(_SyclContext):
159159
ctx = dpctl.SyclContext(sub_devices)
160160
assert(len(ctx.get_devices) == len(sub_devices))
161161
162-
- Invoking the constuctor with a named ``PyCapsule`` with name
162+
- Invoking the constructor with a named ``PyCapsule`` with name
163163
**"SyclContextRef"** that carries a pointer to a ``sycl::context``
164164
object. The capsule will be renamed upon successful consumption
165165
to ensure one-time use. A new named capsule can be constructed by
@@ -430,7 +430,7 @@ cdef class SyclContext(_SyclContext):
430430
return num_devs
431431
else:
432432
raise ValueError(
433-
"An error was encountered quering the number of devices "
433+
"An error was encountered querying the number of devices "
434434
"associated with this context"
435435
)
436436

dpctl/_sycl_device.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ cdef class SyclDevice(_SyclDevice):
11631163
def create_sub_devices(self, **kwargs):
11641164
"""create_sub_devices(partition=parition_spec)
11651165
Creates a list of sub-devices by partitioning a root device based on the
1166-
provided partion specifier.
1166+
provided partition specifier.
11671167
11681168
A partition specifier must be provided using a "partition"
11691169
keyword argument. Possible values for the specifier are: an int, a

dpctl/_sycl_event.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ cdef class SyclEvent(_SyclEvent):
119119
# Create a default SyclEvent
120120
e = dpctl.SyclEvent()
121121
122-
- Invoking the constuctor with a named ``PyCapsule`` with name
122+
- Invoking the constructor with a named ``PyCapsule`` with name
123123
**"SyclEventRef"** that carries a pointer to a ``sycl::event``
124124
object. The capsule will be renamed upon successful consumption
125125
to ensure one-time use. A new named capsule can be constructed by

dpctl/_sycl_queue.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ cdef class SyclQueue(_SyclQueue):
246246
# create a queue for each sub-device using the common context
247247
queues = [dpctl.SyclQueue(ctx, sub_d) for sub_d in sub_devices]
248248
249-
- Invoking the constuctor with a named ``PyCapsule`` with the name
249+
- Invoking the constructor with a named ``PyCapsule`` with the name
250250
**"SyclQueueRef"** that carries a pointer to a ``sycl::queue``
251251
object. The capsule will be renamed upon successful consumption
252252
to ensure one-time use. A new named capsule can be constructed by

dpctl/_sycl_timer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ class SyclTimer:
3737
q = dpctl.SyclQueue(property='enable_profiling')
3838
3939
# create the timer
40-
miliseconds_sc = 1e-3
41-
timer = dpctl.SyclTimer(time_scale = miliseconds_sc)
40+
milliseconds_sc = 1e-3
41+
timer = dpctl.SyclTimer(time_scale = milliseconds_sc)
4242
4343
# use the timer
4444
with timer(queue=q):
4545
code_block
4646
47-
# retrieve elapsed times in miliseconds
47+
# retrieve elapsed times in milliseconds
4848
sycl_dt, wall_dt = timer.dt
4949
5050
Remark:

dpctl/apis/include/dpctl4pybind11.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ class usm_memory : public py::object
742742
return nullptr;
743743
}
744744

745-
auto convertor =
745+
auto converter =
746746
::dpctl::detail::dpctl_capi::get().as_usm_memory_pyobj();
747747

748748
py::object res;
749749
try {
750-
res = convertor(py::handle(o));
750+
res = converter(py::handle(o));
751751
} catch (const py::error_already_set &e) {
752752
return nullptr;
753753
}

dpctl/memory/_memory.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ cdef void copy_via_host(void *dest_ptr, SyclQueue dest_queue,
9292
void *src_ptr, SyclQueue src_queue, size_t nbytes):
9393
"""
9494
Copies `nbytes` bytes from `src_ptr` USM memory to
95-
`dest_ptr` USM memory using host as the intemediary.
95+
`dest_ptr` USM memory using host as the intermediary.
9696
9797
This is useful when `src_ptr` and `dest_ptr` are bound to incompatible
9898
SYCL contexts.

dpctl/tensor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pybind11_add_module(${python_module_name} MODULE
3737
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp
3838
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp
3939
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp
40+
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp
4041
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
4142
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/integer_advanced_indexing.cpp
4243
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_advanced_indexing.cpp

dpctl/tensor/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
from dpctl.tensor._device import Device
6161
from dpctl.tensor._dlpack import from_dlpack
6262
from dpctl.tensor._indexing_functions import extract, nonzero, place, put, take
63+
from dpctl.tensor._linear_algebra_functions import matrix_transpose
6364
from dpctl.tensor._manipulation_functions import (
6465
broadcast_arrays,
6566
broadcast_to,
@@ -199,6 +200,7 @@
199200
"tril",
200201
"triu",
201202
"where",
203+
"matrix_transpose",
202204
"all",
203205
"any",
204206
"dtype",

dpctl/tensor/_copy_utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _copy_to_numpy(ary):
5656

5757
def _copy_from_numpy(np_ary, usm_type="device", sycl_queue=None):
5858
"Copies numpy array `np_ary` into a new usm_ndarray"
59-
# This may peform a copy to meet stated requirements
59+
# This may perform a copy to meet stated requirements
6060
Xnp = np.require(np_ary, requirements=["A", "E"])
6161
alloc_q = normalize_queue_device(sycl_queue=sycl_queue, device=None)
6262
dt = Xnp.dtype
@@ -517,6 +517,11 @@ def copy(usm_ary, order="K"):
517517
- "K": match the layout of `usm_ary` as closely as possible.
518518
519519
"""
520+
if len(order) == 0 or order[0] not in "KkAaCcFf":
521+
raise ValueError(
522+
"Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
523+
)
524+
order = order[0].upper()
520525
if not isinstance(usm_ary, dpt.usm_ndarray):
521526
return TypeError(
522527
f"Expected object of type dpt.usm_ndarray, got {type(usm_ary)}"
@@ -585,11 +590,11 @@ def astype(usm_ary, newdtype, order="K", casting="unsafe", copy=True):
585590
return TypeError(
586591
f"Expected object of type dpt.usm_ndarray, got {type(usm_ary)}"
587592
)
588-
if not isinstance(order, str) or order not in ["A", "C", "F", "K"]:
593+
if len(order) == 0 or order[0] not in "KkAaCcFf":
589594
raise ValueError(
590-
"Unrecognized value of the order keyword. "
591-
"Recognized values are 'A', 'C', 'F', or 'K'"
595+
"Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
592596
)
597+
order = order[0].upper()
593598
ary_dtype = usm_ary.dtype
594599
target_dtype = _get_dtype(newdtype, usm_ary.sycl_queue)
595600
if not dpt.can_cast(ary_dtype, target_dtype, casting=casting):

dpctl/tensor/_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def sycl_context(self):
9696
@property
9797
def sycl_device(self):
9898
"""
99-
:class:`dpctl.SyclDevice` targed by this :class:`.Device`.
99+
:class:`dpctl.SyclDevice` targeted by this :class:`.Device`.
100100
"""
101101
return self.sycl_queue_.sycl_device
102102

0 commit comments

Comments
 (0)