Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating submodules and pace refactor #75

Merged
merged 26 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
00cba46
Updated submodule versions
fmalatino Feb 5, 2024
3bbe036
Loosened constraint on gridtools-cpp for build of gt4py in constraint…
fmalatino Feb 6, 2024
c250df0
Merge branch 'main' into refactor/submodule_updates
fmalatino Feb 6, 2024
d5bfeb0
Updating submodules to most recent versions as of 6 Feb 2024 16:00
fmalatino Feb 6, 2024
16b15ce
Merge branch 'develop' into refactor/submodule_updates
fmalatino Mar 21, 2024
82c4862
Updated submodules
fmalatino Mar 21, 2024
ecda385
Updated submodules to current commits in develop branches, and import…
fmalatino Mar 21, 2024
6a7d6c3
Updating pyFV3 submodule
fmalatino Mar 22, 2024
35c4ed9
Updated constraints.txt
fmalatino Mar 22, 2024
63a46ac
Removed local references in constraints.txt
fmalatino Mar 22, 2024
917b9c8
Removed local reference to dace in constraints.txt
fmalatino Mar 22, 2024
09045d1
Updated pace internal imports
fmalatino Mar 25, 2024
4e2e3f7
Unexposed modules in driver __init__ and updated NDSL
fmalatino Apr 1, 2024
2ba7691
Updating to latest version of develop
fmalatino Apr 9, 2024
7bda2c6
Linting
fmalatino Apr 9, 2024
5e910e2
pace refactor
fmalatino Apr 15, 2024
ae07176
update to current pyFV3
fmalatino Apr 15, 2024
5f83fde
Merged in current develop branch
fmalatino Apr 15, 2024
4bb8877
Changing location of setup.cfg
fmalatino Apr 15, 2024
3cb419e
Removed need for python path to be re-passed
fmalatino Apr 15, 2024
8fb03f2
Linting
fmalatino Apr 15, 2024
f2724ce
Updates to reflect new structure
fmalatino Apr 15, 2024
ec1e2e3
Edits to requirements_dev.txt to install editable pace package
fmalatino Apr 17, 2024
15fc295
Updated README
fmalatino Apr 17, 2024
e154802
Updating submodules after NDSL 2024.04.00 release
fmalatino Apr 18, 2024
4131fba
Updating constraints.txt
fmalatino Apr 18, 2024
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 NDSL
Submodule NDSL updated 82 files
+1 −2 .gitmodules
+36 −2 README.md
+1 −1 examples/mpi/global_timings.py
+7 −4 examples/mpi/zarr_monitor.py
+1 −1 external/dace
+1 −1 external/gt4py
+32 −0 ndsl/__init__.py
+0 −1 ndsl/checkpointer/__init__.py
+1 −1 ndsl/checkpointer/null.py
+1 −2 ndsl/checkpointer/snapshots.py
+2 −2 ndsl/checkpointer/thresholds.py
+7 −3 ndsl/checkpointer/validation.py
+8 −0 ndsl/comm/__init__.py
+2 −2 ndsl/comm/boundary.py
+16 −17 ndsl/comm/communicator.py
+0 −11 ndsl/dsl/__init__.py
+0 −0 ndsl/dsl/caches/__init__.py
+0 −2 ndsl/dsl/dace/__init__.py
+2 −1 ndsl/dsl/dace/dace_config.py
+3 −3 ndsl/dsl/stencil.py
+5 −0 ndsl/exceptions.py
+1 −13 ndsl/grid/__init__.py
+12 −13 ndsl/grid/generation.py
+2 −3 ndsl/grid/geometry.py
+3 −4 ndsl/grid/global_setup.py
+2 −3 ndsl/grid/helper.py
+5 −0 ndsl/halo/__init__.py
+1 −2 ndsl/initialization/__init__.py
+4 −4 ndsl/initialization/allocator.py
+0 −1 ndsl/monitor/__init__.py
+1 −1 ndsl/monitor/convert.py
+4 −5 ndsl/monitor/netcdf_monitor.py
+1 −2 ndsl/performance/collector.py
+2 −3 ndsl/performance/config.py
+3 −0 ndsl/stencils/__init__.py
+1 −1 ndsl/stencils/c2l_ord.py
+2 −1 ndsl/stencils/testing/__init__.py
+2 −1 ndsl/stencils/testing/conftest.py
+2 −2 ndsl/stencils/testing/grid.py
+4 −2 ndsl/stencils/testing/parallel_translate.py
+1 −1 ndsl/stencils/testing/savepoint.py
+3 −2 ndsl/stencils/testing/test_translate.py
+0 −3 ndsl/testing/__init__.py
+0 −1 ndsl/testing/dummy_comm.py
+6 −0 ndsl/typing.py
+2 −1 setup.py
+5 −4 tests/dsl/test_caches.py
+7 −3 tests/dsl/test_compilation_config.py
+3 −7 tests/dsl/test_dace_config.py
+3 −3 tests/dsl/test_skip_passes.py
+1 −6 tests/dsl/test_stencil.py
+1 −2 tests/dsl/test_stencil_config.py
+7 −7 tests/dsl/test_stencil_factory.py
+9 −4 tests/dsl/test_stencil_wrapper.py
+0 −0 tests/mpi/__init__.py
+7 −4 tests/mpi/test_mpi_halo_update.py
+4 −3 tests/mpi/test_mpi_mock.py
+1 −1 tests/quantity/test_boundary.py
+1 −1 tests/quantity/test_deepcopy.py
+1 −1 tests/quantity/test_quantity.py
+1 −1 tests/quantity/test_storage.py
+1 −1 tests/quantity/test_transpose.py
+1 −1 tests/quantity/test_view.py
+9 −6 tests/test_caching_comm.py
+8 −5 tests/test_cube_scatter_gather.py
+2 −3 tests/test_decomposition.py
+1 −2 tests/test_dimension_sizer.py
+8 −5 tests/test_g2g_communication.py
+3 −2 tests/test_halo_data_transformer.py
+12 −7 tests/test_halo_update.py
+8 −5 tests/test_halo_update_ranks.py
+7 −4 tests/test_legacy_restart.py
+1 −1 tests/test_local_comm.py
+8 −5 tests/test_netcdf_monitor.py
+6 −3 tests/test_null_comm.py
+1 −3 tests/test_partitioner.py
+2 −5 tests/test_partitioner_boundaries.py
+8 −5 tests/test_sync_shared_boundary.py
+1 −4 tests/test_tile_scatter.py
+1 −4 tests/test_tile_scatter_gather.py
+1 −1 tests/test_timer.py
+2 −5 tests/test_zarr_monitor.py
33 changes: 16 additions & 17 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ charset-normalizer==2.0.4
click==8.0.1
# via
# black
# flask
# gt4py
cloudpickle==2.0.0
# via dask
Expand All @@ -74,6 +73,8 @@ coverage==5.5
# via pytest-cov
cytoolz==0.12.1
# via gt4py
dace
# via ndsl
dacite==1.6.0
# via
# fv3config
Expand Down Expand Up @@ -111,16 +112,19 @@ f90nml==1.3.1
# via
# -r requirements_dev.txt
# fv3config
# ndsl
# pyfv3
# pyshield
factory-boy==3.3.0
# via gt4py
faker==24.3.0
# via factory-boy
fasteners==0.16.3
# via zarr
fastjsonschema==2.16.2
# via nbformat
filelock==3.0.12
# via virtualenv
flask==2.1.2
# via dace
fparser==0.1.4
# via dace
frozendict==2.3.4
Expand All @@ -143,8 +147,10 @@ google-auth-oauthlib==0.4.5
# via gcsfs
gprof2dot==2021.2.21
# via pytest-profiling
gridtools-cpp
gridtools-cpp==2.3.2
# via gt4py
gt4py
# via ndsl
h5netcdf==1.1.0
# via ndsl
h5py==3.10.0
Expand All @@ -157,8 +163,6 @@ idna==3.2
# yarl
imagesize==1.2.0
# via sphinx
importlib-metadata==4.11.3
# via flask
importlib-resources==5.10.0
# via
# gt4py
Expand All @@ -169,13 +173,11 @@ ipykernel==6.16.2
# via nbmake
ipython==8.5.0
# via ipykernel
itsdangerous==2.1.2
# via flask
jedi==0.18.1
# via ipython
jinja2==3.0.1
# via
# flask
# dace
# gt4py
# sphinx
jsonschema==4.16.0
Expand Down Expand Up @@ -243,7 +245,7 @@ nodeenv==1.6.0
# via pre-commit
numcodecs==0.7.2
# via zarr
numpy==1.21.2
numpy==1.23.3
# via
# -r requirements_dev.txt
# cftime
Expand Down Expand Up @@ -312,7 +314,7 @@ pyasn1==0.4.8
# rsa
pyasn1-modules==0.2.8
# via google-auth
pybind11==2.8.1
pybind11==2.11.1
# via gt4py
pydantic==1.7.4
# via nbmake
Expand Down Expand Up @@ -346,6 +348,7 @@ pytest-subtests==0.5.0
# via -r requirements_dev.txt
python-dateutil==2.8.2
# via
# faker
# jupyter-client
# pandas
pytz==2021.1
Expand All @@ -368,7 +371,6 @@ recommonmark==0.7.1
# via -r requirements_docs.txt
requests==2.26.0
# via
# dace
# gcsfs
# requests-oauthlib
# sphinx
Expand Down Expand Up @@ -454,6 +456,7 @@ typing-extensions==4.3.0
# via
# aiohttp
# black
# faker
# gt4py
# setuptools-scm
urllib3==1.26.6
Expand All @@ -464,8 +467,6 @@ wcwidth==0.2.5
# via prompt-toolkit
websockets==10.3
# via dace
werkzeug==2.1.2
# via flask
wheel==0.37.0
# via astunparse
xarray==0.19.0
Expand All @@ -484,9 +485,7 @@ zarr==2.9.2
# -r requirements_dev.txt
# pace-driver
zipp==3.8.0
# via
# importlib-metadata
# importlib-resources
# via importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# setuptools
10 changes: 5 additions & 5 deletions driver/examples/notebooks/serial_debugging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"metadata": {},
"outputs": [],
"source": [
"import pace.util\n",
"from ndsl.constants import X_DIM, Y_DIM, Z_DIM\n",
"import pace.driver\n",
"import pace.fv3core.stencils.d2a2c_vect\n",
"from pyFV3.stencils import DGrid2AGrid2CGridVectors\n",
"import yaml\n",
"import dacite\n",
"import copy\n",
Expand Down Expand Up @@ -344,7 +344,7 @@
"metadata": {},
"outputs": [],
"source": [
"d2a2c = fv3core.stencils.d2a2c_vect.DGrid2AGrid2CGridVectors(\n",
"d2a2c = DGrid2AGrid2CGridVectors(\n",
" stencil_factory=driver.stencil_factory,\n",
" grid_data=driver.state.grid_data,\n",
" nested=False,\n",
Expand All @@ -371,8 +371,8 @@
"outputs": [],
"source": [
"# need temporaries for c-grid contravariant wind multiplied by timestep\n",
"utc = driver.quantity_factory.zeros(dims=[pace.util.X_DIM, pace.util.Y_DIM, pace.util.Z_DIM], units=\"m/s\")\n",
"vtc = driver.quantity_factory.zeros(dims=[pace.util.X_DIM, pace.util.Y_DIM, pace.util.Z_DIM], units=\"m/s\")\n",
"utc = driver.quantity_factory.zeros(dims=[X_DIM, Y_DIM, Z_DIM], units=\"m/s\")\n",
"vtc = driver.quantity_factory.zeros(dims=[X_DIM, Y_DIM, Z_DIM], units=\"m/s\")\n",
"d2a2c(\n",
" uc=remap_state.uc,\n",
" vc=remap_state.vc,\n",
Expand Down
7 changes: 3 additions & 4 deletions driver/examples/stencil_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

import yaml

import ndsl.dsl
import ndsl.util
import pace.driver
from ndsl import FrozenStencil


def has_stencils(object):
for name in dir(object):
try:
stencil_found = isinstance(getattr(object, name), ndsl.dsl.FrozenStencil)
stencil_found = isinstance(getattr(object, name), FrozenStencil)
except (AttributeError, RuntimeError):
stencil_found = False
if stencil_found:
Expand All @@ -26,7 +25,7 @@ def report_stencils(obj, file: Optional[TextIO]):
print(f"module {module.__name__}, class {obj.__class__.__name__}:", file=file)
all_access_names = collections.defaultdict(list)
for name, value in obj.__dict__.items():
if isinstance(value, ndsl.dsl.FrozenStencil):
if isinstance(value, FrozenStencil):
print(f" stencil {name}:", file=file)
for arg_name, field_info in value.stencil_object.field_info.items():
if field_info is None:
Expand Down
27 changes: 23 additions & 4 deletions driver/pace/driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,30 @@
ReaderCommConfig,
WriterCommConfig,
)
from .diagnostics import Diagnostics, DiagnosticsConfig
from .diagnostics import (
Diagnostics,
DiagnosticsConfig,
MonitorDiagnostics,
NullDiagnostics,
ZSelect,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the logic behind adding these here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just copying what was done in NDSL, with exposing without rationale, and then un-exposing when it is deemed unnecessary.

)
from .driver import Driver, DriverConfig, RestartConfig
from .grid import GeneratedGridConfig, SerialboxGridConfig
from .initialization import AnalyticInit, PredefinedStateInit, RestartInit
from .registry import Registry
from .grid import (
ExternalNetcdfGridConfig,
GeneratedGridConfig,
GridInitializerSelector,
SerialboxGridConfig,
)
from .initialization import (
AnalyticInit,
FortranRestartInit,
InitializerSelector,
PredefinedStateInit,
RestartInit,
SerialboxInit,
)
from .registry import ConfigSpecification, Registry
from .safety_checks import SafetyChecker, VariableBounds
from .state import DriverState, TendencyState


Expand Down
9 changes: 3 additions & 6 deletions driver/pace/driver/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import os
from typing import Any, ClassVar, List

from ndsl.comm.caching_comm import CachingCommReader, CachingCommWriter
from ndsl.comm.comm_abc import Comm
from ndsl.comm.mpi import MPIComm
from ndsl.comm.null_comm import NullComm

from .registry import Registry
from ndsl import MPIComm, NullComm
from ndsl.comm import CachingCommReader, CachingCommWriter, Comm
from pace.driver.registry import Registry


class CreatesComm(abc.ABC):
Expand Down
5 changes: 2 additions & 3 deletions driver/pace/driver/configs/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import dacite

from ndsl.comm.caching_comm import CachingCommReader, CachingCommWriter
from ndsl.comm.mpi import MPIComm
from ndsl.comm.null_comm import NullComm
from ndsl import MPIComm, NullComm
from ndsl.comm import CachingCommReader, CachingCommWriter


class CreatesComm(abc.ABC):
Expand Down
12 changes: 6 additions & 6 deletions driver/pace/driver/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
from datetime import datetime, timedelta
from typing import List, Optional, Union

from ndsl.comm.communicator import Communicator
from ndsl import Quantity
from ndsl.constants import RGRAV, Z_DIM, Z_INTERFACE_DIM
from ndsl.dsl.dace.orchestration import dace_inhibitor
from ndsl.filesystem import get_fs
from ndsl.grid import GridData
from ndsl.monitor import Monitor, NetCDFMonitor, ZarrMonitor
from ndsl.quantity import Quantity
from pyFV3.dycore_state import DycoreState

from .state import DriverState
from ndsl.monitor import Monitor, ZarrMonitor
from ndsl.monitor.netcdf_monitor import NetCDFMonitor
from ndsl.typing import Communicator
from pace.driver.state import DriverState
from pyFV3 import DycoreState


try:
Expand Down
48 changes: 24 additions & 24 deletions driver/pace/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,31 @@
import dacite
import yaml

import pyFV3
import pySHiELD
from ndsl.comm.comm_abc import Comm
from ndsl.comm.communicator import (
Communicator,
from ndsl import (
CompilationConfig,
CubedSphereCommunicator,
DaceConfig,
GridIndexing,
PerformanceCollector,
QuantityFactory,
RunMode,
StencilConfig,
StencilFactory,
SubtileGridSizer,
TileCommunicator,
TilePartitioner,
ndsl_log,
)
from ndsl.comm.partitioner import TilePartitioner
from ndsl.comm import Comm
from ndsl.constants import N_HALO_DEFAULT
from ndsl.dsl.dace.dace_config import DaceConfig
from ndsl.dsl.dace.orchestration import dace_inhibitor, orchestrate
from ndsl.dsl.stencil import GridIndexing, StencilFactory
from ndsl.dsl.stencil_config import CompilationConfig, RunMode, StencilConfig
from ndsl.dsl.typing import Float
from ndsl.grid import DampingCoefficients, DriverGridData, GridData
from ndsl.initialization.allocator import QuantityFactory
from ndsl.initialization.sizer import SubtileGridSizer
from ndsl.logging import ndsl_log
from ndsl.performance import PerformanceConfig
from ndsl.performance.collector import PerformanceCollector
from ndsl.performance.timer import Timer
from ndsl.performance import PerformanceConfig, Timer
from ndsl.typing import Communicator
from pace.driver.safety_checks import SafetyChecker
from pyFV3 import DynamicalCore, DynamicalCoreConfig
from pySHiELD import Physics, PhysicsConfig

# TODO: move update_atmos_state into pace.driver
from pySHiELD.update import update_atmos_state
Expand Down Expand Up @@ -112,12 +114,10 @@ class DriverConfig:
comm_config: CreatesCommSelector = dataclasses.field(
default_factory=CreatesCommSelector
)
dycore_config: pyFV3.DynamicalCoreConfig = dataclasses.field(
default_factory=pyFV3.DynamicalCoreConfig
)
physics_config: pySHiELD.PhysicsConfig = dataclasses.field(
default_factory=pySHiELD.PhysicsConfig
dycore_config: DynamicalCoreConfig = dataclasses.field(
default_factory=DynamicalCoreConfig
)
physics_config: PhysicsConfig = dataclasses.field(default_factory=PhysicsConfig)

days: int = 0
hours: int = 0
Expand Down Expand Up @@ -242,14 +242,14 @@ def from_dict(cls, kwargs: Dict[str, Any]) -> "DriverConfig":
)

kwargs["dycore_config"] = dacite.from_dict(
data_class=pyFV3.DynamicalCoreConfig,
data_class=DynamicalCoreConfig,
data=kwargs.get("dycore_config", {}),
config=dacite.Config(strict=True),
)

if isinstance(kwargs["physics_config"], dict):
kwargs["physics_config"] = dacite.from_dict(
data_class=pySHiELD.PhysicsConfig,
data_class=PhysicsConfig,
data=kwargs.get("physics_config", {}),
config=dacite.Config(strict=True),
)
Expand Down Expand Up @@ -491,7 +491,7 @@ def exit_instead_of_build(self):

self._start_time = self.config.initialization.start_time
ndsl_log.info("setting up dycore object started")
self.dycore = pyFV3.DynamicalCore(
self.dycore = DynamicalCore(
comm=communicator,
grid_data=self.state.grid_data,
stencil_factory=self.stencil_factory,
Expand All @@ -506,7 +506,7 @@ def exit_instead_of_build(self):

ndsl_log.info("setting up physics object started")
if not config.dycore_only and not config.disable_step_physics:
self.physics = pySHiELD.Physics(
self.physics = Physics(
stencil_factory=self.stencil_factory,
quantity_factory=self.quantity_factory,
grid_data=self.state.grid_data,
Expand Down
Loading
Loading