Skip to content

Merge 0.14.6dev5 into gold/2021 #1396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 66 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
83858f0
Implements dpctl.tensor.matrix_transpose (#1356)
ndgrigorian Aug 20, 2023
abc8c80
_real_view and _imag_view now set flags correctly (#1355)
ndgrigorian Aug 20, 2023
bcefda7
Closes gh-1358
oleksandr-pavlyk Aug 21, 2023
4cc552f
Implements ``types`` property for elementwise functions (#1361)
ndgrigorian Aug 21, 2023
c3427b3
Merge pull request #1359 from IntelPython/remove-DPCTLDevice_GetMaxWo…
oleksandr-pavlyk Aug 21, 2023
ddcb0ae
Corrected messsage text in two exceptions
oleksandr-pavlyk Aug 22, 2023
3cbb221
Merge pull request #1362 from IntelPython/improve-error-message
oleksandr-pavlyk Aug 22, 2023
c832602
Closes gh-1295
oleksandr-pavlyk Aug 23, 2023
68ad054
Using Py 3.11 in OS-LLVM-SYCL-BUILD workflow
oleksandr-pavlyk Aug 23, 2023
6f22fa0
Use older version of Sphinx, see it fixes documentation build
oleksandr-pavlyk Aug 23, 2023
d85e130
Merge pull request #1363 from IntelPython/drop-py-3.8
oleksandr-pavlyk Aug 23, 2023
467d133
Separate copy_usm_ndarray_for_reshape and copy_usm_ndarray_for_roll
oleksandr-pavlyk Aug 24, 2023
67cab69
Deploy _copy_usm_ndarray_for_roll
oleksandr-pavlyk Aug 24, 2023
f7eee1e
Conversion from raw to multi_ptr should be done with address_space_cast
oleksandr-pavlyk Aug 24, 2023
e0aea28
Resolved SYCL-2020 deprecation warning
oleksandr-pavlyk Aug 25, 2023
8eab04b
Merge pull request #1366 from IntelPython/create-multi_ptr-per-sycl-2…
oleksandr-pavlyk Aug 25, 2023
29fd9e5
Address NumPy 1.25 deprecation warnings
oleksandr-pavlyk Aug 25, 2023
60d1f26
Addressed Very high Coverity issue
oleksandr-pavlyk Aug 25, 2023
a653eb3
Avoid calling int/float/complex/operator.index on 1d ndarray
oleksandr-pavlyk Aug 25, 2023
1595dce
Merge pull request #1367 from IntelPython/fix-sycl-2020-deprecation-w…
oleksandr-pavlyk Aug 25, 2023
cf4660d
Merge pull request #1368 from IntelPython/scalar_special_methods_requ…
oleksandr-pavlyk Aug 25, 2023
55bb70f
Turn comparison call into assertion
oleksandr-pavlyk Aug 27, 2023
02cfdb4
Initialized env to empty dictionary instead of None
oleksandr-pavlyk Aug 27, 2023
1993eae
Merge pull request #1371 from IntelPython/tweak-test-flags
oleksandr-pavlyk Aug 27, 2023
29c52b4
Addressed coverity issue about handling bools in floor_divide
oleksandr-pavlyk Aug 27, 2023
b2cd5c1
Add support for lowercase order in tensor.copy and tensor.astype
PiotrekB416 Aug 27, 2023
5390456
Refactored
PiotrekB416 Aug 27, 2023
a4fe4ad
Merge pull request #1373 from IntelPython/coverity-scripts
oleksandr-pavlyk Aug 28, 2023
8a9ebe6
Only attempt to leave comments on PRs from this repo
oleksandr-pavlyk Aug 28, 2023
526c46c
Merge pull request #1376 from PiotrekB416/feature/lowercase-tensor-copy
oleksandr-pavlyk Aug 28, 2023
e06bf40
Generate docs made friendly for PRs from forks
oleksandr-pavlyk Aug 28, 2023
f49889c
Fixes boolean indexing for strided masks (#1370)
ndgrigorian Aug 28, 2023
dd6a014
Update libsyclinterface/source/dpctl_sycl_queue_interface.cpp
oleksandr-pavlyk Aug 28, 2023
718c51e
Merge pull request #1369 from IntelPython/fix-coverity-issue-in-dpctl…
oleksandr-pavlyk Aug 28, 2023
0a3888c
Merge pull request #1374 from IntelPython/coverity-floor-divide-opera…
oleksandr-pavlyk Aug 28, 2023
9f98baf
Merge pull request #1377 from oleksandr-pavlyk/fix-fork-workflows
oleksandr-pavlyk Aug 28, 2023
a81d9c8
Improved performance of reduction kernel with atomics
oleksandr-pavlyk Aug 22, 2023
8ecb43b
Introduce reduce_over_axis0 kernel for contiguous inputs
oleksandr-pavlyk Aug 23, 2023
c79445f
Remove logic to select max_work_group_size
oleksandr-pavlyk Aug 26, 2023
32d4419
Change WG traversal pattern in tree reduction kernel
oleksandr-pavlyk Aug 29, 2023
2c3f748
Call operator of all indexers must return py::ssize_t
oleksandr-pavlyk Aug 29, 2023
aea79dd
Add method CIndexer_vector::get_left_rolled_displacement
oleksandr-pavlyk Aug 29, 2023
558765f
Introduced dedicated function for rolling with nd-shift
oleksandr-pavlyk Aug 30, 2023
987af9e
Change name of _tensor_impl function in roll implementation
oleksandr-pavlyk Aug 30, 2023
64fa95e
Deployed _copy_usm_ndarray_for_roll_nd in dpt.roll
oleksandr-pavlyk Aug 30, 2023
3f6d78e
run_test files to output verbose listing of platform config
oleksandr-pavlyk Sep 2, 2023
8ccbee1
Merge pull request #1385 from IntelPython/update-run-test-bat
oleksandr-pavlyk Sep 2, 2023
7997fd5
Spelling fixes pointed out by codespell
oleksandr-pavlyk Sep 3, 2023
2f36893
Update libsyclinterface/include/dpctl_data_types.h
oleksandr-pavlyk Sep 3, 2023
0512214
Merge pull request #1386 from IntelPython/spelling-fixes
oleksandr-pavlyk Sep 3, 2023
62e38de
Merge pull request #1364 from IntelPython/reduction-performance
oleksandr-pavlyk Sep 5, 2023
845b4bb
Remove depricated FindPythonLibs
ZzEeKkAa Sep 5, 2023
03e7f26
address_space_cast<address_space::private_space,...> on local variable
oleksandr-pavlyk Sep 6, 2023
fed0e9b
Fixed constexpr significant bits value for double
oleksandr-pavlyk Aug 31, 2023
01e6c3d
Merge pull request #1389 from ZzEeKkAa/fix/remove_deprecated_find_pyt…
oleksandr-pavlyk Sep 6, 2023
36bc04a
Restricted use of reduce_over_axis0 special kernels
oleksandr-pavlyk Sep 6, 2023
8d8ef0b
Add test based on gh-1391
oleksandr-pavlyk Sep 6, 2023
87d1c13
Merge pull request #1390 from IntelPython/correct-address-space-in-ad…
oleksandr-pavlyk Sep 6, 2023
172394f
Fixed qualifier name typo
oleksandr-pavlyk Sep 6, 2023
a91fc55
Merge pull request #1393 from IntelPython/fix-typo-in-sqrt
oleksandr-pavlyk Sep 6, 2023
49002cc
Made except pattern more specific in the test
oleksandr-pavlyk Sep 6, 2023
a9064ee
Merge pull request #1392 from IntelPython/fix-gh-1391
oleksandr-pavlyk Sep 6, 2023
8c6e99c
Merge remote-tracking branch 'origin/master' into dedicated-roll-kernel
oleksandr-pavlyk Sep 7, 2023
ac331bb
Added a test for `roll` input validation
ndgrigorian Sep 8, 2023
a6cb5db
Merge pull request #1380 from IntelPython/dedicated-roll-kernel
oleksandr-pavlyk Sep 8, 2023
51d994a
Merge pull request #1394 from IntelPython/fix-qualifier-typos
oleksandr-pavlyk Sep 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
env:
conda-bld: C:\Miniconda\conda-bld\win-64\
steps:
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
experimental: [false]
runner: [ubuntu-20.04]
continue-on-error: ${{ matrix.experimental }}
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
experimental: [false]
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
steps:
- name: Download artifact
uses: actions/download-artifact@v3
Expand All @@ -324,7 +324,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
steps:
- name: Download artifact
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -608,7 +608,11 @@ jobs:
echo "Array API standard conformance tests failed to run for dpctl=$PACKAGE_VERSION."
exit 1
fi
- name: Output API summary
shell: bash -l {0}
run: echo "::notice ${{ env.MESSAGE }}"
- name: Post result to PR
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
uses: mshick/add-pr-comment@v1
with:
message: |
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
shell: bash -l {0}
run: |
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
pip install numpy cython setuptools scikit-build cmake sphinx"<7.2" sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
- name: Checkout repo
uses: actions/checkout@v3
with:
Expand All @@ -76,7 +76,7 @@ jobs:
mv ../cmake-install/docs/docs ~/docs
git clean -dfx
- name: Publish docs
if: ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/master' }}
shell: bash -l {0}
run: |
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
Expand All @@ -91,8 +91,15 @@ jobs:
git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
git commit -m "Latest docs."
git push tokened_docs gh-pages
- name: Save built docs as an artifact
if: ${{ github.event.pull_request && github.event.pull_request.head.repo.fork && github.event.action != 'closed'}}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }} rendered documentation
path: ~/docs

- name: Publish pull-request docs
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }}
env:
PR_NUM: ${{ github.event.number }}
shell: bash -l {0}
Expand All @@ -111,7 +118,7 @@ jobs:
git commit -m "Docs for pull request ${PR_NUM}"
git push tokened_docs gh-pages
- name: Unpublish pull-request docs
if: ${{ github.event.pull_request && github.event.action == 'closed' }}
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }}
env:
PR_NUM: ${{ github.event.number }}
shell: bash -l {0}
Expand All @@ -128,7 +135,7 @@ jobs:
git commit -m "Removing docs for closed pull request ${PR_NUM}"
git push tokened_docs gh-pages
- name: Comment with URL to published pull-request docs
if: ${{ github.event.pull_request && github.event.action != 'closed' }}
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }}
env:
PR_NUM: ${{ github.event.number }}
uses: mshick/add-pr-comment@v1
Expand All @@ -138,7 +145,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]'
- name: Comment with URL about removal of PR docs
if: ${{ github.event.pull_request && github.event.action == 'closed' }}
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }}
env:
PR_NUM: ${{ github.event.number }}
uses: mshick/add-pr-comment@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/os-llvm-sycl-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ jobs:
- name: Install system components
shell: bash -l {0}
run: |
sudo apt-get install ninja-build libtinfo5
sudo apt-get install libtinfo5

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'
architecture: x64

