[SciPy-Dev] The state of weave.accelerate?

Helio Perroni Filho xperroni at gmail.com
Sun Apr 17 09:37:19 EDT 2011


Dera all,

I have been looking for ways to speed up some portions of Python code
in my current scipy project. The ideal solution would allow me to keep
writing all my code in Python 2.7 – even if the "accelerated" parts
had to written in a subset of the language, as in PyPy's Restricted
Python – and be easily turned off for debugging.

When I learned of scipy.weave.inline, my first thought was "now if
only there was a Python-to-C++ translator I could hook up to this!" I
was intrigued when I found that cryptic reference about
sicpy.weave.accelerate providing "automatic acceleration of Python
code"; all the more after searching for more information on it, and
finding none.

So I decided to take a look at the code. The API seemed simple enough
(just a decorator for top-level functions), so I tried it on some toy
scripts I keep around. After hacking around a couple simple bugs (two
incorrect assertions in bytecodecompiler, a typo defining the
one-argument form of the range function and the need to add weave's
directory to the compiler include-path in accelerate_tools) I got
stuck on the many not-yet-implemented instructions in
bytecodecompiler: it seems even basic arithmetic is still to be
included.

I find this frustrating. From the tests I've run it seems accelerate()
already does an adequate work of generating the necessary C++
boilerplate code, compiling it to an extension and then wiring the
result back to the executing script. The only thing missing is getting
the C++ translation to work – not trivial, I know, but not very hard
either, considering what's already in place.

Is a lack of manpower holding accelerate() back? If that's the case, I
volunteer to work on bytecodecompiler, and get it to at least an
RPython-level of functionality. I have read the documentation on the
Developer Zone, but didn't find how do I create a Trac account. And
besides that, is there anything else not on that page that I should
know?

-- 
Ja ne,
Helio Perroni Filho
http://machineawakening.blogspot.com/



More information about the SciPy-Dev mailing list