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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ driver/examples/comm
20*-*-*-*-*-*.json
*.pkl

# example outputs
examples/mpi/output

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
1 change: 0 additions & 1 deletion examples/mpi/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions ndsl/comm/boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def send_view(self, quantity: Quantity, n_points: int):
return self._view(quantity, n_points, interior=True)

def recv_view(self, quantity: Quantity, n_points: int):
"""Return a sliced view of points which should be recieved at this boundary.
"""Return a sliced view of points which should be received at this boundary.

Args:
quantity: quantity for which to return a slice
Expand All @@ -37,7 +37,7 @@ def recv_view(self, quantity: Quantity, n_points: int):
return self._view(quantity, n_points, interior=False)

def send_slice(self, specification: QuantityHaloSpec) -> Tuple[slice]:
"""Return the index slices which shoud be sent at this boundary.
"""Return the index slices which should be sent at this boundary.

Args:
specification: data specifications for the halo. Including shape
Expand Down
6 changes: 3 additions & 3 deletions ndsl/comm/communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def gather_state(self, send_state=None, recv_state=None, transfer_type=None):

Args:
send_state: the model state to be sent containing the subtile data
recv_state: the pre-allocated state in which to recieve the full tile
recv_state: the pre-allocated state in which to receive the full tile
state. Only variables which are scattered will be written to.
Returns:
recv_state: on the root rank, the state containing the entire tile
Expand Down Expand Up @@ -340,7 +340,7 @@ def scatter_state(self, send_state=None, recv_state=None):
Args:
send_state: the model state to be sent containing the entire tile,
required only from the root rank
recv_state: the pre-allocated state in which to recieve the scattered
recv_state: the pre-allocated state in which to receive the scattered
state. Only variables which are scattered will be written to.
Returns:
rank_state: the state corresponding to this rank's subdomain
Expand Down Expand Up @@ -776,7 +776,7 @@ def __init__(
"""
if not issubclass(type(comm), CommABC):
raise TypeError(
"Communictor needs to be instantiated with communication subsytem"
"Communicator needs to be instantiated with communication subsystem"
f" derived from `comm_abc.Comm`, got {type(comm)}."
)
if comm.Get_size() != partitioner.total_ranks:
Expand Down
2 changes: 0 additions & 2 deletions ndsl/dsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@
gt4py.cartesian.config.cache_settings["dir_name"] = os.environ.get(
"GT_CACHE_DIR_NAME", f".gt_cache_{MPI.COMM_WORLD.Get_rank():06}"
)

__version__ = "0.2.0"
4 changes: 2 additions & 2 deletions ndsl/dsl/dace/dace_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _determine_compiling_ranks(
6 7 8
3 4 5
0 1 2
Using the partitionner we find mapping of the given layout
Using the partitioner we find mapping of the given layout
to all of those. For example on 4x4 layout
12 13 14 15
8 9 10 11
Expand Down Expand Up @@ -217,7 +217,7 @@ def __init__(
# Block size/thread count is defaulted to an average value for recent
# hardware (Pascal and upward). The problem of setting an optimized
# block/thread is both hardware and problem dependant. Fine tuners
# available in DaCe should be relied on for futher tuning of this value.
# available in DaCe should be relied on for further tuning of this value.
dace.config.Config.set(
"compiler", "cuda", "default_block_size", value="64,8,1"
)
Expand Down
2 changes: 1 addition & 1 deletion ndsl/dsl/gt4py_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _mask_to_dimensions(

def _translate_origin(origin: Sequence[int], mask: Tuple[bool, ...]) -> Sequence[int]:
if len(origin) == int(sum(mask)):
# Correct length. Assumedd to be correctly specified.
# Correct length. Assumed to be correctly specified.
return origin

assert len(mask) == 3
Expand Down
14 changes: 7 additions & 7 deletions ndsl/grid/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def ptop(self) -> Quantity:
@property
def ec1(self) -> Quantity:
"""
cartesian components of the local unit vetcor
cartesian components of the local unit vector
in the x-direction at the cell centers
3d array whose last dimension is length 3 and indicates cartesian x/y/z value
"""
Expand All @@ -698,8 +698,8 @@ def ec1(self) -> Quantity:
@property
def ec2(self) -> Quantity:
"""
cartesian components of the local unit vetcor
in the y-direation at the cell centers
cartesian components of the local unit vector
in the y-direction at the cell centers
3d array whose last dimension is length 3 and indicates cartesian x/y/z value
"""
if self._ec2 is None:
Expand All @@ -709,8 +709,8 @@ def ec2(self) -> Quantity:
@property
def ew1(self) -> Quantity:
"""
cartesian components of the local unit vetcor
in the x-direation at the left/right cell edges
cartesian components of the local unit vector
in the x-direction at the left/right cell edges
3d array whose last dimension is length 3 and indicates cartesian x/y/z value
"""
if self._ew1 is None:
Expand All @@ -720,8 +720,8 @@ def ew1(self) -> Quantity:
@property
def ew2(self) -> Quantity:
"""
cartesian components of the local unit vetcor
in the y-direation at the left/right cell edges
cartesian components of the local unit vector
in the y-direction at the left/right cell edges
3d array whose last dimension is length 3 and indicates cartesian x/y/z value
"""
if self._ew2 is None:
Expand Down
6 changes: 3 additions & 3 deletions ndsl/grid/global_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def gnomonic_grid(grid_type: int, lon, lat, np):

args:
grid_type: type of grid to apply
lon: longitute array with dimensions [x, y]
lat: latitude array with dimensionos [x, y]
lon: longitude array with dimensions [x, y]
lat: latitude array with dimensions [x, y]
"""
_check_shapes(lon, lat)
if grid_type == 0:
Expand Down Expand Up @@ -142,7 +142,7 @@ def global_mirror_grid(
y1, grid_global[ng + npx - (i + 1), ng + npy - (j + 1), 1, nreg]
)

# force dateline/greenwich-meridion consistency
# force dateline/greenwich-meridian consistency
if npx % 2 != 0:
if i == (npx - 1) // 2:
grid_global[ng + i, ng + j, 0, nreg] = 0.0
Expand Down
6 changes: 3 additions & 3 deletions ndsl/grid/gnomonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ def get_rectangle_area(p1, p2, p3, p4, radius, np):
counterclockwise order, return an array of spherical rectangle areas.
NOTE, this is not the exact same order of operations as the Fortran code
This results in some errors in the last digit, but the spherical_angle
is an exact match. The errors in the last digit multipled out by the radius
end up causing relative errors larger than 1e-14, but still wtihin 1e-12.
is an exact match. The errors in the last digit multiplied out by the radius
end up causing relative errors larger than 1e-14, but still within 1e-12.
"""
total_angle = spherical_angle(p2, p3, p1, np)
for (
Expand Down Expand Up @@ -702,7 +702,7 @@ def spherical_cos(p_center, p2, p3, np):

def get_unit_vector_direction(p1, p2, np):
"""
Returms the unit vector pointing from a set of lonlat points p1 to lonlat points p2
Returns the unit vector pointing from a set of lonlat points p1 to lonlat points p2
"""
xyz1 = lon_lat_to_xyz(p1[:, :, 0], p1[:, :, 1], np)
xyz2 = lon_lat_to_xyz(p2[:, :, 0], p2[:, :, 1], np)
Expand Down
2 changes: 1 addition & 1 deletion ndsl/grid/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def mirror_grid(
y1, mirror_data["local"][i, j, 1]
)

# force dateline/greenwich-meridion consistency
# force dateline/greenwich-meridian consistency
if npx % 2 != 0:
if x_center_tile and i == ng + i_mid:
mirror_data["local"][i, j, 0] = 0.0
Expand Down
4 changes: 2 additions & 2 deletions ndsl/grid/stretch_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def direct_transform(
"""
The direct_transform subroutine from fv_grid_utils.F90.
Takes in latitude and longitude in radians.
Shrinks tile 6 by stretch factor in area to increse resolution locally.
Shrinks tile 6 by stretch factor in area to increase resolution locally.
Then performs translation of all tiles so that the now-smaller tile 6 is
centeres on lon_target, lat_target.
centered on lon_target, lat_target.

Args:
lon (in) in radians
Expand Down
2 changes: 1 addition & 1 deletion ndsl/halo/data_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def get(
"""Construct a module from a numpy-like module.

Args:
np_module: numpy-like module to determin child transformer type.
np_module: numpy-like module to determine child transformer type.
exchange_descriptors_x: list of memory information describing an exchange.
Used for scalar data and the x-component of vectors.
exchange_descriptors_y: list of memory information describing an exchange.
Expand Down
10 changes: 5 additions & 5 deletions ndsl/halo/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HaloUpdater:
- update and start/wait trigger the halo exchange
- the class creates a "pattern" of exchange that can fit
any memory given to do/start
- temporary references to the Quanitites are held between start and wait
- temporary references to the Quantities are held between start and wait
"""

def __init__(
Expand Down Expand Up @@ -106,7 +106,7 @@ def from_scalar_specifications(
numpy_like_module: module implementing numpy API
specifications: data specifications to exchange, including
number of halo points
boundaries: informations on the exchange boundaries.
boundaries: information on the exchange boundaries.
tag: network tag (to differentiate messaging) for this node.
optional_timer: timing of operations.

Expand Down Expand Up @@ -161,7 +161,7 @@ def from_vector_specifications(
Length must match y specifications.
specifications_y: specifications to exchange along the y axis.
Length must match x specifications.
boundaries: informations on the exchange boundaries.
boundaries: information on the exchange boundaries.
tag: network tag (to differentiate messaging) for this node.
optional_timer: timing of operations.

Expand Down Expand Up @@ -210,7 +210,7 @@ def update(
quantities_x: List[Quantity],
quantities_y: Optional[List[Quantity]] = None,
):
"""Exhange the data and blocks until finished."""
"""Exchange the data and blocks until finished."""
self.start(quantities_x, quantities_y)
self.wait()

Expand Down Expand Up @@ -283,7 +283,7 @@ def wait(self):
for recv_req in self._recv_requests:
recv_req.wait()

# Unpack buffers (updated by MPI with neighbouring halos)
# Unpack buffers (updated by MPI with neighboring halos)
# to proper quantities
with self._timer.clock("unpack"):
for buffer in self._transformers.values():
Expand Down
2 changes: 1 addition & 1 deletion ndsl/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def write_state(state: dict, filename: str) -> None:


def _extract_time(value: xr.DataArray) -> cftime.datetime:
"""Exctract time value from read-in state."""
"""Extract time value from read-in state."""
if value.ndim > 0:
raise ValueError(
"State must be representative of a single scalar time. " f"Got {value}."
Expand Down
10 changes: 5 additions & 5 deletions ndsl/namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NamelistDefaults:
qi_gen = 1.82e-6 # max cloud ice generation during remapping step
qi_lim = 1.0 # cloud ice limiter to prevent large ice build up
qi0_max = 1.0e-4 # max cloud ice value (by other sources)
rad_snow = True # consider snow in cloud fraciton calculation
rad_snow = True # consider snow in cloud fraction calculation
rad_rain = True # consider rain in cloud fraction calculation
rad_graupel = True # consider graupel in cloud fraction calculation
tintqs = False # use temperature in the saturation mixing in PDF
Expand Down Expand Up @@ -110,7 +110,7 @@ class NamelistDefaults:
z_slope_liq = True # Use linear mono slope for autoconversions
tice = 273.16 # set tice = 165. to turn off ice - phase phys (kessler emulator)
alin = 842.0 # "a" in lin1983
clin = 4.8 # "c" in lin 1983, 4.8 -- > 6. (to ehance ql -- > qs)
clin = 4.8 # "c" in lin 1983, 4.8 -- > 6. (to enhance ql -- > qs)
isatmedmf = 0 # which version of satmedmfvdif to use
dspheat = False # flag for tke dissipative heating
xkzm_h = 1.0 # background vertical diffusion for heat q over ocean
Expand All @@ -123,10 +123,10 @@ class NamelistDefaults:
xkzm_lim = 0.01 # background vertical diffusion limit
xkzminv = 0.15 # diffusivity in inversion layers
xkgdx = 25.0e3 # background vertical diffusion threshold
rlmn = 30.0 # lower-limter on asymtotic mixing length in satmedmfdiff
rlmx = 300.0 # upper-limter on asymtotic mixing length in satmedmfdiff
rlmn = 30.0 # lower-limiter on asymtotic mixing length in satmedmfdiff
rlmx = 300.0 # upper-limiter on asymtotic mixing length in satmedmfdiff
do_dk_hb19 = False # flag for using hb19 background diff formula in satmedmfdiff
cap_k0_land = False # flag for applying limter on background diff in inversion layer over land in satmedmfdiff
cap_k0_land = False # flag for applying limiter on background diff in inversion layer over land in satmedmfdiff

@classmethod
def as_dict(cls):
Expand Down
3 changes: 0 additions & 3 deletions ndsl/stencils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from .corners import CopyCorners, CopyCornersXY, FillCornersBGrid


__version__ = "0.2.0"
2 changes: 1 addition & 1 deletion ndsl/stencils/c2l_ord.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def __init__(
)

# TODO:
# To break the depedency to pyFV3 we allow ourselves to not have a type
# To break the dependency to pyFV3 we allow ourselves to not have a type
# hint around state and we check for u and v to make sure we don't
# have bad input.
# This entire code should be retired when WrappedHaloUpdater is no longer
Expand Down
2 changes: 1 addition & 1 deletion ndsl/stencils/corners.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, direction: str, stencil_factory: StencilFactory) -> None:
def __call__(self, field: FloatField):
"""
Fills cell quantity field using corners from itself and multipliers
in the dirction specified initialization of the instance of this class.
in the direction specified initialization of the instance of this class.
"""
self._copy_corners(field, field)

Expand Down
12 changes: 6 additions & 6 deletions ndsl/stencils/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ First, make sure you have followed the instruction in the top level [README](../

The unit and regression tests of pace require data generated from the Fortran reference implementation which has to be downloaded from a Google Cloud Platform storage bucket. Since the bucket is setup as "requester pays", you need a valid GCP account to download the test data.

First, make sure you have configured the authentication with user credientials and configured Docker with the following commands:
First, make sure you have configured the authentication with user credentials and configured Docker with the following commands:

```shell
gcloud auth login
Expand All @@ -22,11 +22,11 @@ cd $(git rev-parse --show-toplevel)/physics
make get_test_data
```

If you do not have a GCP account, there is an option to download basic test data from a public FTP server and you can skip the GCP authentication step above. To download test data from the FTP server, use `make USE_FTP=yes get_test_data` instead and this will avoid fetching from a GCP storage bucket. You will need a valid in stallation of the `lftp` command.
If you do not have a GCP account, there is an option to download basic test data from a public FTP server and you can skip the GCP authentication step above. To download test data from the FTP server, use `make USE_FTP=yes get_test_data` instead and this will avoid fetching from a GCP storage bucket. You will need a valid installation of the `lftp` command.

## Running the tests (manually)

There are two ways to run the tests, manually by explicitly invoking `pytest` or autmatically using make targets. The former can be used both inside the Docker container as well as for a bare-metal installation and will be described here.
There are two ways to run the tests, manually by explicitly invoking `pytest` or automatically using make targets. The former can be used both inside the Docker container as well as for a bare-metal installation and will be described here.

First enter the container and navigate to the pace directory:

Expand All @@ -40,7 +40,7 @@ Note that by entering the container with the `make dev` command, volumes for cod

There are two sets of tests. The "sequential tests" test components which do not require MPI-parallelism. The "parallel tests" can only within an MPI environment.

To run the sequential and parallel tests for the dynmical core (fv3core), you can execute the following commands (these take a bit of time):
To run the sequential and parallel tests for the dynamical core (fv3core), you can execute the following commands (these take a bit of time):

```shell
pytest -v -s --data_path=/pace/fv3core/test_data/8.1.1/c12_6ranks_standard/dycore/ ./fv3core/tests
Expand Down Expand Up @@ -79,8 +79,8 @@ DEV=y make physics_savepoint_tests_mpi
## Test failure

Test are running for each gridpoint of the domain, unless the Translate class for the test specifically restricts it.
Upon failure, the test will drop a `netCDF` faile in a `./.translate-errors` directory and named `translate-TestCase(-Rank).nc` containing input, computed output, reference and errors.
Upon failure, the test will drop a `netCDF` file in a `./.translate-errors` directory and named `translate-TestCase(-Rank).nc` containing input, computed output, reference and errors.

## Environment variables

- `PACE_TEST_N_THRESHOLD_SAMPLES`: Upon failure the system will try to pertub the output in an attempt to check for numerical instability. This means re-running the test for N samples. Default is `10`, `0` or less turns this feature off.
- `PACE_TEST_N_THRESHOLD_SAMPLES`: Upon failure the system will try to perturb the output in an attempt to check for numerical instability. This means re-running the test for N samples. Default is `10`, `0` or less turns this feature off.
6 changes: 3 additions & 3 deletions ndsl/stencils/testing/serialbox_to_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def main(
for varname in set(names_list).difference(["rank"]):
# Check that all ranks have the same size. If not, aggregate and
# feedback on one rank
colapse_all_ranks = False
collapse_all_ranks = False
data_shape = list(rank_list[0][varname][0].shape)
print(f" Exporting {varname} - {data_shape}")
for rank in range(total_ranks):
Expand All @@ -159,7 +159,7 @@ def main(
print(
f"... different shape for {varname} across ranks, collapsing in on rank."
)
colapse_all_ranks = True
collapse_all_ranks = True
break

if savepoint_name in [
Expand All @@ -185,7 +185,7 @@ def main(
data_vars[varname] = get_data(
data_shape, total_ranks, n_savepoints, rank_list, varname
)
elif colapse_all_ranks:
elif collapse_all_ranks:
data_vars[varname] = get_data_collapse_all_ranks(
total_ranks, n_savepoints, rank_list, varname
)
Expand Down
Loading