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

Refactor advection stencils to use StencilTest #336

Merged
merged 27 commits into from
Jan 17, 2024

Conversation

samkellerhals
Copy link
Contributor

@samkellerhals samkellerhals commented Dec 13, 2023

Refactor advection stencils to use StencilTest class.

@samkellerhals
Copy link
Contributor Author

cscs-ci run

@samkellerhals
Copy link
Contributor Author

cscs-ci run

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

1 similar comment
@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

1 similar comment
@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run benchmark

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals samkellerhals requested review from ninaburg and removed request for ninaburg January 11, 2024 15:22
@ninaburg
Copy link
Contributor

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

launch jenkins spack

@samkellerhals
Copy link
Contributor Author

launch jenkins icon

@samkellerhals
Copy link
Contributor Author

launch jenkins spack

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

launch jenkins spack

@samkellerhals
Copy link
Contributor Author

launch jenkins icon

Copy link
Contributor

@ninaburg ninaburg left a comment

Choose a reason for hiding this comment

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

It looks good to me, I have added a few comments and questions, otherwise it must be good!

@@ -30,7 +30,7 @@ def _btraj_dreg_stencil_01(
return lvn_sys_pos


@program
@program(grid_type="unstructured")
Copy link
Contributor

Choose a reason for hiding this comment

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

All dycore stencils are written like this: grid_type=GridType.UNSTRUCTURED I imagine the two are equivalent but perhaps it would be better to be uniform with the dycore. This is a detail so I leave it up to you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Those statements should have been added in all stencils, correct? Most of the hflx_limiter_mo/pd_stencil, hor_adv_stencil_01, rbf_intp_edge_stencil_01 don't have them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if it is best practice to do this for all stencil programs. I just applied this to the stencils which failed to execute otherwise. Asking @tehrengruber what he thinks.

PROGRAM = face_val_ppm_stencil_01
OUTPUTS = (
Output(
"z_slope", refslice=(slice(None), slice(None, -1)), gtslice=(slice(None), slice(1, -1))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is useful thanks. If I understood correctly gtslice is the slicing of the GridTools output and in parenthesis are the dimensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes so refslice is the slice for the reference output, and gtslice is the slice for the gt4py output field. By default both are None which means the whole field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can also still use the normal syntax: OUTPUTS = ("a", "b") but then the fields are not sliced.

z_slope.asnumpy(),
)
# Concatenate the NaN column to the existing array
nan_column = np.full((p_face.shape[0], 2), np.nan)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using the output option and slice the two last columns of the GridTools output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that makes sense, thanks for the suggestion.

Copy link

Mandatory Tests

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

  • cscs-ci run default
  • launch jenkins spack

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark

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.

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals
Copy link
Contributor Author

launch jenkins spack

@samkellerhals
Copy link
Contributor Author

cscs-ci run default

@samkellerhals samkellerhals merged commit b08820a into main Jan 17, 2024
5 checks passed
@samkellerhals samkellerhals deleted the refactor-advection-stencils branch January 17, 2024 13:37
OngChia pushed a commit that referenced this pull request Jan 14, 2025
Refactor half of all advection stencil to use StencilTest class, and make outputs sliceable.

---------

Co-authored-by: Nina Burgdorfer <Nina.Burgdorfer@meteoswiss.ch>
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.

2 participants