[Numpy-discussion] Byte aligned arrays

Nathaniel Smith njs at pobox.com
Wed Dec 19 13:48:29 EST 2012

On Wed, Dec 19, 2012 at 6:25 PM, Henry Gomersall <heng at cantab.net> wrote:
> On Wed, 2012-12-19 at 19:03 +0100, Francesc Alted wrote:
> <snip>
>> > Finally, I think there is significant value in auto-aligning the
>> array
>> > based on an appropriate inspection of the cpu capabilities (or
>> > alternatively, a function that reports back the appropriate SIMD
>> > alignment). Again, this makes it easier to wrap libraries that may
>> > function with any alignment, but benefit from optimum alignment.
>> Hmm, NumPy seems to return data blocks that are aligned to 16 bytes
>> on
>> systems (Linux and Mac OSX):
> <snip>
> That is not true at least under Windows 32-bit. I think also it's not
> true for Linux 32-bit from my vague recollections of testing in a
> virtual machine. (disclaimer: both those statements _may_ be out of
> date).
> But yes, under Linux 64-bit I always get my arrays aligned to 16 bytes.

Currently numpy just uses whatever the system malloc() returns, so the
alignment guarantees are entirely determined by your libc.


More information about the NumPy-Discussion mailing list