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

Fixes for new gt4py default backend #318

Merged
merged 17 commits into from
Nov 24, 2023
Merged

Fixes for new gt4py default backend #318

merged 17 commits into from
Nov 24, 2023

Conversation

ninaburg
Copy link
Contributor

@ninaburg ninaburg commented Nov 21, 2023

This PR fixes the multiple tests failing after recent commits in gt4py:

  1. The backend is set explicitly for the advection and one diffusion tests to the previous default (roundtrip) one.
  2. Several built-in functions were replaced:
    2.1 np.asarray(<field>) are replaced by <field>.asnumpy()
    2.2 as_1D_sparse_field() are replaced by numpy_to_1D_sparse_field()
    2.3 StridedNeighborOffsetProvider() are replaced by grid.get_offset_provider()
    2.4 np_as_located_field() are replaced by as_field(.., data=...)

@ninaburg
Copy link
Contributor Author

cscs-ci run

@ninaburg
Copy link
Contributor Author

launch jenkins spack

@edopao
Copy link
Contributor

edopao commented Nov 22, 2023

This change will make it difficult to test and integrate different backends (for example the dace backend, which I am working on a daily basis). A better solution, in my opinion, is to checkout the last working commit from gt4py, by setting explicitly the SHA1 of the commit (or a git tag) in base-requirements.txt

@havogt Do we expect the embedded backend to be working again anytime soon?

Another solution is to change the default backend for all tests (currently embedded) in pytest_config.py

@halungge
Copy link
Contributor

halungge commented Nov 22, 2023

This change will make it difficult to test and integrate different backends (for example the dace backend, which I am working on a daily basis). A better solution, in my opinion, is to checkout the last working commit from gt4py, by setting explicitly the SHA1 of the commit (or a git tag) in base-requirements.txt

@havogt Do we expect the embedded backend to be working again anytime soon?

Another solution is to change the default backend for all tests (currently embedded) in pytest_config.py

The backend in the pytest_config.py is called embedded, but it actually is the roundtrip. So nothing has changed there. It is picked up for the StencilTest but not for the traditional numpy test format, that we still use in the advection package, changing all of them turned out to be a very big task... But you are right it would be a better solution to reuse the fixture in the advection tests instead of importing the backend directly in all of them.

Otherwise fixing the to gt4py hash might be the best option for a quick solution.

@ninaburg
Copy link
Contributor Author

ninaburg commented Nov 22, 2023

Ok I'll submit the change of the gt4py hash to 67a618856331a97530560b1607a7d11c3c3ef802. Thanks for the input.

Update: the problem of the spack tests would still remain because spack retrieves its own gt4py version in its environment file. Thus this still won't unlock icon4py main. Moreover the cluster used for the testing is also included in the maintenance day and no test run.

@ninaburg
Copy link
Contributor Author

cscs-ci run

@ninaburg ninaburg changed the title Fix: Explicit Rountrip backend in advection tests Fix: Explicit backend in advection tests Nov 22, 2023
@ninaburg
Copy link
Contributor Author

launch jenkins spack

 - switch to as_field from deprecates np_as_located_field
 - use asnumpy() instead of np.asarray()
 - use asnumpy() to convert to numpy array
@halungge
Copy link
Contributor

cscs-ci run

@halungge
Copy link
Contributor

cscs-ci run

@halungge
Copy link
Contributor

cscs-ci run

@halungge
Copy link
Contributor

launch jenkins spack

@ninaburg ninaburg changed the title Fix: Explicit backend in advection tests Fixes for new gt4py default backend Nov 23, 2023
@ninaburg
Copy link
Contributor Author

cscs-ci run

@ninaburg
Copy link
Contributor Author

launch jenkins spack

 preliminary ignore of failing predictor and single step test.
@halungge
Copy link
Contributor

cscs-ci run

@halungge halungge marked this pull request as ready for review November 23, 2023 13:17
@halungge
Copy link
Contributor

launch jenkins spack

Copy link

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run
  • launch jenkins spack

Optional Tests

In case your change might affect downstream icon-exclaim, please consider running

  • launch jenkins icon

For more detailed information please look at CI in the EXCLAIM universe.

@ninaburg
Copy link
Contributor Author

cscs-ci run

@ninaburg
Copy link
Contributor Author

launch jenkins spack

@halungge halungge requested a review from abishekg7 November 24, 2023 07:43
Copy link
Contributor

@samkellerhals samkellerhals left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Although all these .asnumpy calls are a bit ugly.. Will we also use the StencilTest infrastructure here at some point? In that way we could hide the asnumpy calls in the future.

@ninaburg ninaburg merged commit 3d06c91 into main Nov 24, 2023
4 of 5 checks passed
@halungge halungge deleted the fix_tests_advection branch December 12, 2024 07:00
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.

5 participants