Skip to content
Merged
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
33 changes: 21 additions & 12 deletions ndsl/dsl/stencil_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,35 @@ def from_dict(cls, data: dict):
class StencilConfig(Hashable):
compare_to_numpy: bool = False
compilation_config: CompilationConfig = CompilationConfig()
dace_config: Optional[DaceConfig] = None
verbose: bool = False
dace_config: DaceConfig = dataclasses.field(init=False)

def __post_init__(self):
def __init__(
self,
*,
compare_to_numpy: bool = False,
compilation_config: CompilationConfig = CompilationConfig(),
verbose: bool = False,
dace_config: DaceConfig | None = None,
):
self.compare_to_numpy = compare_to_numpy
self.compilation_config = compilation_config
self.verbose = verbose
self.dace_config = (
dace_config
if dace_config is not None
else DaceConfig(
communicator=None,
backend=self.compilation_config.backend,
orchestration=DaCeOrchestration.Python,
)
)
self.backend_opts = {
"device_sync": self.compilation_config.device_sync,
"format_source": self.compilation_config.format_source,
}
self._hash = self._compute_hash()

# We need a DaceConfig to know if orchestration is part of the build system
# but we can't hash it very well (for now). The workaround is to make
# sure we have a default Python orchestrated config.
if self.dace_config is None:
self.dace_config = DaceConfig(
communicator=None,
backend=self.compilation_config.backend,
orchestration=DaCeOrchestration.Python,
)

@property
def backend(self):
return self.compilation_config.backend
Expand Down
11 changes: 10 additions & 1 deletion ndsl/stencils/corners.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import warnings
from typing import Optional, Sequence, Tuple

from gt4py.cartesian import gtscript
from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region

from ndsl import StencilFactory
from ndsl.constants import (
X_DIM,
X_INTERFACE_DIM,
Y_DIM,
Y_INTERFACE_DIM,
Z_INTERFACE_DIM,
)
from ndsl.dsl.stencil import GridIndexing, StencilFactory
from ndsl.dsl.stencil import GridIndexing
from ndsl.dsl.typing import FloatField


Expand All @@ -22,6 +24,13 @@ class CopyCorners:

def __init__(self, direction: str, stencil_factory: StencilFactory) -> None:
"""The grid for this stencil"""
warnings.warn(
"Usage of the GT4Py implementation of CopyCorners is discouraged and will"
"be removed in the next release. Use `CopyCornersX` or `CopyCornersY` in PyFV3"
"for a more future-proof implementation of the same code.",
DeprecationWarning,
2,
)
grid_indexing = stencil_factory.grid_indexing

n_halo = grid_indexing.n_halo
Expand Down
1 change: 0 additions & 1 deletion ndsl/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __call__(self, shape: Iterable[int], dtype: type):


class NumpyModule(Protocol):

empty: Allocator
zeros: Allocator
ones: Allocator
Expand Down
Loading