- name: Install dpctl dependencies
shell: bash -l {0}
run: |
pip install numpy cython setuptools pytest scikit-build cmake
pip install numpy cython setuptools pytest scikit-build cmake ninja

- name: Checkout repo
uses: actions/checkout@v3
Expand Down
11 changes: 2 additions & 9 deletions cmake/FindDpctl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,8 @@
#

if(NOT Dpctl_FOUND)
set(_find_extra_args)
if(Dpctl_FIND_REQUIRED)
list(APPEND _find_extra_args REQUIRED)
endif()
if(Dpctl_FIND_QUIET)
list(APPEND _find_extra_args QUIET)
endif()
find_package(PythonInterp ${_find_extra_args})
find_package(PythonLibs ${_find_extra_args})
find_package(Python 3.9 REQUIRED
COMPONENTS Interpreter Development.Module)

if(PYTHON_EXECUTABLE)
execute_process(COMMAND "${PYTHON_EXECUTABLE}"
Expand Down
4 changes: 2 additions & 2 deletions conda-recipe/run_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"%PYTHON%" -c "import dpctl; print(dpctl.__version__)"
if errorlevel 1 exit 1

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

python -m pytest -q -p no:faulthandler -ra --disable-warnings --pyargs dpctl -vv
python -m pytest -q -ra --disable-warnings --pyargs dpctl -vv
if errorlevel 1 exit 1
4 changes: 2 additions & 2 deletions conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
set -e

${PYTHON} -c "import dpctl; print(dpctl.__version__)"
${PYTHON} -c "import dpctl; dpctl.lsplatform(verbosity=2)"
${PYTHON} -m pytest -q -ra --disable-warnings -p no:faulthandler --cov dpctl --cov-report term-missing --pyargs dpctl -vv
${PYTHON} -m dpctl -f
${PYTHON} -m pytest -q -ra --disable-warnings --cov dpctl --cov-report term-missing --pyargs dpctl -vv
10 changes: 5 additions & 5 deletions dpctl/_sycl_context.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ cdef class SyclContext(_SyclContext):
ctx = dpctl.SyclContext()
print(ctx.get_devices())

- Invoking the constuctor with a specific filter string that creates a
- Invoking the constructor with a specific filter string that creates a
context for the device corresponding to the filter string.

:Example:
Expand All @@ -127,7 +127,7 @@ cdef class SyclContext(_SyclContext):
d = ctx.get_devices()[0]
assert(d.is_gpu)

- Invoking the constuctor with a :class:`dpctl.SyclDevice` object
- Invoking the constructor with a :class:`dpctl.SyclDevice` object
creates a context for that device.

:Example:
Expand All @@ -141,7 +141,7 @@ cdef class SyclContext(_SyclContext):
d = ctx.get_devices()[0]
assert(d.is_gpu)

- Invoking the constuctor with a list of :class:`dpctl.SyclDevice`
- Invoking the constructor with a list of :class:`dpctl.SyclDevice`
objects creates a common context for all the devices. This
constructor call is especially useful when creation a context for
multiple sub-devices.
Expand All @@ -159,7 +159,7 @@ cdef class SyclContext(_SyclContext):
ctx = dpctl.SyclContext(sub_devices)
assert(len(ctx.get_devices) == len(sub_devices))

- Invoking the constuctor with a named ``PyCapsule`` with name
- Invoking the constructor with a named ``PyCapsule`` with name
**"SyclContextRef"** that carries a pointer to a ``sycl::context``
object. The capsule will be renamed upon successful consumption
to ensure one-time use. A new named capsule can be constructed by
Expand Down Expand Up @@ -430,7 +430,7 @@ cdef class SyclContext(_SyclContext):
return num_devs
else:
raise ValueError(
"An error was encountered quering the number of devices "
"An error was encountered querying the number of devices "
"associated with this context"
)

Expand Down
2 changes: 1 addition & 1 deletion dpctl/_sycl_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ cdef class SyclDevice(_SyclDevice):
def create_sub_devices(self, **kwargs):
"""create_sub_devices(partition=parition_spec)
Creates a list of sub-devices by partitioning a root device based on the
provided partion specifier.
provided partition specifier.

A partition specifier must be provided using a "partition"
keyword argument. Possible values for the specifier are: an int, a
Expand Down
2 changes: 1 addition & 1 deletion dpctl/_sycl_event.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ cdef class SyclEvent(_SyclEvent):
# Create a default SyclEvent
e = dpctl.SyclEvent()

- Invoking the constuctor with a named ``PyCapsule`` with name
- Invoking the constructor with a named ``PyCapsule`` with name
**"SyclEventRef"** that carries a pointer to a ``sycl::event``
object. The capsule will be renamed upon successful consumption
to ensure one-time use. A new named capsule can be constructed by
Expand Down
2 changes: 1 addition & 1 deletion dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ cdef class SyclQueue(_SyclQueue):
# create a queue for each sub-device using the common context
queues = [dpctl.SyclQueue(ctx, sub_d) for sub_d in sub_devices]

- Invoking the constuctor with a named ``PyCapsule`` with the name
- Invoking the constructor with a named ``PyCapsule`` with the name
**"SyclQueueRef"** that carries a pointer to a ``sycl::queue``
object. The capsule will be renamed upon successful consumption
to ensure one-time use. A new named capsule can be constructed by
Expand Down
6 changes: 3 additions & 3 deletions dpctl/_sycl_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class SyclTimer:
q = dpctl.SyclQueue(property='enable_profiling')

# create the timer
miliseconds_sc = 1e-3
timer = dpctl.SyclTimer(time_scale = miliseconds_sc)
milliseconds_sc = 1e-3
timer = dpctl.SyclTimer(time_scale = milliseconds_sc)

# use the timer
with timer(queue=q):
code_block

# retrieve elapsed times in miliseconds
# retrieve elapsed times in milliseconds
sycl_dt, wall_dt = timer.dt

Remark:
Expand Down
4 changes: 2 additions & 2 deletions dpctl/apis/include/dpctl4pybind11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,12 @@ class usm_memory : public py::object
return nullptr;
}

auto convertor =
auto converter =
::dpctl::detail::dpctl_capi::get().as_usm_memory_pyobj();

py::object res;
try {
res = convertor(py::handle(o));
res = converter(py::handle(o));
} catch (const py::error_already_set &e) {
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion dpctl/memory/_memory.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ cdef void copy_via_host(void *dest_ptr, SyclQueue dest_queue,
void *src_ptr, SyclQueue src_queue, size_t nbytes):
"""
Copies `nbytes` bytes from `src_ptr` USM memory to
`dest_ptr` USM memory using host as the intemediary.
`dest_ptr` USM memory using host as the intermediary.

This is useful when `src_ptr` and `dest_ptr` are bound to incompatible
SYCL contexts.
Expand Down
1 change: 1 addition & 0 deletions dpctl/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pybind11_add_module(${python_module_name} MODULE
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/integer_advanced_indexing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_advanced_indexing.cpp
Expand Down
2 changes: 2 additions & 0 deletions dpctl/tensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from dpctl.tensor._device import Device
from dpctl.tensor._dlpack import from_dlpack
from dpctl.tensor._indexing_functions import extract, nonzero, place, put, take
from dpctl.tensor._linear_algebra_functions import matrix_transpose
from dpctl.tensor._manipulation_functions import (
broadcast_arrays,
broadcast_to,
Expand Down Expand Up @@ -199,6 +200,7 @@
"tril",
"triu",
"where",
"matrix_transpose",
"all",
"any",
"dtype",
Expand Down
13 changes: 9 additions & 4 deletions dpctl/tensor/_copy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _copy_to_numpy(ary):

def _copy_from_numpy(np_ary, usm_type="device", sycl_queue=None):
"Copies numpy array `np_ary` into a new usm_ndarray"
# This may peform a copy to meet stated requirements
# This may perform a copy to meet stated requirements
Xnp = np.require(np_ary, requirements=["A", "E"])
alloc_q = normalize_queue_device(sycl_queue=sycl_queue, device=None)
dt = Xnp.dtype
Expand Down Expand Up @@ -517,6 +517,11 @@ def copy(usm_ary, order="K"):
- "K": match the layout of `usm_ary` as closely as possible.

"""
if len(order) == 0 or order[0] not in "KkAaCcFf":
raise ValueError(
"Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
)
order = order[0].upper()
if not isinstance(usm_ary, dpt.usm_ndarray):
return TypeError(
f"Expected object of type dpt.usm_ndarray, got {type(usm_ary)}"
Expand Down Expand Up @@ -585,11 +590,11 @@ def astype(usm_ary, newdtype, order="K", casting="unsafe", copy=True):
return TypeError(
f"Expected object of type dpt.usm_ndarray, got {type(usm_ary)}"
)
if not isinstance(order, str) or order not in ["A", "C", "F", "K"]:
if len(order) == 0 or order[0] not in "KkAaCcFf":
raise ValueError(
"Unrecognized value of the order keyword. "
"Recognized values are 'A', 'C', 'F', or 'K'"
"Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
)
order = order[0].upper()
ary_dtype = usm_ary.dtype
target_dtype = _get_dtype(newdtype, usm_ary.sycl_queue)
if not dpt.can_cast(ary_dtype, target_dtype, casting=casting):
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tensor/_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def sycl_context(self):
@property
def sycl_device(self):
"""
:class:`dpctl.SyclDevice` targed by this :class:`.Device`.
:class:`dpctl.SyclDevice` targeted by this :class:`.Device`.
"""
return self.sycl_queue_.sycl_device

Expand Down
Loading