[SciPy-user] numpy aligned memory

Sturla Molden sturla@molden...
Thu Mar 12 16:18:36 CDT 2009


> On 12/03/09 08:05, Andrew Straw wrote:

> I don't think fftw_malloc is doing that either (I don't know how it
> could as it doesn't have any information about the shape of the
> allocated data), so I doubt fftw will profit from this. That's not
> saying some other things might profit from this.

Here's a version that makes sure the fastest varying version stays aligned
if the keyword argument 'imagealign' is True.

After a lot of trial and error I got it working. The trick is aligning the
very first element, and adding the right amount of padding to each row.
The length of each padded row has to be myltiple of the itemsize and the
alignment boundary.

It seems to work. If you find bugs, please correct.

Regards,

Sturla Molden



-------------- next part --------------
A non-text attachment was scrubbed...
Name: alignedarray.py
Type: text/x-python
Size: 3079 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20090312/3a879d16/attachment.py 


More information about the SciPy-user mailing list