-
Notifications
You must be signed in to change notification settings - Fork 435
EAMxx: Give option for for tracers to be advected only by dynamics #6789
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
EAMxx: Give option for for tracers to be advected only by dynamics #6789
Conversation
@tcclevenger Just to clarify: you said you're still working on ordering of tracers for PG2 and DYN grids, so is this PR not yet ready? |
Yes. Do we have a WIP equiv over here so I don't let the AT run while I work on getting a fix in? |
No we don't. But as soon as you push commits, you can click on the checks tab, and cancel all the jobs (one workflow at a time, unfortunately), if you know you're not done anyways... Edit: But we could modify our workflows jobs so that, for pull_request events, they only run if the PR is not in draft mode... |
What if you change it to draft PR ? |
I saw your reply just as I was editing my answer... Unfortunately, gh actions pull_request event still triggers, even if the PR is in draft mode (a debatable design choice, imho). The only way to skip them is to do something like jobs:
my-job:
if: ${{ github.event_name != "pull_request" || github.event.pull_request.draft == "false" }}
... |
@tcclevenger i removed the reviewer request. When you're ready, add them back, so gh pings me. If you'd rather us review right now, even before you fix the PG2-DYN issue, feel free to re-add me/us (I know balwinder is out for a month though). |
@tcclevenger what is the status? |
Still working on a fix for mismatch tracer indices between PG2 and GLL grid |
components/eamxx/src/physics/mam/eamxx_mam_aci_process_interface.hpp
Outdated
Show resolved
Hide resolved
@tcclevenger any progress on fix? |
Yes, this is what I'm currently working on. Will update as I go. |
@tcclevenger please try to make this old PR a priority. |
@rljacob is it OK if we switch this to draft? |
Sure thats fine. |
@tcclevenger would you switch this to Draft if it's not ready? We'll try out that workflow. |
This is what I am currently working on, but the work is in a different branch (it contains a fundamental change to allocating groups of fields that doesn't make sense to throw onto this branch). Yes, I agree draft makes more sense for this PR. |
785340d
to
8d5f18b
Compare
I'm guessing the error is this one?
I have never seen it. I suppose we had too many concurrent PRs that needed to be tested, and all the gh-hosted runners tried to access the container registry at the same time? Should be safe to re-run the failed tests manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great from the MAM4xx side! Thanks, Conrad for adding this very important feature!
cb70a4c
to
4269e18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve as long as the "[non-BFB for MAMxx]" status remains true (I think it is, but just want to be sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there wasn't much to do in FieldManager? That's nice. With this branch, did you try to print the tracer group content, and verify that the non-turb-advected tracers are all at the end?
I have some thoughts on the design. Not really requests, just discussions sparks.
if (not ekat::contains(req.groups, "tracers")) return; | ||
|
||
std::string fname = req.fid.name(); | ||
if (tracer_requests.find(fname) == tracer_requests.end()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check is pointless. The else branch should work regardless, no?
|
||
// Go through the map entry for each tracer and check that every one | ||
// has the same request for turbulence advection. | ||
for (auto fr : tracer_requests) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say MAM requests field A, specifying that it should not be turb advected. Another process uses field A, so it requests it, but it has no knowledge of what turb advection is, or at least it doesn't care (the choice may be relevant for MAM, but the rest of the atm doesn't care). In this case, wouldn't the two request conflict?
Maybe we should turn this into an enum, like
enum TracerAdvection {
DynOnly,
DynAndTurb,
Default,
};
(the names are up for debate, ofc). In this case, the default would be Default
. If all procs use "default", we do both dyn and turb advection, as before. If all procs use "default", but some ask for "DynOnly", we do dyn only. The error only arises if some procs expicitly ask for "DynOnly" and others explicitly ask for "DynAndTurb".
Maybe I'm over thinking it, but there is no way, with a bool, to check if some values for turb_advected_tracers are true b/c the customer asked for true, or simply b/c they didn't care, and relied on the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enum may make things complicated, in which case we may also consider whether this check is needed. That is, as long as there is ONE request that says "don't do turb advection", then we don't add it to the turb advected tracers.
Maybe I need to better understand the case we are trying to guard ourselves from...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH, using enums in the add_tracer
calls make the code more self-explanatory...so maybe switching to an enum is a bit clearer?
add_tracer<Required>("blah",units, grid,1,false);
vs
add_tracer<Required>("blah",units, grid,1,NoTurbAdvection);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be leaning towards getting rid of this check. I think (but will verify) that the changes that evolved in the FM since I wrote this check actually make it a bit redundant? It should error out with inconsistent requests, we just may not get the output about which processes conflict.
With regards to the enums, I may be having a change of heart. I've always avoided in the case where a bool was all that's needed, but these signatures definitely are less clear and add_tracer
and add_group
are certainly part of the code that users will interface with if they write a process. Will change them back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: I often though "why adding a new type when a bool flag does it?". But code clarity with enums is on a whole other level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up: We need this check given how group requests do group logic, namely, if a single processes says "I want A in group G" then A gets added to G, even if some processes intentionally did not add A to G.
I think this option is more of "I want to explicitly state that A should not be in group G" and then these checks ensure no one added it.
components/eamxx/src/physics/shoc/eamxx_shoc_process_interface.cpp
Outdated
Show resolved
Hide resolved
b690428
to
5a4eb82
Compare
- AtmosphereProcess::add_tracer() now takes in bool turbulence_advected which dictates if shoc advects tracer or ignores - SHOC requests group "turbulence_advected_tracers", not full "tracers" array - FieldRequest includes a "calling_process" var for error output
This reverts commit 6237c87. Adds back the enum for bundling
5a4eb82
to
f957603
Compare
Yes, for PG2, I verified GLL<->PG2 indices matched, and that non-turb-advected tracers came last. |
|
||
add_tracer<Updated >("qv", m_phys_grid, kg/kg, N); | ||
add_group<Updated>("tracers",pgn,N, true); | ||
add_group<Updated>("tracers",pgn,N, Bundling::Required); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're bringing the enum back, I may as well ask: do you think the name Bundling
is clear? Maybe we could change it into something else. Some ideas:
enum class GroupAllocation {
Contiguous,
NotContiguous
};
enum class MonolithicGroup {
Required,
NotRequired
};
enum class ContiguousGroup {
Requred,
NotRequired
};
I don't know. I wonder if the word "bundle" is a bit obscure, and we can find something more self-explanatory? If you have other name ideas, feel free to bounce them off us. This is the right time to discuss this, before we roll it out again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user potentially needs to know what group.m_bundle
is, maybe we would need to think about changing that name too?
I like Monolithic the best. To me non-contiguous implies that "I can access the entire group, it just won't be contiguous" where the only way to access a view of the entire group is bundled case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if we decide on a name change, we should change it everywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we used
enum class MonolithicAlloc {
Required,
NotRequired
};
? I agree that the word "monolithic" carries a clear meaning. But I also like to have the word "allocation" (or something reminescent of it) somwhere.
What would you then call the bundle? group.m_monolithic
? group.m_monolithic_field
? group.m_whole
? Something else? I like m_monolithic_field
, and maybe rename m_fields
into m_individual_fields
?
Feel free to propose others...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also merge as is, and follow up with a better name convention right after...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like m_monolithic_field
and m_individual_fields
. I think this is much clearer than "bundling". I've updated all the comments that refer to bundling as well.
Confirmed #6981 did not introduce non-BFB fails on PM-GPU, so we can merge this once we settle on a "bundling" name |
- Bundling enum -> MonolithicAlloc - m_bundle field -> m_monolithic_field - m_fields (in field group) -> m_individual_fields - All comments updated
I decided to update bundling name instead of merging since I'm off work tomorrow and so don't want to merge tonight. Assuming there are no fails/change requests with the naming, I'll merge first thing next week (Sunday night, even, if I remember...). @singhbalwinder Thanks for your patience with this PR! Ended up taking much more time than anticipated.. |
No worries at all—I completely understand that these things can take much longer than expected. I appreciate the time and effort you’ve put into this. Merging next week is fine. |
Is this ready? |
Yes, going to merge today. |
Hang on. I think we want to do the Kokkos branch today. |
Kokkos branch delayed so go ahead. |
… into next (PR #6789) Processes can choose for a tracer to be advected only by dynamics (not by SHOC) by passing turbulence_advected=false to add_tracer(). Guards set up to ensure all tracers requests are consistent among processes. [non-BFB for MAMxx]
Processes can choose for a tracer to be advected only by dynamics (not by SHOC) by passing
turbulence_advected=false
toadd_tracer()
. Guards set up to ensure all tracers requests are consistent among processes.Moved over from E3SM-Project/scream#3085. Currently working on issue of tracer ordering between PG2 and GLL grids.
[non-BFB for MAMxx]