[SciPy-user] numpy aligned memory
David Cournapeau
cournape at gmail.com
Sun Mar 8 14:12:20 EDT 2009
On Mon, Mar 9, 2009 at 2:27 AM, Pauli Virtanen <pav at iki.fi> wrote:
> Sun, 08 Mar 2009 22:33:32 +0530, Rohit Garg wrote:
>> I saw this
>>
>> http://www.mail-archive.com/numpy-discussion@scipy.org/msg04005.html
>>
>> while googling for numpy memory alignment. I wish to know if anything on
>> that account has come to pass yet? On linux 64 bit platform, can I
>> assume anything beyond the glibc alignment as of now?
>
> You cannot assume even glibc alignment, unless the array has the ALIGNED
> flag set. (This has actually caused a few bugs also in Numpy & Scipy, cf.
> eg. #551.) For example unpickling can produce arrays that are not aligned
> at itemsize boundaries, if the original array did not have its ALIGNED
> flag set.
You can assume your malloc guaranteed alignment from the memory
allocation functions, though. Even if/when aligned allocator will be
available in numpy, only newly allocated buffers will be concerned.
cheers,
David
More information about the SciPy-User
mailing list