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
13 changes: 13 additions & 0 deletions ndsl/dsl/caches/cache_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@
def identify_code_path(
rank: int,
partitioner: Partitioner,
single_code_path: bool,
) -> FV3CodePath:
"""Determine which code path your rank will hit.

If single_code_path is True, single_code_path is True,
only one code path exists (case of doubly periodic grid).
If single_code_path is False, we are in the case of the
cube-sphere and we will look at our position on the tile."""

# Doubly-periodic or single tile grid
if single_code_path:
return FV3CodePath.All

# Cube-sphere
if partitioner.layout == (1, 1):
return FV3CodePath.All
elif partitioner.layout[0] == 1 or partitioner.layout[1] == 1:
Expand Down
13 changes: 12 additions & 1 deletion ndsl/dsl/dace/dace_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def _determine_compiling_ranks(
15 -> 8
"""

if config._single_code_path:
return config.my_rank == 0

# Tile 0 compiles
if partitioner.tile_index(config.my_rank) != 0:
return False
Expand Down Expand Up @@ -147,6 +150,7 @@ def __init__(
tile_nz: int = 0,
orchestration: DaCeOrchestration | None = None,
time: bool = False,
single_code_path: bool = False,
):
"""Specialize the DaCe configuration for NDSL use.

Expand All @@ -163,8 +167,11 @@ def __init__(
orchestration: orchestration mode from DaCeOrchestration
time: trigger performance collection, available to user with
`performance_collector`
single_codepath: code is expected to be the same on every rank (case
of column-physics) and therefore can be compiled once
"""

self._single_code_path = single_code_path
# Recording SDFG loaded for fast re-access
# ToDo: DaceConfig becomes a bit more than a read-only config
# with this. Should be refactored into a DaceExecutor carrying a config
Expand Down Expand Up @@ -331,7 +338,11 @@ def __init__(
if communicator:
self.my_rank = communicator.rank
self.rank_size = communicator.comm.Get_size()
self.code_path = identify_code_path(self.my_rank, communicator.partitioner)
self.code_path = identify_code_path(
self.my_rank,
communicator.partitioner,
self._single_code_path,
)
self.layout = communicator.partitioner.layout
self.do_compile = (
DEACTIVATE_DISTRIBUTED_DACE_COMPILE
Expand Down