[Numpy-discussion] object array alignment issues
Pauli Virtanen
pav+sp@iki...
Fri Oct 16 06:53:45 CDT 2009
Fri, 16 Oct 2009 12:07:10 +0200, Francesc Alted wrote:
[clip]
> IMO, NumPy can be improved for unaligned data handling. For example,
> Numexpr is using this small snippet:
>
> from cpuinfo import cpu
> if cpu.is_AMD() or cpu.is_Intel():
> is_cpu_amd_intel = True
> else:
> is_cpu_amd_intel = False
>
> for detecting AMD/Intel architectures and allowing the code to avoid
> memcpy() calls for the unaligned arrays.
>
> The above code uses the excellent ``cpuinfo.py`` module from Pearu
> Peterson, which is distributed under NumPy, so it should not be too
> difficult to take advantage of this for avoiding unnecessary copies in
> this scenario.
I suppose this kind of check is easiest to do at compile-time, and
defining a -DFORCE_ALIGNED? This wouldn't cause performance penalties for
those architectures for which they are not necessary.
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list