[SciPy-Dev] Using Pythran to compile some of the scipy internals

Serge Guelton serge.guelton at telecom-bretagne.eu
Mon Jan 22 17:34:57 EST 2018


On Mon, Jan 22, 2018 at 04:34:32PM +0100, Daπid wrote:
> 
> On 20 January 2018 at 11:10, Serge Guelton <serge.guelton at telecom-bretagne.eu>
> wrote:
> 
>     = Cost?
> 
>     This adds an extra dependency on Pythran, which uses C++ as backend.
>     This increases the failure surface. Although alive since 2012 and being
>     tested a lot [1] on Linux (but scarcely on Windows), its is obviously
>     less mature than cython
> 
> 
> I think this is a blocker, but it seems it is on its way to be fixed:
> 
> "Pythran supports Python 2.7 and also has a beta Python 3 support."
> 
> scipy has a lot of Cython code, much of it fairly well tested, which can be
> very useful for testing Pythran itself.

Yes, I started integrating cython code from scipy into pythran testbed,
after converting them back to Python. It did found some bugs in Pythran,
so that's great!

> A question, does Pythran eliminate the need for storing intermediate results?

Yep, it turns code like

    a = b + 1
    c = a * 2

into

    c = (b + 1) * 2

It of course also handles interaction with control flow to
forward-substitute only if it does not triggers recomputation.

> Like (a*a).sum(axis=1) for a large a, will it store the full a-squared? (If it
> is, I'd be very sorry I didn't run into it earlier, and very happy I finally
> did).

Yes, it does perfom lazy evaluation.


More information about the SciPy-Dev mailing list