Skip to content

Commit

Permalink
test[next]: Start using requires_dace marker (as cartesian tests alre…
Browse files Browse the repository at this point in the history
…ady do) (GridTools#1588)

Start using `requires_dace` marker in next tests, same as cartesian
tests already do.
  • Loading branch information
edopao authored Jul 25, 2024
1 parent 1051a6d commit 1493b96
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later

import types
from collections import namedtuple
from typing import Any, Protocol, TypeVar

import numpy as np
Expand All @@ -24,16 +23,6 @@
from gt4py.next.ffront import decorator
from gt4py.next.iterator import ir as itir
from gt4py.next.program_processors import processor_interface as ppi
from gt4py.next.program_processors.runners import gtfn, roundtrip


try:
from gt4py.next.program_processors.runners import dace_iterator
except ModuleNotFoundError as e:
if "dace" in str(e):
dace_iterator = None
else:
raise e

import next_tests

Expand All @@ -52,19 +41,6 @@ def __call__(self, program, *args, **kwargs) -> None:
no_backend = NoBackend(executor=no_exec, transforms_prog=None, allocator=None)


OPTIONAL_PROCESSORS = []
if dace_iterator:
OPTIONAL_PROCESSORS.append(next_tests.definitions.OptionalProgramBackendId.DACE_CPU)
(
OPTIONAL_PROCESSORS.append(
pytest.param(
next_tests.definitions.OptionalProgramBackendId.DACE_GPU,
marks=pytest.mark.requires_gpu,
)
),
)


@pytest.fixture(
params=[
next_tests.definitions.ProgramBackendId.ROUNDTRIP,
Expand All @@ -79,8 +55,15 @@ def __call__(self, program, *args, **kwargs) -> None:
pytest.param(
next_tests.definitions.EmbeddedIds.CUPY_EXECUTION, marks=pytest.mark.requires_gpu
),
]
+ OPTIONAL_PROCESSORS,
pytest.param(
next_tests.definitions.OptionalProgramBackendId.DACE_CPU,
marks=pytest.mark.requires_dace,
),
pytest.param(
next_tests.definitions.OptionalProgramBackendId.DACE_GPU,
marks=(pytest.mark.requires_dace, pytest.mark.requires_gpu),
),
],
ids=lambda p: p.short_id(),
)
def exec_alloc_descriptor(request):
Expand Down
34 changes: 11 additions & 23 deletions tests/next_tests/unit_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,13 @@
import pytest

import gt4py.next as gtx
from gt4py.next.iterator import runtime, transforms
from gt4py.next.iterator import runtime
from gt4py.next.program_processors import processor_interface as ppi


try:
from gt4py.next.program_processors.runners import dace_iterator
except ModuleNotFoundError as e:
if "dace" in str(e):
dace_iterator = None
else:
raise e


import next_tests


OPTIONAL_PROCESSORS = []
if dace_iterator:
OPTIONAL_PROCESSORS.append((next_tests.definitions.OptionalProgramBackendId.DACE_CPU, True))
# TODO(havogt): update tests to use proper allocation
# OPTIONAL_PROCESSORS.append(
# pytest.param(
# (definitions.OptionalProgramBackendId.DACE_GPU, True), marks=pytest.mark.requires_gpu
# )
# ),


@pytest.fixture(
params=[
(None, True),
Expand All @@ -59,8 +39,16 @@
(next_tests.definitions.ProgramFormatterId.LISP_FORMATTER, False),
(next_tests.definitions.ProgramFormatterId.ITIR_PRETTY_PRINTER, False),
(next_tests.definitions.ProgramFormatterId.GTFN_CPP_FORMATTER, False),
]
+ OPTIONAL_PROCESSORS,
pytest.param(
(next_tests.definitions.OptionalProgramBackendId.DACE_CPU, True),
marks=pytest.mark.requires_dace,
),
# TODO(havogt): update tests to use proper allocation
# pytest.param(
# (next_tests.definitions.OptionalProgramBackendId.DACE_GPU, True),
# marks=(pytest.mark.requires_dace, pytest.mark.requires_gpu),
# ),
],
ids=lambda p: p[0].short_id() if p[0] is not None else "None",
)
def program_processor(request) -> tuple[ppi.ProgramProcessor, bool]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import numpy as np
import pytest

dace = pytest.importorskip("dace")
pytestmark = pytest.mark.requires_dace


N = 10
Expand Down

0 comments on commit 1493b96

Please sign in to comment.