diff --git a/.gitignore b/.gitignore index 24f794a4..35923df0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ driver/examples/comm 20*-*-*-*-*-*.json *.pkl +# example outputs +examples/mpi/output + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/examples/mpi/.gitignore b/examples/mpi/.gitignore deleted file mode 100644 index 53752db2..00000000 --- a/examples/mpi/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output diff --git a/ndsl/comm/boundary.py b/ndsl/comm/boundary.py index 020798c6..f6016f6e 100644 --- a/ndsl/comm/boundary.py +++ b/ndsl/comm/boundary.py @@ -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 @@ -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 diff --git a/ndsl/comm/communicator.py b/ndsl/comm/communicator.py index ba980d19..014142da 100644 --- a/ndsl/comm/communicator.py +++ b/ndsl/comm/communicator.py @@ -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 @@ -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 @@ -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: diff --git a/ndsl/dsl/__init__.py b/ndsl/dsl/__init__.py index ed44420a..b7034e07 100644 --- a/ndsl/dsl/__init__.py +++ b/ndsl/dsl/__init__.py @@ -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" diff --git a/ndsl/dsl/dace/dace_config.py b/ndsl/dsl/dace/dace_config.py index 7f1c1477..5129dac8 100644 --- a/ndsl/dsl/dace/dace_config.py +++ b/ndsl/dsl/dace/dace_config.py @@ -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 @@ -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" ) diff --git a/ndsl/dsl/gt4py_utils.py b/ndsl/dsl/gt4py_utils.py index acfee07f..31c60ca7 100644 --- a/ndsl/dsl/gt4py_utils.py +++ b/ndsl/dsl/gt4py_utils.py @@ -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 diff --git a/ndsl/grid/generation.py b/ndsl/grid/generation.py index 50209d21..f77e2cd2 100644 --- a/ndsl/grid/generation.py +++ b/ndsl/grid/generation.py @@ -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 """ @@ -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: @@ -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: @@ -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: diff --git a/ndsl/grid/global_setup.py b/ndsl/grid/global_setup.py index a0237ec6..60bd3c3b 100644 --- a/ndsl/grid/global_setup.py +++ b/ndsl/grid/global_setup.py @@ -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: @@ -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 diff --git a/ndsl/grid/gnomonic.py b/ndsl/grid/gnomonic.py index 778d9064..0fc421ef 100644 --- a/ndsl/grid/gnomonic.py +++ b/ndsl/grid/gnomonic.py @@ -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 ( @@ -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) diff --git a/ndsl/grid/mirror.py b/ndsl/grid/mirror.py index cf547bdf..3f3a4b6b 100644 --- a/ndsl/grid/mirror.py +++ b/ndsl/grid/mirror.py @@ -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 diff --git a/ndsl/grid/stretch_transformation.py b/ndsl/grid/stretch_transformation.py index 5604a110..9a481ab9 100644 --- a/ndsl/grid/stretch_transformation.py +++ b/ndsl/grid/stretch_transformation.py @@ -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 diff --git a/ndsl/halo/data_transformer.py b/ndsl/halo/data_transformer.py index cb50cc12..9f9ab2f6 100644 --- a/ndsl/halo/data_transformer.py +++ b/ndsl/halo/data_transformer.py @@ -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. diff --git a/ndsl/halo/updater.py b/ndsl/halo/updater.py index 665d0b95..76f7608f 100644 --- a/ndsl/halo/updater.py +++ b/ndsl/halo/updater.py @@ -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__( @@ -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. @@ -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. @@ -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() @@ -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(): diff --git a/ndsl/io.py b/ndsl/io.py index 9d9f9149..b07248bb 100644 --- a/ndsl/io.py +++ b/ndsl/io.py @@ -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}." diff --git a/ndsl/namelist.py b/ndsl/namelist.py index 205954ca..304d9160 100644 --- a/ndsl/namelist.py +++ b/ndsl/namelist.py @@ -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 @@ -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 @@ -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): diff --git a/ndsl/stencils/__init__.py b/ndsl/stencils/__init__.py index cbbd3f82..5115a28e 100644 --- a/ndsl/stencils/__init__.py +++ b/ndsl/stencils/__init__.py @@ -1,4 +1 @@ from .corners import CopyCorners, CopyCornersXY, FillCornersBGrid - - -__version__ = "0.2.0" diff --git a/ndsl/stencils/c2l_ord.py b/ndsl/stencils/c2l_ord.py index 67f2b5a1..39194232 100644 --- a/ndsl/stencils/c2l_ord.py +++ b/ndsl/stencils/c2l_ord.py @@ -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 diff --git a/ndsl/stencils/corners.py b/ndsl/stencils/corners.py index 5eb7767a..18c1f6c1 100644 --- a/ndsl/stencils/corners.py +++ b/ndsl/stencils/corners.py @@ -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) diff --git a/ndsl/stencils/testing/README.md b/ndsl/stencils/testing/README.md index f8b0f04f..098dd489 100644 --- a/ndsl/stencils/testing/README.md +++ b/ndsl/stencils/testing/README.md @@ -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 @@ -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: @@ -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 @@ -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. diff --git a/ndsl/stencils/testing/serialbox_to_netcdf.py b/ndsl/stencils/testing/serialbox_to_netcdf.py index d03f295d..46996dbe 100644 --- a/ndsl/stencils/testing/serialbox_to_netcdf.py +++ b/ndsl/stencils/testing/serialbox_to_netcdf.py @@ -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): @@ -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 [ @@ -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 ) diff --git a/ndsl/stencils/testing/test_translate.py b/ndsl/stencils/testing/test_translate.py index 9f0278d8..70480c16 100644 --- a/ndsl/stencils/testing/test_translate.py +++ b/ndsl/stencils/testing/test_translate.py @@ -76,15 +76,15 @@ def process_override(threshold_overrides, testobj, test_name, backend): "ignore_near_zero_errors is either a list or a dict" ) if "multimodal" in match: - parsed_mutimodal = match["multimodal"] - if "absolute_epsilon" in parsed_mutimodal: - testobj.mmr_absolute_eps = float(parsed_mutimodal["absolute_eps"]) - if "relative_fraction" in parsed_mutimodal: + parsed_multimodal = match["multimodal"] + if "absolute_epsilon" in parsed_multimodal: + testobj.mmr_absolute_eps = float(parsed_multimodal["absolute_eps"]) + if "relative_fraction" in parsed_multimodal: testobj.mmr_relative_fraction = float( - parsed_mutimodal["relative_fraction"] + parsed_multimodal["relative_fraction"] ) - if "ulp_threshold" in parsed_mutimodal: - testobj.mmr_ulp = float(parsed_mutimodal["ulp_threshold"]) + if "ulp_threshold" in parsed_multimodal: + testobj.mmr_ulp = float(parsed_multimodal["ulp_threshold"]) if "skip_test" in match: testobj.skip_test = bool(match["skip_test"]) elif len(matches) > 1: @@ -422,7 +422,7 @@ def _report_results(savepoint_name: str, results: Dict[str, BaseMetric]) -> None for varname, metric in results.items(): f.write(f"{varname}: {metric.one_line_report()}\n") - # Detailled log + # Detailed log for varname, metric in results.items(): log_filename = os.path.join(OUTDIR, f"details-{savepoint_name}-{varname}.log") metric.report(log_filename) diff --git a/ndsl/testing/README.md b/ndsl/testing/README.md index f6c7a27d..9154956c 100644 --- a/ndsl/testing/README.md +++ b/ndsl/testing/README.md @@ -31,21 +31,21 @@ More options of `pytest` are available when doing `pytest --help`. ## Metrics -There is three state of a test in `pytest`: FAIL, PASS and XFAIL (expected fail). To clear the PASS status, the output data contained in `NAME-Out.nc` is compared to the computed data via the `TranslateNAME` test. Because this system was developped to port Fortran numerics to many targets (mostly C, but also Python, and CPU/GPU), we can't rely on bit-to-bit comparison and have been developping a couple of metrics. +There is three state of a test in `pytest`: FAIL, PASS and XFAIL (expected fail). To clear the PASS status, the output data contained in `NAME-Out.nc` is compared to the computed data via the `TranslateNAME` test. Because this system was developed to port Fortran numerics to many targets (mostly C, but also Python, and CPU/GPU), we can't rely on bit-to-bit comparison and have been developing a couple of metrics. ### Legacy metric -The legacy metric was used throughout the developement of the dynamical core and microphysics scheme at 64-bit precision. It tries to solve differences over big and small amplitutde values with a single formula that goes as follows: $`\|computed-reference|/reference`$ where `reference` has been purged of 0. +The legacy metric was used throughout the development of the dynamical core and microphysics scheme at 64-bit precision. It tries to solve differences over big and small amplitude values with a single formula that goes as follows: $`\|computed-reference|/reference`$ where `reference` has been purged of 0. NaN values are considered no-pass. -To pass the metric has to be lower than `1e-14`, any value lower than `1e-18` will be considered pass by default. The pass threshold can be overriden (see below). +To pass the metric has to be lower than `1e-14`, any value lower than `1e-18` will be considered pass by default. The pass threshold can be overridden (see below). ### Multi-modal metric Moving to mixed precision code, the legacy metric didn't give enough flexibility to account for 32-bit precision errors that could accumulate. Another metric was built with the intent of breaking the one-fit-all concept and giving back flexibility. The metric is a combination of three differences: - _Absolute Difference_ ($`|computed-reference| List[str]: abs_errs = [] details = [ "All failures:", - "Index Computed Reference Absloute E Metric E", + "Index Computed Reference Absolute E Metric E", ] for b in range(bad_indices_count): full_index = tuple([f[b] for f in found_indices]) @@ -195,7 +195,7 @@ class MultiModalFloatMetric(BaseMetric): floating errors. ULP is used to clear noise (ULP<=1.0 passes) - Absolute errors for large amplitute + Absolute errors for large amplitude """ _f32_absolute_eps = _Metric(1e-10) @@ -259,7 +259,7 @@ def _compute_all_metrics( ) self.ulp_distance_metric = self.ulp_distance <= self.ulp_threshold.value - # Combine all distances into sucess or failure + # Combine all distances into success or failure # Success = # - no unexpected NANs (e.g. NaN in the ref MUST BE in computation) OR # - absolute distance pass OR @@ -279,7 +279,7 @@ def _compute_all_metrics( return success else: raise TypeError( - f"recieved data with unexpected dtype {self.references.dtype}" + f"received data with unexpected dtype {self.references.dtype}" ) def _has_override(self) -> bool: @@ -290,17 +290,17 @@ def _has_override(self) -> bool: ) def one_line_report(self) -> str: - metric_threholds = f"{'🔶 ' if not self.absolute_eps.is_default else '' }Absolute E(<{self.absolute_eps.value:.2e}) " - metric_threholds += f"{'🔶 ' if not self.relative_fraction.is_default else '' }Relative E(<{self.relative_fraction.value * 100:.2e}%) " - metric_threholds += f"{'🔶 ' if not self.ulp_threshold.is_default else '' }ULP E(<{self.ulp_threshold.value})" + metric_thresholds = f"{'🔶 ' if not self.absolute_eps.is_default else '' }Absolute E(<{self.absolute_eps.value:.2e}) " + metric_thresholds += f"{'🔶 ' if not self.relative_fraction.is_default else '' }Relative E(<{self.relative_fraction.value * 100:.2e}%) " + metric_thresholds += f"{'🔶 ' if not self.ulp_threshold.is_default else '' }ULP E(<{self.ulp_threshold.value})" if self.check and self._has_override(): - return f"🔶 No numerical differences with threshold override - metric: {metric_threholds}" + return f"🔶 No numerical differences with threshold override - metric: {metric_thresholds}" elif self.check: - return f"✅ No numerical differences - metric: {metric_threholds}" + return f"✅ No numerical differences - metric: {metric_thresholds}" else: failed_indices = len(np.logical_not(self.success).nonzero()[0]) all_indices = len(self.references.flatten()) - return f"❌ Numerical failures: {failed_indices}/{all_indices} failed - metric: {metric_threholds}" + return f"❌ Numerical failures: {failed_indices}/{all_indices} failed - metric: {metric_thresholds}" def report(self, file_path: Optional[str] = None) -> List[str]: report = [] diff --git a/ndsl/utils.py b/ndsl/utils.py index 0d22330c..36316680 100644 --- a/ndsl/utils.py +++ b/ndsl/utils.py @@ -90,7 +90,7 @@ def safe_mpi_allocate( """Make sure the allocation use an allocator that works with MPI For G2G transfer, MPICH requires the allocation to not be done - with managedmemory. Since we can't know what state `cupy` is in + with managed memory. Since we can't know what state `cupy` is in with switch for the default pooled allocator. If allocator comes from cupy, it must be cupy.empty or cupy.zeros. diff --git a/tests/dsl/test_caches.py b/tests/dsl/test_caches.py index 893fb89d..768238e2 100644 --- a/tests/dsl/test_caches.py +++ b/tests/dsl/test_caches.py @@ -60,7 +60,7 @@ def _build_stencil(backend, orchestrated: DaCeOrchestration): return built_stencil, grid_indexing, stencil_config -class OrchestratedProgam: +class OrchestratedProgram: def __init__(self, backend, orchestration): self.stencil, grid_indexing, stencil_config = _build_stencil( backend, orchestration @@ -92,7 +92,7 @@ def test_relocatability_orchestration(backend): working_dir = str(os.getcwd()) # Compile on default - p0 = OrchestratedProgam(backend, DaCeOrchestration.BuildAndRun) + p0 = OrchestratedProgram(backend, DaCeOrchestration.BuildAndRun) p0() assert os.path.exists( f"{working_dir}/.gt_cache_FV3_A/dacecache/" @@ -105,7 +105,7 @@ def test_relocatability_orchestration(backend): custom_path = f"{working_dir}/.my_cache_path" gt_config.cache_settings["root_path"] = custom_path - p1 = OrchestratedProgam(backend, DaCeOrchestration.BuildAndRun) + p1 = OrchestratedProgram(backend, DaCeOrchestration.BuildAndRun) p1() assert os.path.exists( f"{custom_path}/.gt_cache_FV3_A/dacecache/" @@ -119,14 +119,14 @@ def test_relocatability_orchestration(backend): relocated_path = f"{working_dir}/.my_relocated_cache_path" shutil.copytree(custom_path, relocated_path, dirs_exist_ok=True) gt_config.cache_settings["root_path"] = relocated_path - p2 = OrchestratedProgam(backend, DaCeOrchestration.Run) + p2 = OrchestratedProgram(backend, DaCeOrchestration.Run) p2() # Generate a file exists error to check for bad path bogus_path = "./nope/notatall/nothappening" gt_config.cache_settings["root_path"] = bogus_path with pytest.raises(RuntimeError): - OrchestratedProgam(backend, DaCeOrchestration.Run) + OrchestratedProgram(backend, DaCeOrchestration.Run) # Restore cache settings gt_config.cache_settings["root_path"] = original_root_directory @@ -156,7 +156,7 @@ def test_relocatability(backend: str): backend_sanitized = backend.replace(":", "") # Compile on default - p0 = OrchestratedProgam(backend, DaCeOrchestration.Python) + p0 = OrchestratedProgram(backend, DaCeOrchestration.Python) p0() assert os.path.exists( f"./.gt_cache_000000/py38_1013/{backend_sanitized}/test_caches/_stencil/" @@ -166,7 +166,7 @@ def test_relocatability(backend: str): custom_path = "./.my_cache_path" gt_config.cache_settings["root_path"] = custom_path - p1 = OrchestratedProgam(backend, DaCeOrchestration.Python) + p1 = OrchestratedProgram(backend, DaCeOrchestration.Python) p1() assert os.path.exists( f"{custom_path}/.gt_cache_000000/py38_1013/{backend_sanitized}" @@ -178,7 +178,7 @@ def test_relocatability(backend: str): relocated_path = "./.my_relocated_cache_path" shutil.copytree("./.gt_cache_000000", relocated_path, dirs_exist_ok=True) gt_config.cache_settings["root_path"] = relocated_path - p2 = OrchestratedProgam(backend, DaCeOrchestration.Python) + p2 = OrchestratedProgram(backend, DaCeOrchestration.Python) p2() assert os.path.exists( f"{relocated_path}/.gt_cache_000000/py38_1013/{backend_sanitized}" diff --git a/tests/grid/test_eta.py b/tests/grid/test_eta.py index ab0539f8..1acd9c6d 100755 --- a/tests/grid/test_eta.py +++ b/tests/grid/test_eta.py @@ -22,8 +22,8 @@ values are read-in and stored properly. In addition, this test checks to ensure that the function set_hybrid_pressure_coefficients -fail as expected if the computed eta values -vary non-mononitically and if the eta_file +fails as expected if the computed eta values +vary non-monotonically and if the eta_file is not provided. """ @@ -171,7 +171,7 @@ def test_set_hybrid_pressure_coefficients_not_mono(): eta_file is specified in test_config_not_mono.yaml file and the ak and bk values in the eta_file have been changed nonsensically to result in - erronenous eta values. + erroneous eta values. """ working_dir = str(os.getcwd()) @@ -216,7 +216,7 @@ def test_set_hybrid_pressure_coefficients_not_mono(): if os.path.isfile(out_eta_file): os.remove(out_eta_file) if str(error) == "ETA values are not monotonically increasing": - pytest.xfail("testing eta values are not monotomincally increasing") + pytest.xfail("testing eta values are not monotonically increasing") else: pytest.fail( "ERROR in testing eta values not are not monotonically increasing" diff --git a/tests/mpi/test_mpi_mock.py b/tests/mpi/test_mpi_mock.py index b8202995..6b441702 100644 --- a/tests/mpi/test_mpi_mock.py +++ b/tests/mpi/test_mpi_mock.py @@ -38,7 +38,7 @@ def send_recv(comm, numpy): comm.Send(data, dest=rank + 1) if rank > 0: if isinstance(comm, DummyComm): - print(f"recieving data from {rank - 1} to {rank}") + print(f"receiving data from {rank - 1} to {rank}") comm.Recv(data, source=rank - 1) return data @@ -55,7 +55,7 @@ def send_recv_big_data(comm, numpy): comm.Send(data, dest=rank + 1) if rank > 0: if isinstance(comm, DummyComm): - print(f"recieving data from {rank - 1} to {rank}") + print(f"receiving data from {rank - 1} to {rank}") comm.Recv(data, source=rank - 1) return data @@ -101,7 +101,7 @@ def send_f_contiguous_buffer(comm, numpy): comm.Send(data, dest=rank + 1) if rank > 0: if isinstance(comm, DummyComm): - print(f"recieving data from {rank - 1} to {rank}") + print(f"receiving data from {rank - 1} to {rank}") comm.Recv(data, source=rank - 1) return data @@ -156,7 +156,7 @@ def recv_to_subarray(comm, numpy): comm.Send(data, dest=rank + 1) if rank > 0: if isinstance(comm, DummyComm): - print(f"recieving data from {rank - 1} to {rank}") + print(f"receiving data from {rank - 1} to {rank}") try: comm.Recv(recv_buffer[1:-1, 1:-1, 1:-1], source=rank - 1) except Exception as err: diff --git a/tests/test_halo_data_transformer.py b/tests/test_halo_data_transformer.py index e3f6d851..7e3385e7 100644 --- a/tests/test_halo_data_transformer.py +++ b/tests/test_halo_data_transformer.py @@ -353,8 +353,8 @@ def test_data_transformer_scalar_pack_unpack(quantity, rotation, n_halos): def test_data_transformer_vector_pack_unpack(quantity, rotation, n_halos): - targe_quanity_x = copy.deepcopy(quantity) - targe_quanity_y = copy.deepcopy(targe_quanity_x) + target_quantity_x = copy.deepcopy(quantity) + target_quantity_y = copy.deepcopy(target_quantity_x) x_quantity = quantity y_quantity = copy.deepcopy(x_quantity) @@ -450,8 +450,8 @@ def test_data_transformer_vector_pack_unpack(quantity, rotation, n_halos): quantity.dims, quantity.metadata.np, ) - targe_quanity_x.data[N_edge_boundaries[rotation][1]] = rotated_x - targe_quanity_y.data[N_edge_boundaries[rotation][1]] = rotated_y + target_quantity_x.data[N_edge_boundaries[rotation][1]] = rotated_x + target_quantity_y.data[N_edge_boundaries[rotation][1]] = rotated_y rotated_x, rotated_y = rotate_vector_data( quantity.data[NE_corner_boundaries[rotation][0]], quantity.data[NE_corner_boundaries[rotation][0]], @@ -459,8 +459,8 @@ def test_data_transformer_vector_pack_unpack(quantity, rotation, n_halos): quantity.dims, quantity.metadata.np, ) - targe_quanity_x.data[NE_corner_boundaries[rotation][1]] = rotated_x - targe_quanity_y.data[NE_corner_boundaries[rotation][1]] = rotated_y + target_quantity_x.data[NE_corner_boundaries[rotation][1]] = rotated_x + target_quantity_y.data[NE_corner_boundaries[rotation][1]] = rotated_y - assert (targe_quanity_x.data == x_quantity.data).all() - assert (targe_quanity_y.data == y_quantity.data).all() + assert (target_quantity_x.data == x_quantity.data).all() + assert (target_quantity_y.data == y_quantity.data).all() diff --git a/tests/test_halo_update.py b/tests/test_halo_update.py index 3d3bf501..9c1ac220 100644 --- a/tests/test_halo_update.py +++ b/tests/test_halo_update.py @@ -914,7 +914,7 @@ def test_halo_updater_stability( assert len(BUFFER_CACHE) == 1 assert len(next(iter(BUFFER_CACHE.values()))) == 0 - # Manually call finalize on the transfomers + # Manually call finalize on the transformers # This should recache all the buffers # DSL-816 will refactor that behavior out for halo_updater in halo_updaters: