gt4py


Namegt4py JSON
Version 1.0.3 PyPI version JSON
download
home_page
SummaryPython library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL)
upload_time2024-02-08 05:49:17
maintainer
docs_urlNone
author
requires_python>=3.8
licenseGPL-3.0-or-later
keywords gridtools stencil weather climate performance portable hpc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![logo](https://raw.githubusercontent.com/GridTools/gt4py/gh-pages/v1.0/_static/logo.svg)](https://GridTools.github.io/gt4py)

![license](https://img.shields.io/github/license/GridTools/gt4py)
[![slack](https://img.shields.io/badge/slack-join-orange?logo=slack&labelColor=3a3a3a)](https://join.slack.com/t/gridtools/shared_invite/zt-1mceuj747-59swuowC3MKAuCFyNAnc1g)

[![Daily CI](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml/badge.svg)](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml)
![test-cartesian](https://github.com/GridTools/gt4py/actions/workflows/test-cartesian.yml/badge.svg?branch=main)
![test-next](https://github.com/GridTools/gt4py/actions/workflows/test-next.yml/badge.svg?branch=main)
![test-storage](https://github.com/GridTools/gt4py/actions/workflows/test-storage.yml/badge.svg?branch=main)
![test-eve](https://github.com/GridTools/gt4py/actions/workflows/test-eve.yml/badge.svg?branch=main)
![qa](https://github.com/GridTools/gt4py/actions/workflows/code-quality.yml/badge.svg?branch=main)

# 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 highly experimental, it only works with unstructured meshes and it requires `python >= 3.10`.

## 📃 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 `pip` (or any other PEP-517 frontend). As usual, we strongly recommended to create a new virtual environment to work on this project.

The performance backends also require the `Boost <https://www.boost.org/>`\_\_ library, a dependency of [GridTools C++](https://github.com/GridTools/gridtools), which needs to be installed by the user.

## ⚙ Configuration

If GridTools or Boost are not found in the compiler's standard include path, or a custom version is desired, then a couple configuration environment variables will allow the compiler to use them:

- `GT_INCLUDE_PATH`: Path to the GridTools installation.
- `BOOST_ROOT`: Path to a boost installation.

Other commonly used 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`](https://github.com/GridTools/gt4py/blob/main/src/gt4py/cartesian/config.py>).

## 📖 Documentation

GT4Py uses Sphinx documentation. To build the documentation install the dependencies in `requirements-dev.txt`

```bash
pip install -r ./gt4py/requirements-dev.txt
```

and then build the docs with

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

## 🛠 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](CONTRIBUTING.md) and [CODING_GUIDELINES.md](CODING_GUIDELINES.md) documents before you start working on the project.

### Recommended Installation using `tox`

If [tox](https://tox.wiki/en/latest/) is already installed in your system (`tox` is available in PyPI and many other package managers), the easiest way to create a virtual environment ready for development is:

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

# Create the development environment in any location (usually `.venv`)
# selecting one of the following templates:
#     dev-py310       -> base environment
#     dev-py310-atlas -> base environment + atlas4py bindings
tox devenv -e dev-py310 .venv

# Finally, activate the environment
source .venv/bin/activate
```

### Manual Installation

Alternatively, a development environment can be created from scratch installing the frozen dependencies packages :

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

# Create a (Python 3.10) virtual environment (usually at `.venv`)
python3.10 -m venv .venv

# Activate the virtual environment and update basic packages
source .venv/bin/activate
pip install --upgrade wheel setuptools pip

# Install the required development tools
pip install -r requirements-dev.txt
# Install GT4Py project in editable mode
pip install -e .

# Optionally, install atlas4py bindings directly from the repo
# pip install git+https://github.com/GridTools/atlas4py#egg=atlas4py
```

## ⚖️ License

GT4Py is licensed under the terms of the [GPLv3](https://github.com/GridTools/gt4py/blob/main/LICENSE.txt).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gt4py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "gridtools,stencil,weather,climate,performance,portable,hpc",
    "author": "",
    "author_email": "ETH Zurich <gridtools@cscs.ch>",
    "download_url": "https://files.pythonhosted.org/packages/ce/d5/ca9f2872b50bf1725e3cb14357ae16ea6c3357178323b9d9ef49e84c4ea6/gt4py-1.0.3.tar.gz",
    "platform": "Linux",
    "description": "[![logo](https://raw.githubusercontent.com/GridTools/gt4py/gh-pages/v1.0/_static/logo.svg)](https://GridTools.github.io/gt4py)\n\n![license](https://img.shields.io/github/license/GridTools/gt4py)\n[![slack](https://img.shields.io/badge/slack-join-orange?logo=slack&labelColor=3a3a3a)](https://join.slack.com/t/gridtools/shared_invite/zt-1mceuj747-59swuowC3MKAuCFyNAnc1g)\n\n[![Daily CI](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml/badge.svg)](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml)\n![test-cartesian](https://github.com/GridTools/gt4py/actions/workflows/test-cartesian.yml/badge.svg?branch=main)\n![test-next](https://github.com/GridTools/gt4py/actions/workflows/test-next.yml/badge.svg?branch=main)\n![test-storage](https://github.com/GridTools/gt4py/actions/workflows/test-storage.yml/badge.svg?branch=main)\n![test-eve](https://github.com/GridTools/gt4py/actions/workflows/test-eve.yml/badge.svg?branch=main)\n![qa](https://github.com/GridTools/gt4py/actions/workflows/code-quality.yml/badge.svg?branch=main)\n\n# GT4Py: GridTools for Python\n\nGT4Py 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.\n\n**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 highly experimental, it only works with unstructured meshes and it requires `python >= 3.10`.\n\n## \ud83d\udcc3 Description\n\nGT4Py 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.\n\nThe 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.\n\nIn addition, GT4Py provides functions to allocate arrays with memory layout suited for a particular backend.\n\nThe following backends are supported:\n\n- `numpy`: Pure-Python backend\n- `gt:cpu_ifirst`: GridTools C++ CPU backend using `I`-first data ordering\n- `gt:cpu_kfirst`: GridTools C++ CPU backend using `K`-first data ordering\n- `gt:gpu`: GridTools backend for CUDA\n- `cuda`: CUDA backend minimally using utilities from GridTools\n- `dace:cpu`: Dace code-generated CPU backend\n- `dace:gpu`: Dace code-generated GPU backend\n\n## \ud83d\ude9c Installation\n\nGT4Py can be installed as a regular Python package using `pip` (or any other PEP-517 frontend). As usual, we strongly recommended to create a new virtual environment to work on this project.\n\nThe performance backends also require the `Boost <https://www.boost.org/>`\\_\\_ library, a dependency of [GridTools C++](https://github.com/GridTools/gridtools), which needs to be installed by the user.\n\n## \u2699 Configuration\n\nIf GridTools or Boost are not found in the compiler's standard include path, or a custom version is desired, then a couple configuration environment variables will allow the compiler to use them:\n\n- `GT_INCLUDE_PATH`: Path to the GridTools installation.\n- `BOOST_ROOT`: Path to a boost installation.\n\nOther commonly used environment variables are:\n\n- `CUDA_ARCH`: Set the compute capability of the NVIDIA GPU if it is not detected automatically by `cupy`.\n- `CXX`: Set the C++ compiler.\n- `GT_CACHE_DIR_NAME`: Name of the compiler's cache directory (defaults to `.gt_cache`)\n- `GT_CACHE_ROOT`: Path to the compiler cache (defaults to `./`)\n\nMore options and details are available in [`config.py`](https://github.com/GridTools/gt4py/blob/main/src/gt4py/cartesian/config.py>).\n\n## \ud83d\udcd6 Documentation\n\nGT4Py uses Sphinx documentation. To build the documentation install the dependencies in `requirements-dev.txt`\n\n```bash\npip install -r ./gt4py/requirements-dev.txt\n```\n\nand then build the docs with\n\n```bash\ncd gt4py/docs/user/cartesian\nmake html  # run 'make help' for a list of targets\n```\n\n## \ud83d\udee0 Development Instructions\n\nFollow 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](CONTRIBUTING.md) and [CODING_GUIDELINES.md](CODING_GUIDELINES.md) documents before you start working on the project.\n\n### Recommended Installation using `tox`\n\nIf [tox](https://tox.wiki/en/latest/) is already installed in your system (`tox` is available in PyPI and many other package managers), the easiest way to create a virtual environment ready for development is:\n\n```bash\n# Clone the repository\ngit clone https://github.com/gridtools/gt4py.git\ncd gt4py\n\n# Create the development environment in any location (usually `.venv`)\n# selecting one of the following templates:\n#     dev-py310       -> base environment\n#     dev-py310-atlas -> base environment + atlas4py bindings\ntox devenv -e dev-py310 .venv\n\n# Finally, activate the environment\nsource .venv/bin/activate\n```\n\n### Manual Installation\n\nAlternatively, a development environment can be created from scratch installing the frozen dependencies packages :\n\n```bash\n# Clone the repository\ngit clone https://github.com/gridtools/gt4py.git\ncd gt4py\n\n# Create a (Python 3.10) virtual environment (usually at `.venv`)\npython3.10 -m venv .venv\n\n# Activate the virtual environment and update basic packages\nsource .venv/bin/activate\npip install --upgrade wheel setuptools pip\n\n# Install the required development tools\npip install -r requirements-dev.txt\n# Install GT4Py project in editable mode\npip install -e .\n\n# Optionally, install atlas4py bindings directly from the repo\n# pip install git+https://github.com/GridTools/atlas4py#egg=atlas4py\n```\n\n## \u2696\ufe0f License\n\nGT4Py is licensed under the terms of the [GPLv3](https://github.com/GridTools/gt4py/blob/main/LICENSE.txt).\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL)",
    "version": "1.0.3",
    "project_urls": {
        "Documentation": "https://gridtools.github.io/gt4py",
        "Homepage": "https://gridtools.github.io/",
        "Source": "https://github.com/GridTools/gt4py"
    },
    "split_keywords": [
        "gridtools",
        "stencil",
        "weather",
        "climate",
        "performance",
        "portable",
        "hpc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6bebf44d87953462733e26b80c0dfadf87b0e80d8ef6e07152c0e516788a068",
                "md5": "cf2a785a0513d5867b35e0ab159f2cfe",
                "sha256": "d80492139a7f3c988e0891cc05f0b714271a1a03d1e3804ec98c721b0d5a234b"
            },
            "downloads": -1,
            "filename": "gt4py-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf2a785a0513d5867b35e0ab159f2cfe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 692886,
            "upload_time": "2024-02-08T05:49:15",
            "upload_time_iso_8601": "2024-02-08T05:49:15.615018Z",
            "url": "https://files.pythonhosted.org/packages/a6/be/bf44d87953462733e26b80c0dfadf87b0e80d8ef6e07152c0e516788a068/gt4py-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ced5ca9f2872b50bf1725e3cb14357ae16ea6c3357178323b9d9ef49e84c4ea6",
                "md5": "0306d8121028c9ab480d31e03cd30c8b",
                "sha256": "59b810a6161290fa188fe03fb2910c1755188ca9e31e6f9f9034d12e84201750"
            },
            "downloads": -1,
            "filename": "gt4py-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "0306d8121028c9ab480d31e03cd30c8b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 501956,
            "upload_time": "2024-02-08T05:49:17",
            "upload_time_iso_8601": "2024-02-08T05:49:17.749147Z",
            "url": "https://files.pythonhosted.org/packages/ce/d5/ca9f2872b50bf1725e3cb14357ae16ea6c3357178323b9d9ef49e84c4ea6/gt4py-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 05:49:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "GridTools",
    "github_project": "gt4py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "gt4py"
}
        
Elapsed time: 0.17386s