Skip to content

Copy from ndarray #817

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 3 commits into from
Apr 20, 2022
Merged

Copy from ndarray #817

merged 3 commits into from
Apr 20, 2022

Conversation

oleksandr-pavlyk
Copy link
Contributor

Added an implementation of dedicated copy-with-casting routine to copy from numpy's ndarray to usm_ndarray.

Deployed in in _copy_utils, which automatically uses it in __setitem__.

The kernel accesses NumPy allocation using read-only buffer, hence
the blocking.

```
In [1]: import dpctl.tensor as dpt

In [2]: import numpy as np

In [3]: X = dpt.zeros((81,81,81),'d')

In [4]: %time X[:41,:41,:41] = np.random.randn(41,41,41)
CPU times: user 100 ms, sys: 8.28 ms, total: 108 ms
Wall time: 106 ms

In [5]: %time X[:41,:41,:41] = np.random.randn(41,41,41)
CPU times: user 17.8 ms, sys: 3.81 ms, total: 21.6 ms
Wall time: 20 ms
```

This used to take over 30 seconds.
@github-actions
Copy link

@coveralls
Copy link
Collaborator

coveralls commented Apr 18, 2022

Coverage Status

Coverage decreased (-0.05%) to 81.934% when pulling 69b8784 on copy_from_ndarray into ca0ef9b on master.

@oleksandr-pavlyk oleksandr-pavlyk force-pushed the copy_from_ndarray branch 2 times, most recently from de00930 to 11390f8 Compare April 19, 2022 13:54
Add implementation of build_package_data method for the subclass
which does not use os.chmod that does not suppot symbolic links
@oleksandr-pavlyk oleksandr-pavlyk merged commit 0232bed into master Apr 20, 2022
@oleksandr-pavlyk oleksandr-pavlyk deleted the copy_from_ndarray branch April 20, 2022 01:03
@github-actions
Copy link

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants