GT4Py: GridTools for Python¶
GT4Py is a Python library to write typical weather and climate computations in Python using a compact, high-level specification, and to run them efficiently on multiple hardware platforms. It is part of the GridTools framework, a set of libraries and utilities to develop performance portable applications in this area.
Currently, two generations live side by side in the library: gt4py.next and
gt4py.cartesian. gt4py.next is where most of the active development happens.
gt4py.cartesian is the previous generation, which is still maintained for
the models relying on it and enriched with features where needed.
To install GT4Py or get involved in its development, check the project repository.
GT4Py Next¶
gt4py.next is the current development version of GT4Py and the one to choose
for any new project.
Its language is fully embedded in Python: field operators and programs are regular Python functions working on fields defined over named dimensions, on both structured and unstructured meshes. They can be run directly by the Python interpreter, where GT4Py acts as a thin, domain-specific layer on top of standard array libraries, so they can be debugged and combined with other Python code like any other function. The very same definitions can be handed over to one of the performance backends, which generate optimized code for the target hardware.
Quickstart and guide to the DSL.
GT4Py Cartesian¶
gt4py.cartesian is the first generation of GT4Py. Stencils are written in
GTScript, a language using Python syntax which is always translated to
generated code, instead of being executed as regular Python, and which is
limited to Cartesian grids. It still delivers excellent performance, and it
is used by several models.
Its design and performance are described in the paper GT4Py: High Performance Stencils for Weather and Climate Applications using Python.
Quick start, GTScript language reference and API documentation.
gt4py.next and gt4py.cartesian share common infrastructure, but are independent DSLs and each one
has its own documentation. Note that although both can easily interoperate via
buffer sharing, code written for one of them does not work with the other.
License¶
GT4Py is licensed under the terms of the BSD-3-Clause license.