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: 1 day 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-components
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: A vectorized 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
  • dace:cpu: Dace code-generated CPU backend
  • dace:cpu_kfirst: Dace code-generated CPU backend using K-first data ordering
  • dace:gpu: Dace code-generated GPU backend
  • debug: A pure python backend used for prototyping new features

🚜 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`.
uv sync --extra cartesian  # for gt4py.cartesian. Include DaCe with: --group dace-cartesian
uv sync --extra next       # for gt4py.next. Include DaCe with: --group dace-next

# The `--extra cartesian` (or `--extra next`) option tells uv to install
# the optional run-time dependencies of gt4py.cartesian (or gt4py.next),
# and thus it is not strictly necessary.
# The 'dev' group with the core development dependencies is installed by default.
# DaCe-related dependencies are different for gt4py.cartesian and gt4py.next,
# so they won't be installed unless the specific dace group option is added.

# 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 (/scripts)

Recurrent development tasks like bumping versions of used development tools or required third party dependencies have been collected as separate modules in the /scripts folder, and collected as subcommands of the scripts-cli.py tool. 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 across 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 standard  # 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: about 2 months ago

Total Commits: 1,672
Total Committers: 34
Avg Commits per committer: 49.176
Development Distribution Score (DDS): 0.849

Commits in past year: 501
Committers in past year: 13
Avg Commits per committer in past year: 38.538
Development Distribution Score (DDS) in past year: 0.756

Name Email Commits
Hannes Vogt h****s@h****e 252
edopao e****e@c****h 217
Till Ehrengruber t****r@c****h 212
Johann Dahm j****m@g****m 158
Enrique González Paredes e****g@c****h 148
Philip Müller 1****r 108
gronerl l****r@c****h 105
Roman Cattaneo r****c 84
Felix Thaler t****r@c****h 70
Rico Haeuselmann r****n@g****h 67
Nicoletta Farabullini 4****i 54
Rico Häuselmann r****h@c****h 41
eddie-c-davis 2****s 27
SF-N s****i@e****t 25
Florian Deconinck d****n@g****m 20
Péter Kardos k****4@h****m 19
Stefano Ubbiali s****i@p****h 11
Tobias Wicky-Pfund w****b@g****m 10
Ioannis Magkanaris i****s@c****h 9
Eddie Davis e****d@v****m 7
Samuel k****l@g****m 6
mroethlin 5****n 4
ninaburg 8****g 3
abishekg7 5****7 2
Magdalena l****m@e****h 2
Christos Kotsalos c****s@c****h 2
BenWeber42 d****r@g****m 2
Kalman Szenes 5****s 1
Oliver Elbert o****6@g****m 1
Oliver Fuhrer o****r 1
and 4 more...

Committer domains:


Issue and Pull Request metadata

Last synced: about 2 months ago

Total issues: 132
Total pull requests: 1,653
Average time to close issues: 11 months
Average time to close pull requests: 20 days
Total issue authors: 26
Total pull request authors: 25
Average comments per issue: 0.93
Average comments per pull request: 0.77
Merged pull request: 1,183
Bot issues: 0
Bot pull requests: 6

Past year issues: 41
Past year pull requests: 888
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 7 days
Past year issue authors: 12
Past year pull request authors: 14
Past year average comments per issue: 0.68
Past year average comments per pull request: 0.67
Past year merged pull request: 615
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 (30)
  • tehrengruber (20)
  • romanc (12)
  • jdahm (12)
  • FlorianDeconinck (8)
  • egparedes (8)
  • edopao (6)
  • gronerl (6)
  • philip-paul-mueller (4)
  • petiaccja (3)
  • xyuan (3)
  • muellch (2)
  • samkellerhals (2)
  • nfarabullini (2)
  • mbianco (2)

Top Pull Request Authors

  • edopao (394)
  • havogt (303)
  • tehrengruber (256)
  • philip-paul-mueller (196)
  • romanc (139)
  • egparedes (103)
  • SF-N (50)
  • nfarabullini (43)
  • DropD (39)
  • FlorianDeconinck (33)
  • samkellerhals (15)
  • twicki (14)
  • petiaccja (14)
  • xyuan (8)
  • kotsaloscv (8)

Top Issue Labels

  • gt4py.cartesian (38)
  • gt4py.next (34)
  • triage: enhancement (22)
  • triage: bug (22)
  • module: backend (18)
  • declarative (14)
  • module: frontend (10)
  • module: dace (9)
  • priority: low (7)
  • good first issue (5)
  • priority: intermediate (4)
  • module: tests (4)
  • priority: high (3)
  • module: analysis (3)
  • triage: invalid (2)
  • module: storage (2)
  • triage: exploration (2)
  • cartesian (2)
  • triage: performance (1)
  • infrastructure (1)
  • triage: question (1)
  • module: eve (1)
  • module: documentation (1)
  • feedback wanted (1)

Top Pull Request Labels

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

Package metadata

proxy.golang.org: github.com/GridTools/gt4py

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/GridTools/gt4py#section-documentation
  • Licenses: bsd-3-clause
  • Latest release: v1.0.10 (published 2 months ago)
  • Last Synced: 2025-10-29T20:20:48.401Z (about 2 months ago)
  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 5.395%
    • Average: 5.576%
    • Dependent repos count: 5.758%
proxy.golang.org: github.com/gridtools/gt4py

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/gridtools/gt4py#section-documentation
  • Licenses: bsd-3-clause
  • Latest release: v1.0.10 (published 2 months ago)
  • Last Synced: 2025-10-29T20:20:48.638Z (about 2 months ago)
  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 5.395%
    • Average: 5.576%
    • Dependent repos count: 5.758%
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: gpl-3.0
  • Latest release: 1.0.10 (published 2 months ago)
  • Last Synced: 2025-10-29T20:20:48.894Z (about 2 months ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 38,665 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: 19.82570048567985