[Numpy-discussion] Question about Optimization (Inline, and Pyrex)
Wed Apr 18 00:33:53 CDT 2007
On 18/04/07, Robert Kern <firstname.lastname@example.org> wrote:
> Sebastian Haase wrote:
> > Hi,
> > I don't know much about ATLAS -- would there be other numpy functions
> > that *could* or *should* be implemented using ATLAS !?
> > Any ?
> Not really, no.
ATLAS is a library designed to implement linear algebra functions
efficiently on many machines. It does things like reorder the
multiplications and additions in matrix multiplication to make the
best possible use of your cache, as measured by empirical testing.
(FFTW does something similar for the FFT.) But ATLAS is only designed
for linear algebra. If what you want to do is linear algebra, look at
scipy for a full selection of linear algebra routines that make fairly
good use of ATLAS where applicable.
It would be perfectly possible, in principle, to implement an
ATLAS-like library that handled a variety (perhaps all) of numpy's
basic operations in platform-optimized fashion. But implementing ATLAS
is not a simple process! And it's not clear how much gain would be
available - it would almost certainly be noticeably faster only for
very large numpy objects (where the python overhead is unimportant),
and those objects can be very inefficient because of excessive
copying. And the scope of improvement would be very limited; an
expression like A*B+C*D would be much more efficient, probably, if the
whole expression were evaluated at once for each element (due to
memory locality and temporary allocation). But it is impossible for
numpy, sitting inside python as it does, to do that.
Anne M. Archibald
More information about the Numpy-discussion