Skip to content
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

Improve ensure_memoryview test coverage & make minor fixes #6333

Merged
merged 7 commits into from
May 13, 2022

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented May 13, 2022

Expands ensure_memoryviews test coverage to handle different types, shapes, strides, etc. Testing covers more cases in the builtin Python test coverage as well as the NumPy tests. Also more consistently use bytearrays to back memory when copies are required. Includes a fix for F-ordered data. Also returns the input argument as-is if it already meets all requirements, which is tested for. Finally adds ensure_memoryview in a few more places.

  • Tests added / passed
  • Passes pre-commit run --all-files

@jakirkham jakirkham force-pushed the imp_enh_mv branch 2 times, most recently from 0a6efb6 to 3f08f13 Compare May 13, 2022 01:07
@github-actions
Copy link
Contributor

github-actions bot commented May 13, 2022

Unit Test Results

       15 files  ±    0         15 suites  ±0   7h 8m 58s ⏱️ + 34m 24s
  2 787 tests +  11    2 708 ✔️ +  13    79 💤  -   1  0  - 1 
20 671 runs  +371  19 761 ✔️ +347  910 💤 +25  0  - 1 

Results for commit 96e2318. ± Comparison against base commit d0fbba6.

♻️ This comment has been updated with latest results.

@jakirkham
Copy link
Member Author

Planning on merging EOD tomorrow if no comments

As `memoryview.cast(...)` doesn't know how to handle F-order, go through
`PickleBuffer.raw(...)`, which can handle this case. Also pick out the
underlying `.obj` of the `memoryview` to ensure the `memoryview` that
`PickleBuffer.raw(...)` creates points back at the original object and
not the `memoryview` we created.
Handle different types, shapes, striding, etc.
Try using `ensure_memoryview` with a variety of different NumPy
`ndarray` types to improve test coverage.
@jakirkham jakirkham merged commit 6e0fe58 into dask:main May 13, 2022
@jakirkham jakirkham deleted the imp_enh_mv branch May 13, 2022 23:49
mrocklin added a commit to mrocklin/distributed that referenced this pull request May 25, 2022
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.

None yet

1 participant