[Numpy-discussion] numpy arrays, data allocation and SIMD alignement

Stefan van der Walt stefan at sun.ac.za
Thu Aug 9 05:40:23 EDT 2007


On Thu, Aug 09, 2007 at 04:52:38PM +0900, David Cournapeau wrote:
> Charles R Harris wrote:
> >
> > Well, what you want might be very easy to do in python, we just need 
> > to check the default alignments for doubles and floats for some of the 
> > other compilers, architectures, and OS's out there. On the other hand, 
> > you might not be able to request a c malloc that is aligned in a 
> > portable way without resorting to the same tricks as you do in python. 
> > So why not use python and get the reference counting and garbage 
> > collection along with it?
> First, doing it in python means that I cannot use the facility from C 
> easily. But this is exactly where I need it, and where I would guess 
> most people need it. People want to interface numpy with the mkl ? They 
> will do it in C, right ?

It doesn't really matter where the memory allocation occurs, does it?
As far as I understand, the underlying fftw function has some flag to
indicate when the data is aligned.  If so, we could expose that flag
in Python, and do something like

x = align16(data)
_fft(x, is_aligned=True)

I am not intimately familiar with the fft wrappers, so maybe I'm
missing something more fundamental.

Cheers
Stéfan



More information about the NumPy-Discussion mailing list