Hi,
I have recently setup a page about modern Fortran:
and in particular, it has a long section with side by side syntax examples of Python/NumPy vs Fortran:
http://fortran90.org/src/rosetta.html
I would be very interested if some NumPy gurus would provide me feedback. I personally knew NumPy long before I learned Fortran, and I was amazed that the modern Fortran pretty much allows 1:1 syntax with NumPy, including most of all the fancy indexing etc.
Is there some NumPy feature that is not covered there? I would like it to be a nice resource for people who know NumPy to feel like at home with Fortran, and vice versa. I personally use both every day (Fortran a bit more than NumPy).
Or of you have any other comments or tips for the site, please let me know. Eventually I'd like to also put there C++ way of doing the same things, but at the moment I want to get Fortran and Python/NumPy done first.
Ondrej
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.
HTH
Fred
[1] http://arxiv.org/abs/1301.1334
On Thu, Feb 7, 2013 at 2:22 PM, Ondřej Čertík ondrej.certik@gmail.comwrote:
Hi,
I have recently setup a page about modern Fortran:
and in particular, it has a long section with side by side syntax examples of Python/NumPy vs Fortran:
http://fortran90.org/src/rosetta.html
I would be very interested if some NumPy gurus would provide me feedback. I personally knew NumPy long before I learned Fortran, and I was amazed that the modern Fortran pretty much allows 1:1 syntax with NumPy, including most of all the fancy indexing etc.
Is there some NumPy feature that is not covered there? I would like it to be a nice resource for people who know NumPy to feel like at home with Fortran, and vice versa. I personally use both every day (Fortran a bit more than NumPy).
Or of you have any other comments or tips for the site, please let me know. Eventually I'd like to also put there C++ way of doing the same things, but at the moment I want to get Fortran and Python/NumPy done first.
Ondrej _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
Frédéric,
On Thu, Feb 7, 2013 at 11:31 AM, Frédéric Bastien nouiz@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 nonOOP 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.
Hi All,
On 08/02/13 00:57, Ondřej Čertík wrote:
On Thu, Feb 7, 2013 at 11:31 AM, Frédéric Bastiennouiz@nouiz.org wrote:
... 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. ...
Thanks Frédéric and Ondřej for mentioning the paper here. I'll just add that the arXiv manuscript is a draft. We're working on a revised version to be posted on arXiv and submitted to a journal in a few weeks. Any comments are thus very much welcome! (http://arxiv.org/abs/1301.1334)
Regards, Sylwester
Thanks for providing this. Reference is excellent, especially as I was collecting Fortran and f2py resources, some month ago, and I found nothing similar to answers you expose.
Side by side syntax is just great and intuitive And rest is...
Thanks
On Thu, Feb 7, 2013 at 8:22 PM, Ondřej Čertík ondrej.certik@gmail.comwrote:
Hi,
I have recently setup a page about modern Fortran:
and in particular, it has a long section with side by side syntax examples of Python/NumPy vs Fortran:
http://fortran90.org/src/rosetta.html
I would be very interested if some NumPy gurus would provide me feedback. I personally knew NumPy long before I learned Fortran, and I was amazed that the modern Fortran pretty much allows 1:1 syntax with NumPy, including most of all the fancy indexing etc.
Is there some NumPy feature that is not covered there? I would like it to be a nice resource for people who know NumPy to feel like at home with Fortran, and vice versa. I personally use both every day (Fortran a bit more than NumPy).
Or of you have any other comments or tips for the site, please let me know. Eventually I'd like to also put there C++ way of doing the same things, but at the moment I want to get Fortran and Python/NumPy done first.
Ondrej _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
Hi Ondřej,
Any ideas that your manual syntax mapping would evolve to an automatic translation tool like i2py [http://code.google.com/p/i2py/]
Thanks.
On Thu, Feb 7, 2013 at 12:22 PM, Ondřej Čertík ondrej.certik@gmail.comwrote:
Hi,
I have recently setup a page about modern Fortran:
and in particular, it has a long section with side by side syntax examples of Python/NumPy vs Fortran:
http://fortran90.org/src/rosetta.html
I would be very interested if some NumPy gurus would provide me feedback. I personally knew NumPy long before I learned Fortran, and I was amazed that the modern Fortran pretty much allows 1:1 syntax with NumPy, including most of all the fancy indexing etc.
Is there some NumPy feature that is not covered there? I would like it to be a nice resource for people who know NumPy to feel like at home with Fortran, and vice versa. I personally use both every day (Fortran a bit more than NumPy).
Or of you have any other comments or tips for the site, please let me know. Eventually I'd like to also put there C++ way of doing the same things, but at the moment I want to get Fortran and Python/NumPy done first.
Ondrej _______________________________________________ NumPyDiscussion mailing list NumPyDiscussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpydiscussion
participants (5)

Frédéric Bastien

Gökhan Sever

klo uo

Ondřej Čertík

Sylwester Arabas