Skip to content

Copy from ndarray#817

Merged
oleksandr-pavlyk merged 3 commits intomasterfrom
copy_from_ndarray
Apr 20, 2022
Merged

Copy from ndarray#817
oleksandr-pavlyk merged 3 commits intomasterfrom
copy_from_ndarray

Conversation

@oleksandr-pavlyk
Copy link
Copy Markdown
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
Copy Markdown

@coveralls
Copy link
Copy Markdown
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
Copy Markdown

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