forked from taichi-dev/taichi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bug][lang] Fix copyback for fortran contiguous numpy arrays
fixes taichi-dev#6305 Taichi kernel assumes input external array are row major / c_contiguous for now so this PR throws an error message when the input numpy array isn't contiguous. Note that we only supports inplace update for c_contiguous numpy arrays but for historical reason support for f_contiguous array was added via copying (`ascontiguousarray()`) as well, thus this PR tries to preserve the support to avoid breaking old code. Also the support for f_contiguous numpy array was halfly done since `ascontiguousarray()` may return a new numpy array, Taichi kernels just read/write on the copied array and don't copy the values back to the original numpy array. This PR fixes the bug mentioned above by adding a callback function to copy values back, although copying behavior isn't efficient it guarantees correctness so that we can improve it in the future.
- Loading branch information
Ailing Zhang
committed
Oct 19, 2022
1 parent
2ecff6b
commit 7291e97
Showing
2 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters