[pypy-dev] Interpretor for vectorized langugage

Maciej Fijalkowski fijall at gmail.com
Fri Dec 17 07:27:31 CET 2010


On Fri, Dec 17, 2010 at 1:12 AM, Paolo Giarrusso <p.giarrusso at gmail.com> wrote:
> On Thu, Dec 16, 2010 at 10:16, Armin Rigo <arigo at tunes.org> wrote:
>> Hi,
>
>>> have you seen numpy/scipy?
>
>> Of course you are then going to hit the same problems that Ademan
>> tries to solve for numpy/scipy, notably how to implement at least the
>> basic linear algebra operations in such a way that the JIT can improve
>> them.  There are various goals there, e.g. to turn Python (or Matlab)
>> code like A+B+C, adding three matrices together, into one matrix
>> operation instead of two (as it is now: (A+B)+C).  This is all a bit
>> experimental so far.
>
> [More about numpy/scipy]:
> How about the ideas from C++ expression templates? Or even better,
> some sort of lazy evaluation?
>
> With C++ expression templates [1], (A+B) returns something like
> PlusMatrix(A, B). When finally assigning to a variable, the copy
> constructor converts this into a real matrix; in the following line:
> D = (A+B) + C
> PlusMatrix(PlusMatrix(A, B), C) is built, and D gets the result.
>
> What they could further do, but they don't (see FAQ of uBlas [1]), is
> to cache the result of evaluating a template when requested; that
> could be cached (as in lazy evaluation - expressions like PlusMatrix
> are not very different from thunks, in that case) or maybe JIT
> compilation can recognize the constantness of this.
>
> Best regards
>
> [1] One library using them is Boost::uBlas, but the idea is much older:
> http://www.boost.org/doc/libs/1_45_0/libs/numeric/ublas/doc/index.htm
> --
> Paolo Giarrusso - Ph.D. Student
> http://www.informatik.uni-marburg.de/~pgiarrusso/
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev


Hi.

I did that (it's not published anywhere though) and it gave quite huge
speedups compared to numexpr or numpy. I'll look into implementing it
"properly" at some point (instead of doing that in pure python).



More information about the Pypy-dev mailing list