Skip to content
Open
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
8 changes: 4 additions & 4 deletions .cscs-ci/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ build_cscs_amd_rocm:
SUBVARIANT: ['cuda13', 'rocm7', 'cpu']
DETAIL: ["nomesh", "atlas"]
PY_VERSION: *test_python_versions
- SUBPACKAGE: [storage]
- SUBPACKAGE: [core, storage]
VARIANT: ['cuda13', 'rocm7', 'cpu']
PY_VERSION: *test_python_versions
rules: &exclude_variants_rules
# Extended jobs should reference this list anchor at the proper position of their
# `rules` section, and also add an extra `- when: on_success` rule at the end.
- if: '($SUBVARIANT == "cpu" || ($SUBPACKAGE == "storage" && $VARIANT == "cpu")) && ($TEST_VARIANTS !~ /(^|\s)cpu(\s|$)/)'
- if: '($SUBVARIANT == "cpu" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "cpu")) && ($TEST_VARIANTS !~ /(^|\s)cpu(\s|$)/)'
when: never
- if: '($SUBVARIANT == "cuda13" || ($SUBPACKAGE == "storage" && $VARIANT == "cuda13")) && ($TEST_VARIANTS !~ /(^|\s)cuda13(\s|$)/)'
- if: '($SUBVARIANT == "cuda13" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "cuda13")) && ($TEST_VARIANTS !~ /(^|\s)cuda13(\s|$)/)'
when: never
- if: '($SUBVARIANT == "rocm7" || ($SUBPACKAGE == "storage" && $VARIANT == "rocm7")) && ($TEST_VARIANTS !~ /(^|\s)rocm7(\s|$)/)'
- if: '($SUBVARIANT == "rocm7" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "rocm7")) && ($TEST_VARIANTS !~ /(^|\s)rocm7(\s|$)/)'
when: never

script:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# between the different compatible versions for a given package requirement
# [arg: --resolution, env: UV_RESOLUTION=]
dependencies-strategy: ["lowest-direct", "highest"]
gt4py-module: ["cartesian", "eve", "next", "storage"]
gt4py-module: ["cartesian", "core", "eve", "next", "storage"]
os: ["ubuntu-latest", "macos-latest"]
python-version: ${{ fromJSON(needs.get-python-versions.outputs.python-versions) }}
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
args: "(internal, cpu)"
- name: test_cartesian
args: "(dace, cpu)"
- name: test_core
args: "(cpu)"
- name: test_eve
args: ""
- name: test_next
Expand Down
11 changes: 11 additions & 0 deletions nox-sessions-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ sessions:
- "*.md"
- "*.rst"

- name: test_core
paths: # Run when gt4py._core files (or package settings) are changed
- "src/gt4py/_core/**"
- "tests/core_tests/**"
- ".github/workflows/**"
- ".cscs-ci/**"
- "*.lock"
- "*.toml"
- "*.yml"
- "noxfile.py"

- name: test_eve
paths: # Run when gt4py.eve files (or package settings) are changed
- "src/gt4py/eve/**"
Expand Down
37 changes: 37 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"test_cartesian-3.13(dace, cpu)",
"test_cartesian-3.14(internal, cpu)",
"test_cartesian-3.14(dace, cpu)",
"test_core-3.12(cpu)",
"test_core-3.13(cpu)",
"test_core-3.14(cpu)",
"test_eve-3.12",
"test_eve-3.13",
"test_eve-3.14",
Expand Down Expand Up @@ -251,6 +254,40 @@ def test_cartesian(
)


@nox.session(python=PYTHON_VERSIONS, tags=["cartesian", "next"])
@nox.parametrize("device", [*DeviceNoxParam.values()])
def test_core(
session: nox.Session,
device: DeviceOption,
) -> None:
"""Run selected 'gt4py._core' tests."""

device_settings = DeviceTestSettings[device]
extras = ["standard", "testing", *device_settings["extras"]]
markers = list(device_settings["markers"])
if device == "cpu":
extras.append("jax")
if _session_runs_torch(session, device):
extras.append("torch")
else:
markers.append("not requires_torch")
else:
markers += ["not requires_jax", "not requires_torch"]

install_session_venv(session, extras=extras, groups=["test"])

session.run(
*"pytest --cache-clear -sv -n auto --dist loadgroup".split(),
# An unmet `requires_*` marker means a broken environment. Fail loudly
# instead of skipping all tests due to the auto-skip in 'tests/conftest.py'.
# Applies to every `requires_*`: install the extra, or exclude the marker.
"--require-optional-deps",
*("-m", " and ".join(markers)),
str(pathlib.Path("tests") / "core_tests"),
*session.posargs,
)


@nox.session(python=PYTHON_VERSIONS, tags=["cartesian", "next", "cpu"])
def test_eve(session: nox.Session) -> None:
"""Run 'gt4py.eve' tests."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def simple_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField

# TODO(tehrengruber): test with fields on different domains
@pytest.mark.uses_scalar_in_control_flow
@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]])
@pytest.mark.parametrize("condition1", [True, False])
@pytest.mark.parametrize("condition2", [True, False])
@pytest.mark.uses_if_stmts
def test_simple_if_conditional(condition1, condition2, cartesian_case):
@field_operator
Expand Down Expand Up @@ -207,7 +208,8 @@ def both_branches_return(a: cases.IField, b: cases.IField, condition: bool) -> c


@pytest.mark.uses_scalar_in_control_flow
@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]])
@pytest.mark.parametrize("condition1", [True, False])
@pytest.mark.parametrize("condition2", [True, False])
@pytest.mark.uses_if_stmts
def test_nested_if_stmt_conditional(cartesian_case, condition1, condition2):
@field_operator
Expand Down Expand Up @@ -281,7 +283,8 @@ def nested_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField


@pytest.mark.uses_scalar_in_control_flow
@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]])
@pytest.mark.parametrize("condition1", [True, False])
@pytest.mark.parametrize("condition2", [True, False])
@pytest.mark.uses_if_stmts
def test_if_without_else(cartesian_case, condition1, condition2):
@field_operator
Expand Down
Loading