A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

GT4Py

Library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language.
https://github.com/GridTools/gt4py

Category: Climate Change
Sub Category: Climate Data Processing and Analysis

Keywords from Contributors

fpga high-level-synthesis programming-language vivado-hls climate-modeling climate embedded-ds water

Last synced: about 3 hours ago
JSON representation

Repository metadata

Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL).

README.md

logo

license
slack

Daily CI
test-cartesian
test-next
test-storage
test-eve
qa

uv
Nox

GT4Py: GridTools for Python

GT4Py is a Python library for generating high performance implementations of stencil kernels from a high-level definition using regular Python functions. GT4Py is part of the GridTools framework, a set of libraries and utilities to develop performance portable applications in the area of weather and climate modeling.

NOTE: The gt4py.next subpackage contains a new version of GT4Py which is not compatible with the current stable version defined in gt4py.cartesian. The new version is still experimental.

📃 Description

GT4Py is a Python library for expressing computational motifs as found in weather and climate applications. These computations are expressed in a domain specific language (GTScript) which is translated to high-performance implementations for CPUs and GPUs.

The DSL expresses computations on a 3-dimensional Cartesian grid. The horizontal axes (I, J) are always computed in parallel, while the vertical (K) can be iterated in sequential, forward or backward, order. Cartesian offsets are expressed relative to a center index.

In addition, GT4Py provides functions to allocate arrays with memory layout suited for a particular backend.

The following backends are supported:

  • numpy: Pure-Python backend
  • gt:cpu_ifirst: GridTools C++ CPU backend using I-first data ordering
  • gt:cpu_kfirst: GridTools C++ CPU backend using K-first data ordering
  • gt:gpu: GridTools backend for CUDA
  • cuda: CUDA backend minimally using utilities from GridTools
  • dace:cpu: Dace code-generated CPU backend
  • dace:gpu: Dace code-generated GPU backend

🚜 Installation

GT4Py can be installed as a regular Python package using uv, pip or any other PEP-517 compatible frontend. We strongly recommended to useuv to create and manage virtual environments for your own projects.

⚙ Configuration

Other useful available environment variables are:

  • CUDA_ARCH: Set the compute capability of the NVIDIA GPU if it is not detected automatically by cupy.
  • CXX: Set the C++ compiler.
  • GT_CACHE_DIR_NAME: Name of the compiler's cache directory (defaults to .gt_cache)
  • GT_CACHE_ROOT: Path to the compiler cache (defaults to ./)

More options and details are available in config.py.

🛠 Development Instructions

Follow the installation instructions below to initialize a development virtual environment containing an editable installation of the GT4Py package. Make sure you read the CONTRIBUTING.md and CODING_GUIDELINES.md documents before you start working on the project.

Development Environment Installation using uv

GT4Py uses the uv project manager for the development workflow. uv is a versatile tool that consolidates functionality usually distributed across different applications into subcommands.

  • The uv pip subcommand provides a fast Python package manager, emulating pip.
  • The uv export | lock | sync subcommands manage dependency versions in a manner similar to the pip-tools command suite.
  • The uv init | add | remove | build | publish | ... subcommands facilitate project development workflows, akin to hatch.
  • The uv tool subcommand serves as a runner for Python applications in isolation, similar to pipx.
  • The uv python subcommands manage different Python installations and versions, much like pyenv.

We require a reasonably recent version of uv, which can be installed in various ways (see its installation instructions), with the recommended method being the standalone installer:

$ curl -LsSf https://astral.sh/uv/install.sh | sh

Once uv is installed in your system, it is enough to clone this repository and let uv handling the installation of the development environment.

# Clone the repository
git clone https://github.com/gridtools/gt4py.git
cd gt4py

# Let uv create the development environment at `.venv`.
# The `--extra all` option tells uv to install all the optional
# dependencies of gt4py, and thus it is not strictly necessary.
# Note that if no dependency groups are provided as an option,
# uv uses `--group dev` by default so the development dependencies
# are installed.
uv sync --extra all

# Finally, activate the virtual environment and start writing code!
source .venv/bin/activate

The newly created venv is a standard Python virtual environment preconfigured with all necessary runtime and development dependencies. Additionally, the gt4py package is installed in editable mode, allowing for seamless development and testing. To install new packages in this environment, use the uv pip subcommand which emulates the pip interface and is generally much faster than the original pip tool (which is also available within the venv although its use is discouraged).

The pyproject.toml file contains both the definition of the gt4py Python distribution package and the settings of the development tools used in this project, most notably uv, ruff, and mypy. It also contains dependency groups (see PEP 735 for further reference) with the development requirements listed in different groups (build, docs, lint, test, typing, ...) and collected together in the general dev group, which gets installed by default by uv as mentioned above.

Development Tasks (dev-tasks.py)

