Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

next: missing check for capturing fields in programs/field_operators #1621

Open
nfarabullini opened this issue Aug 28, 2024 · 1 comment
Open
Labels
gt4py.next Issues concerning the new version with support for non-cartesian grids. module: frontend Frontend subpackage triage: bug Something isn't working

Comments

@nfarabullini
Copy link
Contributor

fields within decorator functions have to be declared as inputs, i.e. these cases are not allowed:

        field = gtx.as_field([cases.IDim], np.ones((10,), dtype=gtx.int32))

        @gtx.field_operator(backend=cartesian_case.executor)
        def field_op():
            return new_field
       @gtx.field_operator(backend=cartesian_case.executor)
       def field_op():
           return module_import.new_field
@havogt
Copy link
Contributor

havogt commented Aug 28, 2024

They user-facing error should be something like "Capturing new_field of type FieldType is not allowed. It needs to be passed explicitly to the GT4Py program."
The errors for other things like non-const scalars should be similar (exception is FrozenNamespace and possibly in the future scalars that are marked final).

@havogt havogt added triage: bug Something isn't working module: frontend Frontend subpackage gt4py.next Issues concerning the new version with support for non-cartesian grids. labels Aug 28, 2024
@havogt havogt changed the title next: missing check for fields declaration as inputs next: missing check for capturing fields in programs/field_operators Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gt4py.next Issues concerning the new version with support for non-cartesian grids. module: frontend Frontend subpackage triage: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants