Skip to content

Commit

Permalink
more renames
Browse files Browse the repository at this point in the history
  • Loading branch information
havogt committed Jan 26, 2024
1 parent c907349 commit 8238e8d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def testee(a: IField, b: IField, c: IField) -> IField:
pos_args = [args[name] for name in arg_names]
kw_args = {name: args[name] for name in kwarg_names}

testee.with_backend(cartesian_case.backend)(
testee.with_backend(cartesian_case.executor)(
*pos_args, **kw_args, out=out, offset_provider=cartesian_case.offset_provider
)

Expand All @@ -85,7 +85,7 @@ def testee(a: IField, b: IField, out: IField):
pos_args = [args[name] for name in arg_names]
kw_args = {name: args[name] for name in kwarg_names}

testee.with_backend(cartesian_case.backend)(
testee.with_backend(cartesian_case.executor)(
*pos_args, **kw_args, offset_provider=cartesian_case.offset_provider
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def fieldop_args(a: cases.IField, condition: bool, scalar: int32) -> cases.IFiel
scalar = 0 if not condition else scalar
return a + scalar

@gtx.program(backend=cartesian_case.backend)
@gtx.program(backend=cartesian_case.executor)
def program_args(a: cases.IField, condition: bool, scalar: int32, out: cases.IField):
fieldop_args(a, condition, scalar, out=out)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def simple_scan_operator(carry: float) -> float:
@pytest.mark.uses_lift_expressions
@pytest.mark.uses_scan_nested
def test_solve_triag(cartesian_case):
if cartesian_case.backend == gtfn.run_gtfn_with_temporaries:
if cartesian_case.executor == gtfn.run_gtfn_with_temporaries:
pytest.xfail("Temporary extraction does not work correctly in combination with scans.")

@gtx.scan_operator(axis=KDim, forward=True, init=(0.0, 0.0))
Expand Down Expand Up @@ -716,7 +716,7 @@ def testee(a: cases.EField, b: cases.EField) -> cases.VField:

@pytest.mark.uses_scan
def test_ternary_scan(cartesian_case):
if cartesian_case.backend in [gtfn.run_gtfn_with_temporaries]:
if cartesian_case.executor in [gtfn.run_gtfn_with_temporaries]:
pytest.xfail("Temporary extraction does not work correctly in combination with scans.")

@gtx.scan_operator(axis=KDim, forward=True, init=0.0)
Expand All @@ -741,7 +741,7 @@ def simple_scan_operator(carry: float, a: float) -> float:
@pytest.mark.uses_scan_without_field_args
@pytest.mark.uses_tuple_returns
def test_scan_nested_tuple_output(forward, cartesian_case):
if cartesian_case.backend in [gtfn.run_gtfn_with_temporaries]:
if cartesian_case.executor in [gtfn.run_gtfn_with_temporaries]:
pytest.xfail("Temporary extraction does not work correctly in combination with scans.")

init = (1, (2, 3))
Expand Down Expand Up @@ -959,7 +959,7 @@ def test_domain_input_bounds_1(cartesian_case):
def fieldop_domain(a: cases.IJField) -> cases.IJField:
return a + a

@gtx.program(backend=cartesian_case.backend)
@gtx.program(backend=cartesian_case.executor)
def program_domain(
a: cases.IJField,
out: cases.IJField,
Expand Down Expand Up @@ -1060,7 +1060,7 @@ def prog(inp: cases.IKField, k_index: gtx.Field[[KDim], gtx.IndexType], out: cas
def test_undefined_symbols(cartesian_case):
with pytest.raises(errors.DSLError, match="Undeclared symbol"):

@gtx.field_operator(backend=cartesian_case.backend)
@gtx.field_operator(backend=cartesian_case.executor)
def return_undefined():
return undefined_symbol

Expand Down Expand Up @@ -1160,7 +1160,7 @@ def test_tuple_unpacking_too_many_values(cartesian_case):
match=(r"Too many values to unpack \(expected 3\)."),
):

@gtx.field_operator(backend=cartesian_case.backend)
@gtx.field_operator(backend=cartesian_case.executor)
def _star_unpack() -> tuple[int32, float64, int32]:
a, b, c = (1, 2.0, 3, 4, 5, 6, 7.0)
return a, b, c
Expand All @@ -1171,7 +1171,7 @@ def test_tuple_unpacking_too_few_values(cartesian_case):
errors.DSLError, match=(r"Assignment value must be of type tuple, got 'int32'.")
):

@gtx.field_operator(backend=cartesian_case.backend)
@gtx.field_operator(backend=cartesian_case.executor)
def _invalid_unpack() -> tuple[int32, float64, int32]:
a, b, c = 1
return a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def make_builtin_field_operator(builtin_name: str, backend: Optional[ppi.Program

@pytest.mark.parametrize("builtin_name, inputs", math_builtin_test_data())
def test_math_function_builtins_execution(cartesian_case, builtin_name: str, inputs):
if cartesian_case.backend is None:
if cartesian_case.executor is None:
# TODO(havogt) find a way that works for embedded
pytest.xfail("Test does not have a field view program.")
if builtin_name == "gamma":
Expand All @@ -131,7 +131,7 @@ def test_math_function_builtins_execution(cartesian_case, builtin_name: str, inp
expected = ref_impl(*inputs)
out = cartesian_case.as_field([IDim], np.zeros_like(expected))

builtin_field_op = make_builtin_field_operator(builtin_name, cartesian_case.backend)
builtin_field_op = make_builtin_field_operator(builtin_name, cartesian_case.executor)

builtin_field_op(*inps, out=out, offset_provider={})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


def test_identity_fo_execution(cartesian_case, identity_def):
identity = gtx.field_operator(identity_def, backend=cartesian_case.backend)
identity = gtx.field_operator(identity_def, backend=cartesian_case.executor)

in_field = cases.allocate(cartesian_case, identity, "in_field").strategy(
cases.ConstInitializer(1)
Expand Down Expand Up @@ -88,21 +88,21 @@ def shift_by_one_program(in_field: cases.IFloatField, out_field: cases.IFloatFie


def test_copy_execution(cartesian_case, copy_program_def):
copy_program = gtx.program(copy_program_def, backend=cartesian_case.backend)
copy_program = gtx.program(copy_program_def, backend=cartesian_case.executor)

cases.verify_with_default_data(cartesian_case, copy_program, ref=lambda in_field: in_field)


def test_double_copy_execution(cartesian_case, double_copy_program_def):
double_copy_program = gtx.program(double_copy_program_def, backend=cartesian_case.backend)
double_copy_program = gtx.program(double_copy_program_def, backend=cartesian_case.executor)

cases.verify_with_default_data(
cartesian_case, double_copy_program, ref=lambda in_field, intermediate_field: in_field
)


def test_copy_restricted_execution(cartesian_case, copy_restrict_program_def):
copy_restrict_program = gtx.program(copy_restrict_program_def, backend=cartesian_case.backend)
copy_restrict_program = gtx.program(copy_restrict_program_def, backend=cartesian_case.executor)

cases.verify_with_default_data(
cartesian_case,
Expand Down Expand Up @@ -224,7 +224,7 @@ def prog(


def test_wrong_argument_type(cartesian_case, copy_program_def):
copy_program = gtx.program(copy_program_def, backend=cartesian_case.backend)
copy_program = gtx.program(copy_program_def, backend=cartesian_case.executor)

inp = cartesian_case.as_field([JDim], np.ones((cartesian_case.default_sizes[JDim],)))
out = cases.allocate(cartesian_case, copy_program, "out").strategy(cases.ConstInitializer(1))()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def copy_program(a: IField, b: IField) -> IField:
def test_missing_arg_field_operator(cartesian_case): # noqa: F811 # fixtures
"""Test that calling a field_operator without required args raises an error."""

@gtx.field_operator(backend=cartesian_case.backend)
@gtx.field_operator(backend=cartesian_case.executor)
def copy(a: IField) -> IField:
return a

Expand All @@ -97,7 +97,7 @@ def copy(a: IField) -> IField:
def test_missing_arg_scan_operator(cartesian_case): # noqa: F811 # fixtures
"""Test that calling a scan_operator without required args raises an error."""

@gtx.scan_operator(backend=cartesian_case.backend, axis=KDim, init=0.0, forward=True)
@gtx.scan_operator(backend=cartesian_case.executor, axis=KDim, init=0.0, forward=True)
def sum(state: float, a: float) -> float:
return state + a

Expand All @@ -122,15 +122,15 @@ def copy(a: IField) -> IField:

with pytest.raises(errors.DSLError, match="Invalid call"):

@gtx.program(backend=cartesian_case.backend)
@gtx.program(backend=cartesian_case.executor)
def copy_program(a: IField, b: IField) -> IField:
copy(a)

_ = copy_program(a, offset_provider={})

with pytest.raises(TypeError, match="'offset_provider'"):

@gtx.program(backend=cartesian_case.backend)
@gtx.program(backend=cartesian_case.executor)
def copy_program(a: IField, b: IField) -> IField:
copy(a, out=b)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ def test_solve_nonhydro_stencil_52_like_z_q(test_setup):
@pytest.mark.uses_tuple_returns
def test_solve_nonhydro_stencil_52_like_z_q_tup(test_setup):
if (
test_setup.case.backend
test_setup.case.executor
== test_definitions.ProgramBackendId.GTFN_CPU_WITH_TEMPORARIES.load().executor
):
pytest.xfail(
"Needs implementation of scan projector. Breaks in type inference as executed"
"again after CollapseTuple."
)
if test_setup.case.backend == test_definitions.ProgramBackendId.ROUNDTRIP.load().executor:
if test_setup.case.executor == test_definitions.ProgramBackendId.ROUNDTRIP.load().executor:
pytest.xfail("Needs proper handling of tuple[Column] <-> Column[tuple].")

cases.verify(
Expand All @@ -275,7 +275,7 @@ def test_solve_nonhydro_stencil_52_like_z_q_tup(test_setup):
@pytest.mark.uses_tuple_returns
def test_solve_nonhydro_stencil_52_like(test_setup):
if (
test_setup.case.backend
test_setup.case.executor
== test_definitions.ProgramBackendId.GTFN_CPU_WITH_TEMPORARIES.load().executor
):
pytest.xfail("Temporary extraction does not work correctly in combination with scans.")
Expand All @@ -297,11 +297,11 @@ def test_solve_nonhydro_stencil_52_like(test_setup):
@pytest.mark.uses_tuple_returns
def test_solve_nonhydro_stencil_52_like_with_gtfn_tuple_merge(test_setup):
if (
test_setup.case.backend
test_setup.case.executor
== test_definitions.ProgramBackendId.GTFN_CPU_WITH_TEMPORARIES.load().executor
):
pytest.xfail("Temporary extraction does not work correctly in combination with scans.")
if test_setup.case.backend == test_definitions.ProgramBackendId.ROUNDTRIP.load().executor:
if test_setup.case.executor == test_definitions.ProgramBackendId.ROUNDTRIP.load().executor:
pytest.xfail("Needs proper handling of tuple[Column] <-> Column[tuple].")

cases.run(
Expand Down

0 comments on commit 8238e8d

Please sign in to comment.