Abstract

Abstract. A general circulation ocean model is translated from Fortran to Python. Its code structure is optimized to exploit available Python utilities, remove simulation bottlenecks, and comply with modern best practices. Furthermore, support for Bohrium is added, a framework that provides a just-in-time compiler for array operations and that supports parallel execution on both CPU and GPU targets. For applications containing more than a million grid elements, such as a typical 1∘×1∘ horizontal resolution global ocean model, Veros is approximately half as fast as the MPI-parallelized Fortran base code on 24 CPUs and as fast as the Fortran reference when running on a high-end GPU. By replacing the original conjugate gradient stream function solver with a solver from the pyAMG Python package, this particular subroutine outperforms the corresponding Fortran version by up to 1 order of magnitude. The study is concluded with a simple application in which the North Atlantic wave response to a Southern Ocean wind perturbation is investigated. It is found that even in a realistic setting the phase speeds of boundary waves matched the expectations based on theory and idealized models.

Highlights

  • Numerical simulations have been used to advance our understanding of the ocean circulation for more than 50 years (e.g., Bryan, 2006), and in particular for regimes that are difficult to treat analytically, they have become irreplaceable

  • When using NumPy, array operations in Fortran can be translated to Python with relative ease, as long as a couple of pitfalls are avoided

  • Since there is an active community of researchers developing Python packages, many sophisticated tools are just one import statement away, and the dynamic nature of Python allows for some elegant implementations that would be infeasible or outright impossible in Fortran 90

Read more

Summary

Introduction

Numerical simulations have been used to advance our understanding of the ocean circulation for more than 50 years (e.g., Bryan, 2006), and in particular for regimes that are difficult to treat analytically, they have become irreplaceable. Ocean models are typically written to optimize the use of computing rather than human resources using low-level programming languages such as Fortran or C These languages’ core design, lack of abstraction, and established coding patterns often make it a daunting challenge to, for example, keep track of indices or global variables. In the case of Python, additional abstraction, a powerful standard library, and its immense popularity in the scientific community, which has in turn created a wide range of learning resources and a large third-party package ecosystem, lower the bar of entry for inexperienced programmers This is one of our main motivations behind developing Veros: in our experience, a substantial amount of the duration of MSc and PhD projects is devoted to understanding, writing, and debugging legacy Fortran code.

Implementation
From Fortran to naive Python
Vectorization
Further modifications
Dynamic back-end handling
Generic stream function solvers
Multi-threaded I–O with compression
Back-end-specific tridiagonal matrix solvers
Modular diagnostic interface
Metadata handling
Quality assurance
About Bohrium
Consistency check
Benchmarks
Overall performance
Stream function solver
Application
Modified geometry with flexible resolution
The experiment
Findings
Summary and outlook
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.