[Numpy-discussion] Modern Fortran vs NumPy syntax

Ondřej Čertík ondrej.certik at gmail.com
Thu Feb 7 18:57:10 EST 2013


Frédéric,

On Thu, Feb 7, 2013 at 11:31 AM, Frédéric Bastien <nouiz at nouiz.org> wrote:
> Hi,
>
> I just read a paper[1] that compare python with numpy or pypy vs c++ and
> fortran from a code, memory and speed point of view. The python code was
> still better as you can't have list of ndarray in fortran and some other
> stuff was harder to do. The fastest was fortran, then C++, but pypy around
> 2x slower then c++. That isn't bad for a more productive development
> language.
>
> Maybe you can check that article to find more case to compare.

Yes, I know about this article --- I've been in touch with Sylwester about it,
as I found his code on github a few months ago, so we discussed it.
I also CCed him if he wants to add some comments.

The article is well balanced. To my taste, they use way too much OOP
in the Fortran version,
in fact I am bit surprised that Fortran was still the fastest, even
with the OOP. But Sylwester was interested in comparing OOP
approaches, so that's fair.

If I have time (which I don't see likely soon, but who knows), I will
see if I can write a simple direct non-OOP version of their Fortran
code:

https://github.com/slayoo/mpdata

Possibly just by understanding the original reference [2] and see what
datastructures/arrays I would use to implement it.
In general however, I like their approach, that they took a real world
method and not some artificial benchmark.
So it's a very good contribution.

Ondrej

[2] Smolarkiewicz, P. K. (1984). A Fully Multidimensional Positive
Definite Advection Transport Algorithm with Small Implicit Diffusion.
Journal of Computational Physics, 54(2), 325–362.



More information about the NumPy-Discussion mailing list