-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Core] Ray breaks alignment for NumPy arrays of doubles #11760
Comments
Is this a regression from Ray 0.8 series? |
Interesting, so this may have been broken for some time now. |
Food for thought: I've tried pickling and unpickling back (by using builtin |
@ericl What's the action item here? |
@robertnishihara I almost sure when moving from pyarrow to pickle5, the buffer is still aligned: ray/python/ray/includes/serialization.pxi Lines 301 to 307 in 28e7439
For large chunks, we align the buffer to 64 bytes(kMajorBufferAlign); for small chunks, we align it to 8 bytes (kMinorBufferAlign). Maybe it is related to the msgpack header which is introduced recently? |
@suquark Could it be that the relative addresses are aligned, but not the start? Maybe we need to make sure to make Can you test that and create a PR for it? |
@suquark it's definitely not aligned right now, e.g., import ray
import numpy as np
ray.init()
x = ray.get(ray.put(np.zeros(10**8)))
assert x.ctypes.data % 64 == 0 # This is often (always?) 12 for me. Not that I tried larger arrays in case the different code paths for smaller objects change things. For some reason I thought we had a test for this, but I can't find it now. EDIT: I guess we added the test in Arrow. |
What is the problem?
I'm using Ray 1.0.0 with Python 3.8.3 on Ubuntu 18.04
When I use Ray to serialize/deserialize a NumPy array of doubles, I get an unaligned NumPy array (data is not 8-byte aligned).
Reproduction
Here is a reproducer I use
The output is:
The text was updated successfully, but these errors were encountered: