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

bug[next]: respect DEFAULT_BACKEND and no_backend mechanism #1380

Merged
merged 138 commits into from
Jan 4, 2024

Conversation

havogt
Copy link
Contributor

@havogt havogt commented Nov 30, 2023

fixes #1376.

Thanks @DropD for the testcase.

Needs to be merged after #1365, replaces #1364.

@havogt havogt requested a review from DropD December 14, 2023 15:14
@havogt havogt requested review from tehrengruber and removed request for DropD December 18, 2023 08:15
src/gt4py/next/embedded/operators.py Outdated Show resolved Hide resolved
@@ -495,7 +495,7 @@ def program(*, backend: Optional[ppi.ProgramExecutor]) -> Callable[[types.Functi
def program(
definition=None,
*,
backend=None,
backend=eve.NOTHING,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document this mechanism and why this is needed. For readability it might also help to not use eve.Nothing, but something explicit, e.g. introduce

class UseDefaultBackendMarker:
  pass

and then

Suggested change
backend=eve.NOTHING,
backend=UseDefaultBackendMarker,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a concrete comment that you like to have? The docstring of eve.NOTHING explains it already. Should I mention that None means no backend?

Copy link
Contributor

@tehrengruber tehrengruber Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this:

# If unspecified `DEFAULT_BACKEND`, by default being embedded execution, is used. We use 
# `eve.NOTHING` here instead of `None` since `None` is already used to specify embedded execution.
# As a result we are still able to temporarily switch to a different default backend (e.g. in the 
# tests to disable execution without explicit backend selection).

Could also be description of the backend keyword argument in the docstring.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just reading this line again yesterday and scratched my head on why exactly we had to use this mechanism and since I was already told I thought a comment would make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add the extended comment in a next PR

@havogt havogt requested a review from tehrengruber January 4, 2024 08:14
@havogt havogt merged commit 27bf18f into GridTools:main Jan 4, 2024
19 checks passed
havogt added a commit that referenced this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

next: regressions introduced with embedded field view
5 participants