Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_disabled/gt4py-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
run: |
python -m pip install .[dace]
- name: Build documentation
# TODO re-enable SPHINXOPTS=-W
# TODO(): re-enable SPHINXOPTS=-W
run: |
cd docs && make -e html
2 changes: 1 addition & 1 deletion .github/workflows/daily-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# [arg: --resolution, env: UV_RESOLUTION=]
dependencies-strategy: ["lowest-direct", "highest"]
gt4py-module: ["cartesian", "eve", "next", "storage"]
# TODO: switch to macos-latest once macos-15 is default, see https://github.com/actions/runner-images/issues/12520
# TODO(): switch to macos-latest once macos-15 is default, see https://github.com/actions/runner-images/issues/12520
# On macos-14 we see the error: call to 'isfinite' is ambiguous.
os: ["ubuntu-latest", "macos-15"]
python-version: ${{ fromJSON(needs.get-python-versions.outputs.python-versions) }}
Expand Down
4 changes: 2 additions & 2 deletions ci/cscs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ stages:
BASE_IMAGE: jfrog.svc.cscs.ch/dockerhub/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
EXTRA_UV_SYNC_ARGS: "--extra cuda12"

# TODO: rocm steps are in draft state for now to show how to add support in the future
# TODO(): rocm steps are in draft state for now to show how to add support in the future
# .build_extra_rocm:
# variables:
# # jfrog.svc.cscs.ch/dockerhub/rocm is the cached version of docker.io/rocm
Expand Down Expand Up @@ -107,7 +107,7 @@ build_cscs_gh200:
rules:
- if: $SUBPACKAGE == 'next' && $VARIANT == 'dace' && $DETAIL == 'nomesh'
variables:
# TODO: investigate why the dace tests seem to hang with multiple jobs
# TODO(): investigate why the dace tests seem to hang with multiple jobs
GT4PY_BUILD_JOBS: 1
SLURM_TIMELIMIT: "00:15:00"
- when: on_success
Expand Down
2 changes: 1 addition & 1 deletion docs/user/next/workshop/exercises/1_simple_addition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"def addition(): ... # TODO fix this cell"
"def addition(): ... # EXERCISE: fix this cell"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
" A: gtx.Field[Dims[C], float],\n",
" edge_orientation: gtx.Field[Dims[C, C2EDim], float],\n",
") -> gtx.tuple[gtx.Field[Dims[C], float], gtx.Field[Dims[C], float]]:\n",
" # TODO: fix components of gradient\n",
" # TODO(): fix components of gradient\n",
" f_x = A\n",
" f_y = A\n",
" return f_x, f_y"
Expand Down
2 changes: 1 addition & 1 deletion docs/user/next/workshop/exercises/4_curl_exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
" dualA: gtx.Field[Dims[V], float],\n",
" edge_orientation: gtx.Field[Dims[V, V2EDim], float],\n",
") -> gtx.Field[Dims[V], float]:\n",
" # TODO: fix curl\n",
" # TODO(): fix curl\n",
" uv_curl = dualA\n",
"\n",
" return uv_curl"
Expand Down
12 changes: 6 additions & 6 deletions docs/user/next/workshop/exercises/6_where_domain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "80cbe9d5",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -134,7 +134,7 @@
}
],
"source": [
"# TODO implement the field_operator\n",
"# EXERCISE: implement the field_operator\n",
"\n",
"\n",
"@gtx.program(backend=backend)\n",
Expand Down Expand Up @@ -201,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "ebe2cd9d",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -238,7 +238,7 @@
"@gtx.program(backend=backend)\n",
"def program_domain(\n",
" a: gtx.Field[Dims[K], float], b: gtx.Field[Dims[K], float]\n",
"): ... # TODO write the call to fieldop_domain"
"): ... # EXERCISE: write the call to fieldop_domain"
]
},
{
Expand Down Expand Up @@ -338,7 +338,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "cac80fbb",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -367,7 +367,7 @@
"source": [
"@gtx.field_operator\n",
"def fieldop_domain_where(a: gtx.Field[Dims[K], float]) -> gtx.Field[Dims[K], float]:\n",
" return # TODO\n",
" return # ...\n",
"\n",
"\n",
"@gtx.program(backend=backend)\n",
Expand Down
12 changes: 6 additions & 6 deletions docs/user/next/workshop/exercises/7_scan_operator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "69bf6022",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -182,18 +182,18 @@
" sedimentaion_constant = 0.05\n",
"\n",
" # unpack state of previous iteration\n",
" # TODO\n",
" # ...\n",
"\n",
" # Autoconversion: Cloud Drops -> Rain Drops\n",
" # TODO\n",
" # ...\n",
"\n",
" ## Add sedimentation flux from level above\n",
" # TODO\n",
" # ...\n",
"\n",
" # Remove mass due to sedimentation flux\n",
" # TODO\n",
" # ...\n",
"\n",
" return # TODO"
" return # ..."
]
},
{
Expand Down
73 changes: 40 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ module = 'gt4py.*'

[[tool.mypy.overrides]]
# The following ignore_errors are only temporary.
# TODO: Fix errors and enable these settings.
# TODO(): Fix errors and enable these settings.
disallow_incomplete_defs = false
disallow_untyped_defs = false
follow_imports = 'silent'
Expand Down Expand Up @@ -233,7 +233,7 @@ module = 'gt4py.eve.extended_typing'
warn_unused_ignores = false

[[tool.mypy.overrides]]
# TODO: Make this false and fix errors
# TODO(): Make this false and fix errors
disallow_untyped_defs = false
follow_imports = 'silent'
module = 'gt4py.storage.*'
Expand Down Expand Up @@ -315,44 +315,51 @@ target-version = 'py310'
docstring-code-format = true

[tool.ruff.lint]
# -- Rules set to be considered --
# A: flake8-builtins
# B: flake8-bugbear
# C4: flake8-comprehensions
# CPY: flake8-copyright
# D: pydocstyle
# DOC: pydoclint
# E: pycodestyle
# ERA: eradicate
# F: Pyflakes
# FA100: future-rewritable-type-annotation
# FBT: flake8-boolean-trap
# FLY: flynt
# I: isort
# ICN: flake8-import-conventions
# ISC: flake8-implicit-str-concat
# N: pep8-naming
# NPY: NumPy-specific rules
# PERF: Perflint
# PGH: pygrep-hooks
# PTH: flake8-use-pathlib
# Q: flake8-quotes
# RUF: Ruff-specific rules
# SIM: flake8-simplify
# T10: flake8-debugger
# TD: flake8-todos
# UP: pyupgrade
# YTT: flake8-2020
exclude = ['docs/**', "examples/**", "tests/**"]
explicit-preview-rules = true
extend-select = ["F822"] # TODO(egparedes): remove when not longer in preview
ignore = [
'PLR0913',
'E501', # [line-too-long]
'B905', # [zip-without-explicit-strict] # TODO(egparedes): remove when possible
'TD003' # [missing-todo-link]
'ISC001', # [single-line-implicit-string-concatenation]
'TD003', # [missing-todo-link]
'UP038' # [non-pep604-isinstance]
]
preview = true # use only with explicit-preview-rules=true
select = ['A', 'B', 'CPY', 'E', 'ERA', 'F', 'FA100', 'I', 'ISC', 'NPY', 'Q', 'RUF', 'T10', 'YTT']
select = [
'A', # flake8-builtins
'B', # flake8-bugbear
# 'C4', # flake8-comprehensions
'CPY', # flake8-copyright
# 'D', # pydocstyle
'DOC', # pydoclint
'E', # pycodestyle
'ERA', # eradicate
'F', # Pyflakes
'F822', # [undefined-export] (preview) # TODO(egparedes): remove when not longer in preview
'FA100', # future-rewritable-type-annotation
# 'FBT', # flake8-boolean-trap
'FLY', # flynt
'I', # isort
# 'ICN', # flake8-import-conventions
'ISC', # flake8-implicit-str-concat
# 'N', # pep8-naming
'NPY', # NumPy-specific rules
'PERF', # Perflint
# 'PGH', # pygrep-hooks
# 'PLC', # Pylint-Convention
'PLE', # Pylint-Error
# 'PLR', # Pylint-Refactor
'PLW', # Pylint-Warning
'PTH', # flake8-use-pathlib
'Q', # flake8-quotes
'RUF', # Ruff-specific rules
# 'SIM', # flake8-simplify
'T10', # flake8-debugger
'TD', # flake8-todos
'UP', # pyupgrade
'YTT' # flake8-2020
]
typing-modules = ['gt4py.eve.extended_typing']
unfixable = []

Expand Down
19 changes: 8 additions & 11 deletions scripts/nox_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,14 @@ class ExitCode(enum.IntEnum):
{"name": str, "paths": NotRequired[list[str]], "ignore-paths": NotRequired[list[str]]},
)

