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
Make sure arrays are bytes aligned in joblib pickles #1254
Merged
Merged
Changes from 7 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
5b855cc
wip
lesteve 232588b
fix
lesteve 282d953
test
lesteve 6b72bcf
Remove debug print
lesteve ef5ddcd
fix (peek not supported in io.BytesIO)
lesteve a851f5c
better variables
lesteve 7cd90ed
handle case where .tell not supported
lesteve e0a994a
Fix memmap with old pickles loaded in mmap mode
lesteve c8302dc
Use module variable for array bytes alignment
lesteve 4952732
Fix for Windows
lesteve 36cfa85
Merge branch 'master' of https://github.com/joblib/joblib into memmap…
lesteve 513e0d1
Fix test checking old non-aligned arrays with memmap
lesteve d7cbd3f
Add align_bytes_array attribute in NumpyArrayWrapper
lesteve d66f2bd
lint
lesteve 7dab61b
Tweak
lesteve f943214
trigger CI
lesteve fe5036d
Trigger CI
lesteve 0522f23
Create a numpy_array_alignment_bytes attribute to allow for future ch…
lesteve 41dc185
Add test for edge case where aligned numpy arrays are read in a file …
lesteve b2b2f92
Merge branch 'master' into memmap-align
ogrisel 73eb719
Tackled most comments
lesteve e6409e9
Add warning when loading an old pickle with non memory aligned array
lesteve a36af7c
Add changelog entry.
lesteve 54c2773
tweak
lesteve dfccb94
Forgotten f-string
lesteve 236e042
Windows fix
lesteve 3995ed4
Trigger CI
lesteve 4705aad
Apply suggestions from code review
lesteve 2e380bb
tweak
lesteve eb69803
Update joblib/test/test_numpy_pickle.py
ogrisel 188c089
Trigger CI
lesteve File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numpy documentation mentions that some dtypes would rather expect 16 bytes alignment (e.g. float128).
Also, since SIMD-optimized compute kernels would run more efficient (fully vectorized) if the buffers are directly aligned to their vector instructions sizes, maybe we should directly go for 64 bytes alignment (e.g. for AVX 512 which are currently the widest vector instructions).
In the ARM ecosystem there are also 512 bit wide vector instructions, e.g.:
https://www.fujitsu.com/global/products/computing/servers/supercomputer/a64fx/
But from what I read about SVE2 the size can be dynamic by 128 bit (16 bytes) increments.
So I have the feeling that padding by 16 bytes is a necessity to be safe (avoid crashs) but padding by 64 bytes (512 bits) can be a bit helpful for vectorized compute kernels to run more efficiently on such memmaped buffers. Going beyond is probably useless.