{"id":23831,"library":"gt4py","title":"GT4Py","description":"GT4Py (GridTools for Python) is a Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL). It supports multiple backends including numpy, CUDA, and DaCe. Currently at version 1.1.9, released irregularly (multiple minor releases per year). Requires Python >=3.10, <3.15.","status":"active","version":"1.1.9","language":"python","source_language":"en","source_url":"https://github.com/GridTools/gt4py","tags":["stencil","dsl","high-performance","weather","climate","hpc"],"install":[{"cmd":"pip install gt4py","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Stencil class is in the cartesian subpackage","wrong":"from gt4py import Stencil","symbol":"Stencil","correct":"from gt4py.cartesian import Stencil"},{"note":"computation is a function inside gtscript module, accessible via gt4py.cartesian.gtscript","wrong":"from gt4py.gtscript import computation","symbol":"computation","correct":"from gt4py.cartesian.gtscript import computation"}],"quickstart":{"code":"import numpy as np\nfrom gt4py.cartesian import Stencil, gtscript\n\ndef my_stencil_def(in_field: gtscript.Field[float], out_field: gtscript.Field[float]):\n    with computation(PARALLEL), interval(...):\n        out_field = in_field[0, 0, 0] + 1.0\n\n# Create the stencil\nmy_stencil = Stencil(\n    definition=my_stencil_def,\n    backend=\"numpy\",\n    rebuild=False,\n)\n\n# Run on sample data\ninp = np.random.rand(10, 10, 10).astype(np.float64)\nout = np.empty_like(inp)\nmy_stencil(inp=inp, out_field=out, origin=(0, 0, 0), domain=(10, 10, 10))","lang":"python","description":"Define a simple stencil that adds 1 to each element, compile it with the numpy backend, and execute."},"warnings":[{"fix":"Change backend from 'cuda' to 'gtcuda' or use Dace with CUDA backend 'dace:cuda'.","message":"The 'cuda' backend was removed in v1.1.0. Use 'gtcuda' or 'dace:cuda' instead.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Remove redundant region syntax; ensure all regions are necessary.","message":"The 'redundant region syntax' is removed in v1.1.9. Old code using `region` that is now redundant will break.","severity":"deprecated","affected_versions":">=1.1.9"},{"fix":"Set environment variable GT4PY_CARTESIAN_ENABLE_OPENMP=0 if OpenMP is not available (e.g., on macOS with Apple Clang).","message":"For DaCe backends, field layout must match the stencil's iteration order. Use `dace:gpu` with Fortran layout or specify layout explicitly.","severity":"gotcha","affected_versions":">=1.1.3"},{"fix":"Set environment variable GT4PY_CARTESIAN_ENABLE_OPENMP=0 to disable OpenMP.","message":"OpenMP is enabled by default but may not be supported by all compilers (e.g., Apple Clang). This can cause build failures.","severity":"gotcha","affected_versions":">=1.1.6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install gt4py' in the correct Python environment.","cause":"Library not installed, or Python environment not activated.","error":"ModuleNotFoundError: No module named 'gt4py'"},{"fix":"Use 'from gt4py.cartesian import Stencil'.","cause":"Wrong import path; Stencil is in gt4py.cartesian.","error":"ImportError: cannot import name 'Stencil' from 'gt4py'"},{"fix":"Use 'gtcuda' or 'dace:cuda' as backend. See docs for details.","cause":"CUDA backend was removed in v1.1.0.","error":"ValueError: Backend 'cuda' is not available."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}