diff --git a/ndsl/comm/communicator.py b/ndsl/comm/communicator.py index 6eee4514..bddb1cf2 100644 --- a/ndsl/comm/communicator.py +++ b/ndsl/comm/communicator.py @@ -326,6 +326,7 @@ def gather_state(self, send_state=None, recv_state=None, transfer_type=None): # dims=quantity.dims, units=quantity.units, allow_mismatch_float_precision=True, + gt4py_backend=quantity.metadata.gt4py_backend, ) if recv_state is not None and name in recv_state: tile_quantity = self.gather( diff --git a/ndsl/monitor/netcdf_monitor.py b/ndsl/monitor/netcdf_monitor.py index e2cb417f..6fc81d1a 100644 --- a/ndsl/monitor/netcdf_monitor.py +++ b/ndsl/monitor/netcdf_monitor.py @@ -21,6 +21,7 @@ def __init__(self, initial: Quantity, time_chunk_size: int): self._dims = initial.dims self._units = initial.units self._i_time = 1 + self._backend = initial.metadata.gt4py_backend def append(self, quantity: Quantity) -> None: # Allow mismatch precision here since this is I/O @@ -37,6 +38,7 @@ def data(self) -> Quantity: dims=("time",) + tuple(self._dims), units=self._units, allow_mismatch_float_precision=True, + gt4py_backend=self._backend, ) diff --git a/ndsl/quantity/quantity.py b/ndsl/quantity/quantity.py index c460b53d..3dfd0696 100644 --- a/ndsl/quantity/quantity.py +++ b/ndsl/quantity/quantity.py @@ -45,7 +45,7 @@ def __init__( dims (Sequence[str]): dimension names for each axis units (str): units of the quantity origin (Sequence[int] | None, optional): first point in data within the - computational domain. Defaults to None. + computational domain. Defaults to None. extent (Sequence[int] | None, optional): number of points along each axis within the computational domain. Defaults to None. gt4py_backend (str | None, optional): backend to use for gt4py storages, @@ -59,6 +59,13 @@ def __init__( ValueError: Data-type mismatch between configuration and input-data TypeError: Typing of the data that does not fit """ + if gt4py_backend is None: + warnings.warn( + "gt4py_backend will be mandatory in future releases.", + DeprecationWarning, + stacklevel=2, + ) + if ( not allow_mismatch_float_precision and is_float(data.dtype) @@ -84,9 +91,11 @@ def __init__( if not isinstance(data, (np.ndarray, cupy.ndarray)): raise TypeError( - f"Only supports numpy.ndarray and cupy.ndarray, got {type(data)}" + f"Only supports numpy.ndarray and cupy.ndarray, got {type(data)}." ) + _validate_quantity_property_lengths(data.shape, dims, origin, extent) + if gt4py_backend is not None: gt4py_backend_cls = gt_backend.from_name(gt4py_backend) is_optimal_layout = gt4py_backend_cls.storage_info["is_optimal_layout"] @@ -104,21 +113,25 @@ def __init__( ] ) - self._data = ( - data - if is_optimal_layout(data, dimensions) - else self._initialize_data( + # Assign data. Makes a copy if the layout isn't optimal for the given backend. + if is_optimal_layout(data, dimensions): + self._data = data + else: + warnings.warn( + f"Copying data to optimal layout for given backend {gt4py_backend}.", + UserWarning, + stacklevel=2, + ) + self._data = self._initialize_data( data, origin=origin, gt4py_backend=gt4py_backend, dimensions=dimensions, ) - ) else: # We have no info about the gt4py_backend, so just assign it. self._data = data - _validate_quantity_property_lengths(data.shape, dims, origin, extent) self._metadata = QuantityMetadata( origin=_ensure_int_tuple(origin, "origin"), extent=_ensure_int_tuple(extent, "extent"), @@ -156,6 +169,14 @@ def from_data_array( """ if "units" not in data_array.attrs: raise ValueError("need units attribute to create Quantity from DataArray") + + if gt4py_backend is None: + warnings.warn( + "gt4py_backend will be mandatory in future releases.", + DeprecationWarning, + stacklevel=2, + ) + return cls( data_array.values, cast(tuple[str], data_array.dims), diff --git a/tests/dsl/test_stencil.py b/tests/dsl/test_stencil.py index 4daa401c..2f9f078d 100644 --- a/tests/dsl/test_stencil.py +++ b/tests/dsl/test_stencil.py @@ -108,7 +108,9 @@ def test_domain_size_comparison( domain: tuple[int], call_count: int, ): - quantity = Quantity(np.zeros(extent), dimensions, "n/a", extent=extent) + quantity = Quantity( + np.zeros(extent), dimensions, "n/a", extent=extent, gt4py_backend="debug" + ) stencil = FrozenStencil( copy_stencil, origin=(0, 0, 0), @@ -147,7 +149,9 @@ def two_dim_temporaries_stencil(q_out: FloatField) -> None: def test_stencil_2D_temporaries() -> None: domain = (2, 2, 5) - quantity = Quantity(np.zeros(domain), ["x", "y", "z"], "n/a", extent=domain) + quantity = Quantity( + np.zeros(domain), ["x", "y", "z"], "n/a", extent=domain, gt4py_backend="debug" + ) stencil = FrozenStencil( two_dim_temporaries_stencil, origin=(0, 0, 0), @@ -164,7 +168,9 @@ def test_stencil_2D_temporaries() -> None: ) def test_validation_call_count(iterations: tuple[int]): domain = (2, 2, 5) - quantity = Quantity(np.zeros(domain), ["x", "y", "z"], "n/a", extent=domain) + quantity = Quantity( + np.zeros(domain), ["x", "y", "z"], "n/a", extent=domain, gt4py_backend="debug" + ) stencil_config = StencilConfig( compilation_config=CompilationConfig(backend="numpy", rebuild=True) ) diff --git a/tests/mpi/test_mpi_halo_update.py b/tests/mpi/test_mpi_halo_update.py index 76aca71e..e4513967 100644 --- a/tests/mpi/test_mpi_halo_update.py +++ b/tests/mpi/test_mpi_halo_update.py @@ -277,6 +277,7 @@ def depth_quantity( units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) return quantity @@ -325,6 +326,7 @@ def zeros_quantity(dims, units, origin, extent, shape, numpy, dtype): units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) quantity.view[:] = 0.0 return quantity diff --git a/tests/quantity/test_boundary.py b/tests/quantity/test_boundary.py index a4f8e812..a01e759c 100644 --- a/tests/quantity/test_boundary.py +++ b/tests/quantity/test_boundary.py @@ -36,6 +36,7 @@ def test_boundary_data_1_by_1_array_1_halo(): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ) for side in ( WEST, @@ -71,6 +72,7 @@ def test_boundary_data_3d_array_1_halo_z_offset_origin(numpy): units="m", origin=(1, 1, 1), extent=(1, 1, 1), + gt4py_backend="debug", ) for side in ( WEST, @@ -109,6 +111,7 @@ def test_boundary_data_2_by_2_array_2_halo(): units="m", origin=(2, 2), extent=(2, 2), + gt4py_backend="debug", ) for side in ( WEST, diff --git a/tests/quantity/test_deepcopy.py b/tests/quantity/test_deepcopy.py index d6b5c7cb..94ecf447 100644 --- a/tests/quantity/test_deepcopy.py +++ b/tests/quantity/test_deepcopy.py @@ -14,6 +14,7 @@ def test_deepcopy_copy_is_editable_by_view(): extent=(nx, ny, nz), dims=["x", "y", "z"], units="", + gt4py_backend="debug", ) quantity_copy = copy.deepcopy(quantity) # assertion below is only valid if we're overwriting the entire data through view @@ -31,6 +32,7 @@ def test_deepcopy_copy_is_editable_by_data(): extent=(nx, ny, nz), dims=["x", "y", "z"], units="", + gt4py_backend="debug", ) quantity_copy = copy.deepcopy(quantity) quantity_copy.data[:] = 1.0 @@ -46,6 +48,7 @@ def test_deepcopy_of_dataclass_is_editable_by_data(): extent=(nx, ny, nz), dims=["x", "y", "z"], units="", + gt4py_backend="debug", ) quantity_copy = copy.deepcopy(quantity) quantity_copy.data[:] = 1.0 diff --git a/tests/quantity/test_quantity.py b/tests/quantity/test_quantity.py index dccfa94f..319b8955 100644 --- a/tests/quantity/test_quantity.py +++ b/tests/quantity/test_quantity.py @@ -61,7 +61,14 @@ def data(n_halo, extent_1d, n_dims, numpy, dtype): @pytest.fixture def quantity(data, origin, extent, dims, units): - return Quantity(data, origin=origin, extent=extent, dims=dims, units=units) + return Quantity( + data, + origin=origin, + extent=extent, + dims=dims, + units=units, + gt4py_backend="debug", + ) def test_smaller_data_raises(data, origin, extent, dims, units): @@ -73,23 +80,49 @@ def test_smaller_data_raises(data, origin, extent, dims, units): else: with pytest.raises(ValueError): Quantity( - small_data, origin=origin, extent=extent, dims=dims, units=units + small_data, + origin=origin, + extent=extent, + dims=dims, + units=units, + gt4py_backend="debug", ) def test_smaller_dims_raises(data, origin, extent, dims, units): with pytest.raises(ValueError): - Quantity(data, origin=origin, extent=extent, dims=dims[:-1], units=units) + Quantity( + data, + origin=origin, + extent=extent, + dims=dims[:-1], + units=units, + gt4py_backend="debug", + ) def test_smaller_origin_raises(data, origin, extent, dims, units): with pytest.raises(ValueError): - Quantity(data, origin=origin[:-1], extent=extent, dims=dims, units=units) + Quantity( + data, + origin=origin[:-1], + extent=extent, + dims=dims, + units=units, + gt4py_backend="debug", + ) def test_smaller_extent_raises(data, origin, extent, dims, units): with pytest.raises(ValueError): - Quantity(data, origin=origin, extent=extent[:-1], dims=dims, units=units) + Quantity( + data, + origin=origin, + extent=extent[:-1], + dims=dims, + units=units, + gt4py_backend="debug", + ) def test_data_change_affects_quantity(data, quantity, numpy): @@ -228,20 +261,15 @@ def test_shift_slice(slice_in, shift, extent, slice_out): @pytest.mark.parametrize( "quantity", [ + Quantity(np.array(5), dims=[], units="", gt4py_backend="debug"), Quantity( - np.array(5), - dims=[], - units="", - ), - Quantity( - np.array([1, 2, 3]), - dims=["dimension"], - units="degK", + np.array([1, 2, 3]), dims=["dimension"], units="degK", gt4py_backend="debug" ), Quantity( np.random.randn(3, 2, 4), dims=["dim1", "dim_2", "dimension_3"], units="m", + gt4py_backend="debug", ), Quantity( np.random.randn(8, 6, 6), @@ -249,6 +277,7 @@ def test_shift_slice(slice_in, shift, extent, slice_out): units="km", origin=(2, 2, 2), extent=(4, 2, 2), + gt4py_backend="debug", ), ], ) @@ -264,7 +293,7 @@ def test_to_data_array(quantity): def test_data_setter(): - quantity = Quantity(np.ones((5,)), dims=["dim1"], units="") + quantity = Quantity(np.ones((5,)), dims=["dim1"], units="", gt4py_backend="debug") # After allocation - field and data are the same (origin is 0) assert quantity.data.shape == quantity.field.shape diff --git a/tests/quantity/test_storage.py b/tests/quantity/test_storage.py index bc39f61f..094d817d 100644 --- a/tests/quantity/test_storage.py +++ b/tests/quantity/test_storage.py @@ -53,7 +53,14 @@ def data(n_halo, extent_1d, n_dims, numpy, dtype): @pytest.fixture def quantity(data, origin, extent, dims, units): - return Quantity(data, origin=origin, extent=extent, dims=dims, units=units) + return Quantity( + data, + origin=origin, + extent=extent, + dims=dims, + units=units, + gt4py_backend="debug", + ) def test_numpy(quantity, backend): diff --git a/tests/quantity/test_transpose.py b/tests/quantity/test_transpose.py index 5e527279..21a8ed09 100644 --- a/tests/quantity/test_transpose.py +++ b/tests/quantity/test_transpose.py @@ -87,6 +87,7 @@ def quantity(quantity_data_input, initial_dims, initial_origin, initial_extent): units="unit_string", origin=initial_origin, extent=initial_extent, + gt4py_backend="debug", ) @@ -213,7 +214,12 @@ def test_transpose_invalid_cases( def test_transpose_retains_attrs(numpy): - quantity = Quantity(numpy.random.randn(3, 4), dims=["x", "y"], units="unit_string") + quantity = Quantity( + numpy.random.randn(3, 4), + dims=["x", "y"], + units="unit_string", + gt4py_backend="debug", + ) quantity._attrs = {"long_name": "500 mb height"} transposed = quantity.transpose(["y", "x"]) assert transposed.attrs == quantity.attrs diff --git a/tests/quantity/test_view.py b/tests/quantity/test_view.py index 73245093..587ce2b8 100644 --- a/tests/quantity/test_view.py +++ b/tests/quantity/test_view.py @@ -183,6 +183,7 @@ def quantity(request): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ) ], ) @@ -216,6 +217,7 @@ def test_many_indices_raises(quantity, view_name): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ) ], ) @@ -742,6 +744,7 @@ def test_many_slices_raises(quantity, view_name): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (0, 0), 4, @@ -754,6 +757,7 @@ def test_many_slices_raises(quantity, view_name): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, -1), 0, @@ -766,6 +770,7 @@ def test_many_slices_raises(quantity, view_name): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(-1, 0), slice(-1, 0)), np.array([[0]]), @@ -778,6 +783,7 @@ def test_many_slices_raises(quantity, view_name): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, 0), 1, @@ -798,6 +804,7 @@ def test_many_slices_raises(quantity, view_name): units="m", origin=(2, 2), extent=(1, 1), + gt4py_backend="debug", ), (slice(-2, 0), slice(-1, 2)), np.array([[1, 2, 3], [6, 7, 8]]), @@ -816,6 +823,7 @@ def test_southwest(quantity, view_slice, reference): units=quantity.units, origin=quantity.origin[::-1], extent=quantity.extent[::-1], + gt4py_backend=quantity.metadata.gt4py_backend, ) transposed_result = transposed_quantity.view.southwest[view_slice[::-1]] if isinstance(reference, quantity.np.ndarray): @@ -834,6 +842,7 @@ def test_southwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, 0), 4, @@ -846,6 +855,7 @@ def test_southwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (0, -1), 6, @@ -858,6 +868,7 @@ def test_southwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(0, 1), slice(-1, 0)), np.array([[6]]), @@ -870,6 +881,7 @@ def test_southwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, -1), 3, @@ -890,6 +902,7 @@ def test_southwest(quantity, view_slice, reference): units="m", origin=(2, 2), extent=(1, 1), + gt4py_backend="debug", ), (slice(-2, 0), slice(-1, 2)), np.array([[6, 7, 8], [11, 12, 13]]), @@ -908,6 +921,7 @@ def test_southeast(quantity, view_slice, reference): units=quantity.units, origin=quantity.origin[::-1], extent=quantity.extent[::-1], + gt4py_backend=quantity.metadata.gt4py_backend, ) transposed_result = transposed_quantity.view.southeast[view_slice[::-1]] if isinstance(reference, quantity.np.ndarray): @@ -926,6 +940,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, 0), 4, @@ -938,6 +953,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (0, -1), 6, @@ -950,6 +966,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(0, 1), slice(-1, 0)), np.array([[6]]), @@ -962,6 +979,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, 0), 4, @@ -974,6 +992,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, -1), 3, @@ -994,6 +1013,7 @@ def test_southeast(quantity, view_slice, reference): units="m", origin=(2, 2), extent=(1, 1), + gt4py_backend="debug", ), (slice(-2, 0), slice(-1, 2)), np.array([[6, 7, 8], [11, 12, 13]]), @@ -1012,6 +1032,7 @@ def test_northwest(quantity, view_slice, reference): units=quantity.units, origin=quantity.origin[::-1], extent=quantity.extent[::-1], + gt4py_backend=quantity.metadata.gt4py_backend, ) transposed_result = transposed_quantity.view.northwest[view_slice[::-1]] if isinstance(reference, quantity.np.ndarray): @@ -1030,6 +1051,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, -1), 4, @@ -1042,6 +1064,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (0, 0), 8, @@ -1054,6 +1077,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(0, 1), slice(0, 1)), np.array([[8]]), @@ -1066,6 +1090,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, -1), 4, @@ -1078,6 +1103,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (-1, 0), 5, @@ -1098,6 +1124,7 @@ def test_northwest(quantity, view_slice, reference): units="m", origin=(2, 2), extent=(1, 1), + gt4py_backend="debug", ), (slice(-2, 0), slice(-1, 2)), np.array([[7, 8, 9], [12, 13, 14]]), @@ -1116,6 +1143,7 @@ def test_northeast(quantity, view_slice, reference): units=quantity.units, origin=quantity.origin[::-1], extent=quantity.extent[::-1], + gt4py_backend=quantity.metadata.gt4py_backend, ) transposed_result = transposed_quantity.view.northeast[view_slice[::-1]] if isinstance(reference, quantity.np.ndarray): @@ -1134,6 +1162,7 @@ def test_northeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (0, 0), 4, @@ -1146,6 +1175,7 @@ def test_northeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(0, 0), slice(0, 0)), 4, @@ -1158,6 +1188,7 @@ def test_northeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ), (slice(-1, 1), slice(-1, 1)), np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), @@ -1178,6 +1209,7 @@ def test_northeast(quantity, view_slice, reference): units="m", origin=(2, 2), extent=(1, 1), + gt4py_backend="debug", ), (slice(-2, 0), slice(0, 1)), np.array([[2, 3], [7, 8], [12, 13]]), @@ -1198,6 +1230,7 @@ def test_northeast(quantity, view_slice, reference): units="m", origin=(1, 1), extent=(3, 3), + gt4py_backend="debug", ), (0,), np.array([6, 7, 8]), @@ -1216,6 +1249,7 @@ def test_interior(quantity, view_slice, reference): units=quantity.units, origin=quantity.origin[::-1], extent=quantity.extent[::-1], + gt4py_backend=quantity.metadata.gt4py_backend, ) if len(view_slice) == len(quantity.dims): # skip if not transposed_result = transposed_quantity.view.interior[view_slice[::-1]] diff --git a/tests/test_basic_operations.py b/tests/test_basic_operations.py index 0d707240..249edebd 100644 --- a/tests/test_basic_operations.py +++ b/tests/test_basic_operations.py @@ -128,12 +128,14 @@ def test_copy(): data=np.zeros([20, 20, 79]), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) outfield = Quantity( data=np.ones([20, 20, 79]), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) copy(f_in=infield.data, f_out=outfield.data) @@ -148,18 +150,21 @@ def test_adjustmentfactor(): data=np.full(shape=[20, 20], fill_value=2.0), dims=[X_DIM, Y_DIM], units="m", + gt4py_backend="debug", ) outfield = Quantity( data=np.full(shape=[20, 20, 79], fill_value=2.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) testfield = Quantity( data=np.full(shape=[20, 20, 79], fill_value=4.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) adfact(factor=factorfield.data, f_out=outfield.data) @@ -173,12 +178,14 @@ def test_setvalue(): data=np.zeros(shape=[20, 20, 79]), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) testfield = Quantity( data=np.full(shape=[20, 20, 79], fill_value=2.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) setvalue(f_out=outfield.data, value=2.0) @@ -193,18 +200,21 @@ def test_adjustdivide(): data=np.full(shape=[20, 20, 79], fill_value=2.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) outfield = Quantity( data=np.full(shape=[20, 20, 79], fill_value=2.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) testfield = Quantity( data=np.full(shape=[20, 20, 79], fill_value=1.0), dims=[X_DIM, Y_DIM, Z_DIM], units="m", + gt4py_backend="debug", ) addiv(factor=factorfield.data, f_out=outfield.data) diff --git a/tests/test_caching_comm.py b/tests/test_caching_comm.py index d2d7f64e..4818b3f7 100644 --- a/tests/test_caching_comm.py +++ b/tests/test_caching_comm.py @@ -30,6 +30,7 @@ def test_halo_update_integration(): units="", origin=origin, extent=extent, + gt4py_backend="debug", ) for _ in range(n_ranks) ] diff --git a/tests/test_cube_scatter_gather.py b/tests/test_cube_scatter_gather.py index 236e1eb9..99065c95 100644 --- a/tests/test_cube_scatter_gather.py +++ b/tests/test_cube_scatter_gather.py @@ -169,6 +169,7 @@ def get_quantity(dims, units, extent, n_halo, numpy): units, origin=tuple(origin), extent=tuple(extent), + gt4py_backend="debug", ) diff --git a/tests/test_halo_update.py b/tests/test_halo_update.py index ca76ab8b..eb73df2e 100644 --- a/tests/test_halo_update.py +++ b/tests/test_halo_update.py @@ -324,6 +324,7 @@ def depth_quantity_list( units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) return_list.append(quantity) return return_list @@ -361,6 +362,7 @@ def tile_depth_quantity_list( units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) return_list.append(quantity) return return_list @@ -505,6 +507,7 @@ def zeros_quantity_list(total_ranks, dims, units, origin, extent, shape, numpy, units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) quantity.view[:] = 0.0 return_list.append(quantity) @@ -526,6 +529,7 @@ def zeros_quantity_tile_list( units=units, origin=origin, extent=extent, + gt4py_backend="debug", ) quantity.view[:] = 0.0 return_list.append(quantity) diff --git a/tests/test_halo_update_ranks.py b/tests/test_halo_update_ranks.py index 6ceb4886..42b46c13 100644 --- a/tests/test_halo_update_ranks.py +++ b/tests/test_halo_update_ranks.py @@ -126,6 +126,7 @@ def rank_quantity_list(total_ranks, numpy, dtype): units="m", origin=(1, 1), extent=(1, 1), + gt4py_backend="debug", ) quantity_list.append(quantity) return quantity_list diff --git a/tests/test_netcdf_monitor.py b/tests/test_netcdf_monitor.py index 19614486..24bbe83a 100644 --- a/tests/test_netcdf_monitor.py +++ b/tests/test_netcdf_monitor.py @@ -74,6 +74,7 @@ def test_monitor_store_multi_rank_state( numpy.ones([nz, ny_rank, nx_rank]), dims=dims, units=units, + gt4py_backend="debug", ), } monitor_list[rank].store_constant(state) @@ -87,6 +88,7 @@ def test_monitor_store_multi_rank_state( numpy.ones([nz, ny_rank, nx_rank]), dims=dims, units=units, + gt4py_backend="debug", ), } monitor_list[rank].store(state) @@ -100,6 +102,7 @@ def test_monitor_store_multi_rank_state( numpy.ones([nz, ny_rank, nx_rank]), dims=dims, units=units, + gt4py_backend="debug", ), } monitor_list[rank].store_constant(state) diff --git a/tests/test_partitioner.py b/tests/test_partitioner.py index cc0a105e..8f3087ef 100644 --- a/tests/test_partitioner.py +++ b/tests/test_partitioner.py @@ -993,7 +993,9 @@ def test_subtile_extent_with_tile_dimensions( cubedsphere_expected, ): data_array = np.zeros((tile_extent)) - quantity = Quantity(data_array, array_dims, "dimensionless", [0, 0, 0, 0]) + quantity = Quantity( + data_array, array_dims, "dimensionless", [0, 0, 0, 0], gt4py_backend="debug" + ) tile_partitioner = TilePartitioner(layout, edge_interior_ratio) cubedsphere_partitioner = CubedSpherePartitioner(tile_partitioner) diff --git a/tests/test_sync_shared_boundary.py b/tests/test_sync_shared_boundary.py index 7db5a621..3e0d6707 100644 --- a/tests/test_sync_shared_boundary.py +++ b/tests/test_sync_shared_boundary.py @@ -81,6 +81,7 @@ def rank_quantity_list(total_ranks, numpy, dtype, units=units): units=units, origin=(0, 0), extent=(3, 2), + gt4py_backend="debug", ) y_data = numpy.empty((2, 3), dtype=dtype) y_data[:] = rank @@ -90,6 +91,7 @@ def rank_quantity_list(total_ranks, numpy, dtype, units=units): units=units, origin=(0, 0), extent=(2, 3), + gt4py_backend="debug", ) quantity_list.append((x_quantity, y_quantity)) return quantity_list @@ -147,6 +149,7 @@ def counting_quantity_list(total_ranks, numpy, dtype, units=units): units=units, origin=(0, 0), extent=(3, 2), + gt4py_backend="debug", ) y_data = 6 * total_ranks + numpy.array([[0, 1, 2], [3, 4, 5]]) + 6 * rank y_quantity = Quantity( @@ -155,6 +158,7 @@ def counting_quantity_list(total_ranks, numpy, dtype, units=units): units=units, origin=(0, 0), extent=(2, 3), + gt4py_backend="debug", ) quantity_list.append((x_quantity, y_quantity)) return quantity_list diff --git a/tests/test_tile_scatter.py b/tests/test_tile_scatter.py index d768bb15..0222a644 100644 --- a/tests/test_tile_scatter.py +++ b/tests/test_tile_scatter.py @@ -36,11 +36,13 @@ def test_interface_state_two_by_two_per_rank_scatter_tile(layout, numpy): numpy.empty([layout[0] + 1, layout[1] + 1]), dims=[Y_INTERFACE_DIM, X_INTERFACE_DIM], units="dimensionless", + gt4py_backend="debug", ), "pos_i": Quantity( numpy.empty([layout[0] + 1, layout[1] + 1], dtype=numpy.int32), dims=[Y_INTERFACE_DIM, X_INTERFACE_DIM], units="dimensionless", + gt4py_backend="debug", ), } @@ -80,16 +82,19 @@ def test_centered_state_one_item_per_rank_scatter_tile(layout, numpy): numpy.empty([layout[0], layout[1]]), dims=[Y_DIM, X_DIM], units="dimensionless", + gt4py_backend="debug", ), "rank_pos_j": Quantity( numpy.empty([layout[0], layout[1]]), dims=[Y_DIM, X_DIM], units="dimensionless", + gt4py_backend="debug", ), "rank_pos_i": Quantity( numpy.empty([layout[0], layout[1]]), dims=[Y_DIM, X_DIM], units="dimensionless", + gt4py_backend="debug", ), } @@ -137,6 +142,7 @@ def test_centered_state_one_item_per_rank_with_halo_scatter_tile(layout, n_halo, units="dimensionless", origin=(n_halo, n_halo), extent=extent, + gt4py_backend="debug", ), "rank_pos_j": Quantity( numpy.empty([layout[0] + 2 * n_halo, layout[1] + 2 * n_halo]), @@ -144,6 +150,7 @@ def test_centered_state_one_item_per_rank_with_halo_scatter_tile(layout, n_halo, units="dimensionless", origin=(n_halo, n_halo), extent=extent, + gt4py_backend="debug", ), "rank_pos_i": Quantity( numpy.empty([layout[0] + 2 * n_halo, layout[1] + 2 * n_halo]), @@ -151,6 +158,7 @@ def test_centered_state_one_item_per_rank_with_halo_scatter_tile(layout, n_halo, units="dimensionless", origin=(n_halo, n_halo), extent=extent, + gt4py_backend="debug", ), } diff --git a/tests/test_tile_scatter_gather.py b/tests/test_tile_scatter_gather.py index 60ef583a..548fdb7d 100644 --- a/tests/test_tile_scatter_gather.py +++ b/tests/test_tile_scatter_gather.py @@ -150,6 +150,7 @@ def get_quantity(dims, units, extent, n_halo, numpy): units, origin=tuple(origin), extent=tuple(extent), + gt4py_backend="debug", )