In the paper we compare object-oriented implementations of an advection algorithm written in Python, C++ and modern FORTRAN. The MPDATA advection algorithm (Multidimensional Positive-Definite Advective Transport Algorithm) used as a core of weather, ocean and climate modelling systems serves as an example.
In the context of scientific programming, employment of object-oriented programming (OOP) techniques may help to improve code readability, and hence its auditability and maintainability. OOP offers, in particular, the possibility to reproduce in the program code the mathematical "blackboard abstractions" used in the literature. We compare how the choice of a particular language influences syntax clarity, code length and the performance: CPU time and memory usage.
The Python implementation of MPDATA is based on NumPy. Its performance is compared with C++/Blitz++ and FORTRAN implementations. A notable performance gain when switching from the standard CPython to PyPy will be exemplified, and the reasons for it will be briefly explained. Discussion of other selected solutions for improving the NumPy’s relatively poor performance (including Cython, Numba and others) will be also presented.
This talk will describe and extend on the key findings presented in http://arxiv.org/abs/1301.1334