Pythran as a bridge between fast prototyping and code deployment
serge-sans-paille.github.io
serge-sans-paille.github.io
The Julia language was designed to target the two language problem and at least from these benchmarks it looks pretty competitive [1]. I imagine over time, pythran may fix some limitations and beat Julia in most benchmarks.
[1] https://github.com/fluiddyn/BenchmarksPythonJuliaAndCo/tree/...
That said, I want to try Pythran to see how it works for one of my at-home side projects.
I had to learn a bit of Julia about 20 months ago - an old customer got in a pinch when somewhen left before a deliverable so I was immersed using Julia for two weeks. At first I liked the idea of Julia but I didn’t fall in love with the language.
Was there anything specific that turned you off from Julia?
Another issue is that it's not always that fast, for a recent project I never managed to exceed 100 MFLOPS, at which point I switched to C++ and got 3 GFLOPS. But the python version stalled out at 4 MFLOPS though...
Care to share your code and see if it can be improved upon?
Well-written Julia should always be within a factor of 2-3 of C, often less. Huge problems are done in pure Julia now. Pure Julia code has been run on HPCs to over a petaflop, something that only C/C++ and Fortran have done. 100 MFLOP is not a problem.
"Written in the productivity language Julia, the Celeste project—which aims to catalogue all of the telescope data for the stars and galaxies in in the visible universe—demonstrated the first Julia application to exceed 1 PF/s of double-precision floating-point performance (specifically 1.54 PF/s)." [1]
[1] https://www.nextplatform.com/2017/11/28/julia-language-deliv...
Nuitka has fantastic Python 3 support (up to 3.7 currently).
Pythran main aim is to be fast, and to achieve this they're willing to only support a small subset of python.
As Nuitka's performance gets better and Pythran starts to support more and more of python, perhaps they'll converge at some point in the future.
It feels to me like Pythran + opencv would be a killer combination since it can take 300+ lines of C++ to achieve what you can with 40ish lines of numpy, opencv and python.
I see that you are involved with the Pythran project, so could you tell us the shortcomings of Cython? As I understand it, before Pythran didn't support Python 3, but seems like that has changed
In order to achieve top performance, in the context of numerical simulations, you generally end up explicity writing the loops are implicit in high-level numpy (less abstraction).
Cython does not perform any high-level optimisation on the code, while Pythran does. For instance Pytrhan computes whether an array index may be negative or not, and generates wraparound only when needed. On the otherhand Cython requires a compiler directive to do so.
That being said, Cython can do plenty of stuff Pythran cannot: import native libraries, wrap classes, mixed Python/native mode etc. It has a much stronger codebase (more tested/validated) and a larger community.
Thanks to both of you for the reply