[Numpy-discussion] numpy arrays, data allocation and SIMD alignement
Tue Aug 7 00:00:20 CDT 2007
Anne Archibald wrote:
> I have to agree. I can hardly volunteer David for anything, and I
> don't have time to implement this myself, but I think a custom
> allocator is a rather special-purpose tool; if one were to implement
> one, I think the way to go would be to implement a subclass of ndarray
> (or just a constructor) that allocated the memory. This could be done
> from python, since you can make an ndarray from scratch using a given
> memory array. Of course, making temporaries be allocated with the
> correct allocator will be very complicated, since it's unclear which
> allocator should be used.
> Adding SIMD alignment should be a very small modification; it can be
> done as simply as using ctypes to wrap posix_memalign (or a portable
> version, possibly written in python) and writing a simple python
> function that checks the beginning data address. There's really no
> need to make it complicated.
Anne, you said previously that it was easy to allocate buffers for a
given alignment at runtime. Could you point me to a document which
explains how ? For platforms without posix_memalign, I don't see how to
implement a memory allocator with an arbitrary alignment (more
precisely, I don't see how to free it if I cannot assume a fixed
alignement: how do I know where the "real" pointer is ?).
More information about the Numpy-discussion