NoxSessionDefinition = TypedDict(
"NoxSessionDefinition",
{
"session": str,
"name": str,
"description": str,
"python": str,
"tags": list[str],
"call_spec": dict[str, str],
},
)

class NoxSessionDefinition(TypedDict):
session: str
name: str
description: str
python: str
tags: list[str]
call_spec: dict[str, str]


cli = typer.Typer(no_args_is_help=True, name="nox-sessions", help=__doc__)
Expand Down
6 changes: 4 additions & 2 deletions scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def dependencies() -> None:
def precommit() -> None:
"""Update versions of pre-commit hooks."""
subprocess.run(
f"uv run --quiet --locked --project {common.REPO_ROOT} pre-commit autoupdate", shell=True
f"uv run --quiet --locked --project {common.REPO_ROOT} pre-commit autoupdate",
shell=True,
check=False,
)

try:
Expand All @@ -57,7 +59,7 @@ def precommit() -> None:

try:
pre_commit_path = common.REPO_ROOT / ".pre-commit-config.yaml"
with open(pre_commit_path, "r", encoding="utf-8") as f:
with open(pre_commit_path, encoding="utf-8") as f:
content = f.read()

new_content = re.sub(
Expand Down
14 changes: 7 additions & 7 deletions src/gt4py/_core/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,36 @@
float32 = np.float32
float64 = np.float64

BoolScalar: TypeAlias = Union[bool_, bool]
BoolScalar: TypeAlias = bool_ | bool
BoolT = TypeVar("BoolT", bound=BoolScalar)
BOOL_TYPES: Final[Tuple[type, ...]] = cast(
Tuple[type, ...],
BoolScalar.__args__, # type: ignore[attr-defined]
)


IntScalar: TypeAlias = Union[int8, int16, int32, int64, int]
IntScalar: TypeAlias = int8 | int16 | int32 | int64 | int
IntT = TypeVar("IntT", bound=IntScalar)
INT_TYPES: Final[Tuple[type, ...]] = cast(
Tuple[type, ...],
IntScalar.__args__, # type: ignore[attr-defined]
)


UnsignedIntScalar: TypeAlias = Union[uint8, uint16, uint32, uint64]
UnsignedIntScalar: TypeAlias = uint8 | uint16 | uint32 | uint64
UnsignedIntT = TypeVar("UnsignedIntT", bound=UnsignedIntScalar)
UINT_TYPES: Final[Tuple[type, ...]] = cast(
Tuple[type, ...],
UnsignedIntScalar.__args__, # type: ignore[attr-defined]
)


IntegralScalar: TypeAlias = Union[IntScalar, UnsignedIntScalar]
IntegralScalar: TypeAlias = IntScalar | UnsignedIntScalar
IntegralT = TypeVar("IntegralT", bound=IntegralScalar)
INTEGRAL_TYPES: Final[Tuple[type, ...]] = (*INT_TYPES, *UINT_TYPES)


FloatingScalar: TypeAlias = Union[float32, float64, float]
FloatingScalar: TypeAlias = float32 | float64 | float
FloatingT = TypeVar("FloatingT", bound=FloatingScalar)
FLOAT_TYPES: Final[Tuple[type, ...]] = cast(
Tuple[type, ...],
Expand All @@ -109,7 +109,7 @@


#: Type alias for all scalar types supported by GT4Py
Scalar: TypeAlias = Union[BoolScalar, IntegralScalar, FloatingScalar]
Scalar: TypeAlias = BoolScalar | IntegralScalar | FloatingScalar
ScalarT = TypeVar("ScalarT", bound=Scalar)
SCALAR_TYPES: Final[tuple[type, ...]] = (*BOOL_TYPES, *INTEGRAL_TYPES, *FLOAT_TYPES)

Expand Down Expand Up @@ -140,7 +140,7 @@ def is_positive_integral_type(integral_type: type) -> TypeGuard[Type[PositiveInt

TensorShape: TypeAlias = Sequence[
int
] # TODO(egparedes) figure out if PositiveIntegral can be made to work
] # TODO(egparedes): figure out if PositiveIntegral can be made to work


def is_valid_tensor_shape(value: Sequence[IntegralScalar]) -> TypeGuard[TensorShape]:
Expand Down
3 changes: 2 additions & 1 deletion src/gt4py/cartesian/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import pathlib
import time
import warnings
from typing import TYPE_CHECKING, Any, Callable, ClassVar, Protocol
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, ClassVar, Protocol

from typing_extensions import deprecated

Expand Down
10 changes: 5 additions & 5 deletions src/gt4py/cartesian/backend/cuda_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def visit_FieldDecl(self, node: cuir.FieldDecl, **kwargs):
data_ndim = len(node.data_dims)
sid_ndim = domain_ndim + data_ndim
if kwargs["external_arg"]:
return "py::object {name}, std::array<gt::int_t,{sid_ndim}> {name}_origin".format(
name=node.name, sid_ndim=sid_ndim
return (
f"py::object {node.name}, std::array<gt::int_t,{sid_ndim}> {node.name}_origin"
)
else:
return pybuffer_to_sid(
Expand All @@ -98,9 +98,9 @@ def visit_FieldDecl(self, node: cuir.FieldDecl, **kwargs):
def visit_ScalarDecl(self, node: cuir.ScalarDecl, **kwargs):
if "external_arg" in kwargs:
if kwargs["external_arg"]:
return "{dtype} {name}".format(name=node.name, dtype=self.visit(node.dtype))
return f"{self.visit(node.dtype)} {node.name}"
else:
return "gridtools::stencil::global_parameter({name})".format(name=node.name)
return f"gridtools::stencil::global_parameter({node.name})"

def visit_Program(self, node: cuir.Program, **kwargs):
assert "module_name" in kwargs
Expand Down Expand Up @@ -144,7 +144,7 @@ def generate_extension(self) -> None:
def generate(self) -> type[StencilObject]:
self.check_options(self.builder.options)

# TODO(havogt) add bypass if computation has no effect
# TODO(havogt): add bypass if computation has no effect
self.generate_extension()

# Generate and return the Python wrapper class
Expand Down
Loading
Loading