Recurrent development tasks like bumping versions of used development tools or required third party dependencies have been collected as different subcommands in the dev-tasks.py script. Read the tool help for a brief description of every task and always use this tool to update the versions and sync the version configuration accross different files (e.g. pyproject.toml and .pre-commit-config.yaml).

📖 Documentation

GT4Py uses the Sphinx tool for the documentation. To build browseable HTML documentation, install the required tools provided in the docs dependency group:

uv sync --group docs --extra all  # or --group dev

(Note that most likely these tools are already installed in your development environment, since the docs group is included in the dev group, which installed by default by uv sync if no dependency groups are specified.)

Once the requirements are already installed, then build the docs using:

cd gt4py/docs/user/cartesian
make html  # run 'make help' for a list of targets

⚖️ License

GT4Py is licensed under the terms of the BSD-3-Clause.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 1,389
Total Committers: 33
Avg Commits per committer: 42.091
Development Distribution Score (DDS): 0.844

Commits in past year: 343
Committers in past year: 16
Avg Commits per committer in past year: 21.438
Development Distribution Score (DDS) in past year: 0.729

Name Email Commits
Hannes Vogt h****s@h****e 217
Till Ehrengruber t****r@c****h 187
Johann Dahm j****m@g****m 158
edopao e****e@c****h 147
Enrique G. Paredes 1****s 129
gronerl l****r@c****h 105
Felix Thaler t****r@c****h 70
Rico Haeuselmann r****n@g****h 67
Nicoletta Farabullini 4****i 53
Roman Cattaneo r****c 42
Rico Häuselmann r****h@c****h 41
Philip Müller 1****r 41
eddie-c-davis 2****s 27
Péter Kardos k****4@h****m 19
SF-N s****i@e****t 19
Florian Deconinck d****n@g****m 14
Stefano Ubbiali s****i@p****h 11
Tobias Wicky w****b@g****m 7
Eddie Davis e****d@v****m 7
Samuel k****l@g****m 6
mroethlin 5****n 4
ninaburg 8****g 3
BenWeber42 d****r@g****m 2
Christos Kotsalos c****s@c****h 2
Magdalena l****m@e****h 2
abishekg7 5****7 2
Kalman Szenes 5****s 1
Oliver Elbert o****6@g****m 1
Oliver Fuhrer o****r 1
Tal Ben-Nun t****n 1
and 3 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 138
Total pull requests: 878
Average time to close issues: over 1 year
Average time to close pull requests: 23 days
Total issue authors: 24
Total pull request authors: 23
Average comments per issue: 1.12
Average comments per pull request: 0.85
Merged pull request: 651
Bot issues: 0
Bot pull requests: 6

Past year issues: 45
Past year pull requests: 500
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 10 days
Past year issue authors: 11
Past year pull request authors: 17
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.83
Past year merged pull request: 368
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/GridTools/gt4py

Top Issue Authors

  • havogt (26)
  • tehrengruber (20)
  • jdahm (18)
  • egparedes (11)
  • romanc (10)
  • gronerl (10)
  • mbianco (6)
  • xyuan (5)
  • FlorianDeconinck (4)
  • petiaccja (4)
  • philip-paul-mueller (3)
  • DropD (3)
  • samkellerhals (3)
  • nfarabullini (3)
  • muellch (2)

Top Pull Request Authors

  • edopao (205)
  • havogt (174)
  • tehrengruber (162)
  • philip-paul-mueller (60)
  • egparedes (54)
  • romanc (53)
  • nfarabullini (32)
  • DropD (29)
  • SF-N (25)
  • FlorianDeconinck (19)
  • samkellerhals (14)
  • petiaccja (11)
  • twicki (8)
  • dependabot[bot] (6)
  • gronerl (6)

Top Issue Labels

  • gt4py.cartesian (49)
  • gt4py.next (42)
  • triage: bug (27)
  • triage: enhancement (25)
  • module: backend (20)
  • declarative (14)
  • module: frontend (12)
  • module: tests (9)
  • module: dace (9)
  • priority: low (7)
  • good first issue (6)
  • priority: high (4)
  • triage: performance (4)
  • module: analysis (4)
  • priority: intermediate (3)
  • module: storage (3)
  • cartesian (2)
  • module: documentation (2)
  • infrastructure (2)
  • triage: exploration (2)
  • triage: invalid (1)
  • feedback wanted (1)

Top Pull Request Labels

  • dependencies (6)
  • move to main (5)
  • gt4py.cartesian (5)

Package metadata

