[Numpy-discussion] Deprecating PyDataMem_RENEW ?
David Cournapeau
david@ar.media.kyoto-u.ac...
Mon May 5 07:44:51 CDT 2008
Hi,
While working again on the fftpack module, to clean things up and
speed some backends (in particular fftw3, which is really sub-optimal
right now), I remembered how much unaligned data pointer in numpy arrays
hurt performances. So I would like to relaunch the discussion on aligned
allocators and default alignement for numpy arrays :
http://www.mail-archive.com/numpy-discussion@scipy.org/msg04005.html
Basically, what I have in mind is, in a first step (for numpy 1.2):
- define functions to allocate on a given alignement
- make PyMemData_NEW 16 byte aligned by default (to be compatible
with SSE and co).
The problem was, and still is, realloc. It is not possible to implement
realloc with malloc/free (in a portable way), and as such, it is not
possible to have an aligned realloc.
In numpy, we can always replace realloc by malloc/free, because we know
the size of the old block: would deprecating PyMemData_RENEW and
replacing them by PyMemeData_NEW/PyMemData_FREE be possible, such as to
make all numpy arrays follow a default alignement ? There are only a few
of them in numpy (6 of them), 0 in scipy, and I guess extensions never
really used them ?
cheers,
David
More information about the Numpy-discussion
mailing list