pypi.org: gt4py

Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL)

  • Homepage: https://gridtools.github.io/
  • Documentation: https://gridtools.github.io/gt4py
  • Licenses: BSD License
  • Latest release: 1.0.4 (published 7 months ago)
  • Last Synced: 2025-04-26T13:41:00.057Z (1 day ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 569 Last month
  • Rankings:
    • Forks count: 6.289%
    • Dependent packages count: 7.31%
    • Stargazers count: 7.463%
    • Dependent repos count: 11.798%
    • Average: 14.242%
    • Downloads: 38.348%
  • Maintainers (1)

Dependencies

requirements-dev.txt pypi
  • bump2version >=1.0.1 development
  • check-manifest >=0.40 development
  • darglint >=1.6 development
  • factory-boy >=3.1 development
  • flake8 >=5.0.4 development
  • flake8-bugbear >=20.11.1 development
  • flake8-builtins >=1.5.3 development
  • flake8-debugger >=4.0.0 development
  • flake8-docstrings >=1.5.0 development
  • flake8-eradicate >=1.0.0 development
  • flake8-mutable >=1.2.0 development
  • flake8-rst-docstrings >=0.0.14 development
  • hypothesis >=4.14 development
  • isort * development
  • mypy >=0.980 development
  • pre-commit * development
  • psutil >=5.0 development
  • pygments >=2.7 development
  • pytest * development
  • pytest-cache >=1.0 development
  • pytest-factoryboy >=2.0 development
  • pytest-xdist >=2.4 development
  • seed-isort-config * development
  • setuptools >=40.8.0 development
  • sphinx * development
  • sphinx_rtd_theme * development
  • tox >=3.14 development
.github/workflows/_disabled/documentation.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/_disabled/eve_coverage.yml actions
.github/workflows/_disabled/gt4py-sphinx.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
.github/workflows/_disabled/gt4py_coverage.yml actions
.github/workflows/_disabled/template_coverage.yml actions
  • actions/checkout v3 composite
  • actions/github-script v6 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/code-quality.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pre-commit/action v3.0.0 composite
.github/workflows/daily-ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • slackapi/slack-github-action v1.23.0 composite
.github/workflows/deploy-release.yml actions
  • actions/checkout master composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/test-cartesian-fallback.yml actions
.github/workflows/test-cartesian.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v4 composite
.github/workflows/test-eve-fallback.yml actions
.github/workflows/test-eve.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/test-next-fallback.yml actions
.github/workflows/test-next.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/test-storage-fallback.yml actions
.github/workflows/test-storage.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
min-extra-requirements-test.txt pypi
  • astunparse ==1.6.3 test
  • attrs ==21.3 test
  • black ==22.3 test
  • boltons ==20.1 test
  • cached-property ==1.5.1 test
  • clang-format ==9.0 test
  • click ==8.0.0 test
  • cmake ==3.22 test
  • cogapp ==3.3 test
  • coverage ==5.0 test
  • cytoolz ==0.12.0 test
  • dace ==0.14.2 test
  • darglint ==1.6 test
  • deepdiff ==5.6.0 test
  • devtools ==0.6 test
  • factory-boy ==3.1 test
  • flake8 ==5.0.4 test
  • flake8-bugbear ==20.11.1 test
  • flake8-builtins ==1.5.3 test
  • flake8-debugger ==4.0.0 test
  • flake8-docstrings ==1.5.0 test
  • flake8-eradicate ==1.3.0 test
  • flake8-mutable ==1.2.0 test
  • flake8-pyproject ==1.2.2 test
  • flake8-rst-docstrings ==0.0.14 test
  • frozendict ==2.3 test
  • gridtools-cpp ==2.3.1 test
  • hypothesis ==6.0.0 test
  • importlib-resources ==5.0 test
  • isort ==5.10 test
  • jax ==0.4.13 test
  • jinja2 ==3.0.0 test
  • jupytext ==1.14 test
  • lark ==1.1.2 test
  • mako ==1.1 test
  • mypy ==1.0 test
  • nanobind ==1.4.0 test
  • ninja ==1.10 test
  • numpy ==1.21.2 test
  • packaging ==20.0 test
  • pip-tools ==6.10 test
  • pipdeptree ==2.3 test
  • pre-commit ==2.17 test
  • psutil ==5.0 test
  • pybind11 ==2.5 test
  • pygments ==2.7 test
  • pytest ==7.0 test
  • pytest-cache ==1.0 test
  • pytest-cov ==2.8 test
  • pytest-factoryboy ==2.0.3 test
  • pytest-xdist ==2.4 test
  • ruff ==0.0.265 test
  • scipy ==1.7.2 test
  • setuptools ==65.5.0 test
  • sphinx ==4.4 test
  • sphinx_rtd_theme ==1.0 test
  • sympy ==1.7 test
  • tabulate ==0.8.10 test
  • tomli ==2.0.1 test
  • tox ==3.2.0 test
  • types-all ==1.0.0 test
  • typing-extensions ==4.2 test
  • xxhash ==1.4.4 test
min-requirements-test.txt pypi
  • astunparse ==1.6.3 test
  • attrs ==21.3 test
  • black ==22.3 test
  • boltons ==20.1 test
  • cached-property ==1.5.1 test
  • clang-format ==9.0 test
  • click ==8.0.0 test
  • cmake ==3.22 test
  • cogapp ==3.3 test
  • coverage ==5.0 test
  • cytoolz ==0.12.0 test
  • darglint ==1.6 test
  • deepdiff ==5.6.0 test
  • devtools ==0.6 test
  • factory-boy ==3.1 test
  • flake8 ==5.0.4 test
  • flake8-bugbear ==20.11.1 test
  • flake8-builtins ==1.5.3 test
  • flake8-debugger ==4.0.0 test
  • flake8-docstrings ==1.5.0 test
  • flake8-eradicate ==1.3.0 test
  • flake8-mutable ==1.2.0 test
  • flake8-pyproject ==1.2.2 test
  • flake8-rst-docstrings ==0.0.14 test
  • frozendict ==2.3 test
  • gridtools-cpp ==2.3.1 test
  • hypothesis ==6.0.0 test
  • importlib-resources ==5.0 test
  • isort ==5.10 test
  • jinja2 ==3.0.0 test
  • jupytext ==1.14 test
  • lark ==1.1.2 test
  • mako ==1.1 test
  • mypy ==1.0 test
  • nanobind ==1.4.0 test
  • ninja ==1.10 test
  • numpy ==1.21.2 test
  • packaging ==20.0 test
  • pip-tools ==6.10 test
  • pipdeptree ==2.3 test
  • pre-commit ==2.17 test
  • psutil ==5.0 test
  • pybind11 ==2.5 test
  • pygments ==2.7 test
  • pytest ==7.0 test
  • pytest-cache ==1.0 test
  • pytest-cov ==2.8 test
  • pytest-factoryboy ==2.0.3 test
  • pytest-xdist ==2.4 test
  • ruff ==0.0.265 test
  • setuptools ==65.5.0 test
  • sphinx ==4.4 test
  • sphinx_rtd_theme ==1.0 test
  • tabulate ==0.8.10 test
  • tomli ==2.0.1 test
  • tox ==3.2.0 test
  • types-all ==1.0.0 test
  • typing-extensions ==4.2 test
  • xxhash ==1.4.4 test
pyproject.toml pypi
  • astunparse >=1.6.3;python_version<'3.9'
  • attrs >=21.3
  • black >=22.3
  • boltons >=20.1
  • cached-property >=1.5.1
  • click >=8.0.0
  • cmake >=3.22
  • cytoolz >=0.12.0
  • deepdiff >=5.6.0
  • devtools >=0.6
  • frozendict >=2.3
  • gridtools-cpp >=2.3.1,==2.*
  • importlib-resources >=5.0;python_version<'3.9'
  • jinja2 >=3.0.0
  • lark >=1.1.2
  • mako >=1.1
  • nanobind >=1.4.0
  • ninja >=1.10
  • numpy >=1.21.2
  • packaging >=20.0
  • pybind11 >=2.5
  • setuptools >=65.5.0
  • tabulate >=0.8.10
  • typing-extensions >=4.2,<4.6.0
  • xxhash >=1.4.4,<3.1.0
requirements-dev.in pypi
  • clang-format >=9.0 development
  • cogapp >=3.3 development
  • coverage >=5.0 development
  • darglint >=1.6 development
  • factory-boy >=3.1 development
  • flake8 >=5.0.4 development
  • flake8-bugbear >=20.11.1 development
  • flake8-builtins >=1.5.3 development
  • flake8-debugger >=4.0.0 development
  • flake8-docstrings >=1.5.0 development
  • flake8-eradicate >=1.3.0 development
  • flake8-mutable >=1.2.0 development
  • flake8-pyproject >=1.2.2 development
  • flake8-rst-docstrings >=0.0.14 development
  • hypothesis >=6.0.0 development
  • isort >=5.10 development
  • jupytext >=1.14 development
  • mypy >=1.0 development
  • pip-tools >=6.10 development
  • pipdeptree >=2.3 development
  • pre-commit >=2.17 development
  • psutil >=5.0 development
  • pygments >=2.7 development
  • pytest >=7.0 development
  • pytest-cache >=1.0 development
  • pytest-cov >=2.8 development
  • pytest-factoryboy >=2.0.3 development
  • pytest-xdist >=2.4 development
  • ruff >=0.0.265 development
  • sphinx >=4.4 development
  • sphinx_rtd_theme >=1.0 development
  • tomli >=2.0.1 development
  • tox >=3.2.0 development
  • types-all >=1.0.0 development

Score: 15.469664059033617