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

Implement alternating control of Fortran P3 codes for eam and scream #5496

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

wlin7
Copy link
Contributor

@wlin7 wlin7 commented Mar 3, 2023

The alternating switch, determined by the case configuration option (a scream case or else), serves to control which version of Fortran P3 codes being used to build the model. A test is needed to track scream configuration. The version for the EAM version is currently just a skelton, which will be replaced by the eventual P3 PR from v3atm

[BFB] Two new tests SMS_Ln9_P24x1.ne4_ne4.FDPSCREAM-ARM97
and SMS_Ld1.ne30pg2_ne30pg2.F2010-SCREAM-LR-DYAMOND2

The alternating switch, determined by the case configuration option
(a scream case or else), serves to control which version of Fortran P3
codes being used to build the model. A test is needed to track
scream configuration. The version for the EAM version is currently just
a skelton, which will be replaced by the eventual P3 PR from v3atm

[BFB] A new test added.
@wlin7
Copy link
Contributor Author

wlin7 commented Mar 3, 2023

The following tests verified BFB between master and this branch, with one using mg2 (but p3 codes built in) and the other with scream p3.

  • SMS_Ld1.ne30pg2_EC30to60E2r2.F2010.cori-knl_intel
  • SMS_Ld1.ne30pg2_ne30pg2.F2010-SCREAM-LR-DYAMOND2.cori-knl_intel

When reviewing, please ignore files in eam/src/physics/p3/eam. Files there are merely skeltons extracted from the actual p3_PR, and will be replaced entirely when the p3_PR is merged.

Copy link
Member

@rljacob rljacob left a comment

Choose a reason for hiding this comment

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

looks good!

@rljacob rljacob removed the request for review from brhillman March 6, 2023 19:23
Copy link
Contributor

@crterai crterai left a comment

Choose a reason for hiding this comment

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

Thanks for creating this, @wlin7. It looks good to me, especially given that your tests with SCREAM compset and non-P3 compsets come back BFB with master before merging.

@@ -210,6 +210,7 @@
"SMS_D_Ld1.T62_oEC60to30v3.DTESTM",
"SMS_D_Ld3.T62_oQU120.CMPASO-IAF",
"SMS_D_Ld1.ne30pg2_r05_EC30to60E2r2.WCYCL1850",
"SMS_Ln5.ne30pg2_ne30pg2.F2010-SCREAM-LR-DYAMOND2",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to see a DP test as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DP test added to the developer test suite.

Copy link
Member

Choose a reason for hiding this comment

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

DP = "doubly-periodic" ? Hard to tell from the name that its that kind of domain.

@@ -1752,6 +1752,12 @@ if (defined $opts{'cppdefs'}) {
}
$cfg_ref->set('cppdefs', $usr_cppdefs);

# define is_scream_config flag to select which P3 version codes to use
my $is_scream_config = 0;
if ($usr_cppdefs =~ /\-DSCREAM/) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sanity check question for @jgfouca or @bartgol or someone in the know - does -DSCREAM in cppdefs mean that the simulation is either a SCREAM F90 or a SCREAM C++ run, or does it just imply one of these 2 options?

Copy link
Contributor

@bartgol bartgol Mar 6, 2023

Choose a reason for hiding this comment

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

Good catch!

IIRC, that's used only by Homme. But I think we never tested it for SCREAMv0, so I am not sure what it would produce there. Grepping in Homme folder, all but a few of the matches are of the form

#if !defined(CAM) && !defined(SCREAM)

or its opposite without the !'s, which are good (we do what EAM would do). There are however a few cases where CAM and SCREAM would be treated differently:

  • adjust_ps is false for SCREAM, and true otherwise
  • for theta-l_kokkos target, if SCREAM is defined, forcing is not pushed back to f90 (I guess we assume we're running eamxx), while we do push to f90 for CAM.

I suspect the last of the two points above would cause wrong results in this case. I would leave -DSCREAM out of the compile line, and use -DCAM instead (which I think is already in the compile line anyways).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I have vague recollection that DSCREAM does not mean what a normal person would think. Maybe we should create a git issue in SCREAM to figure out whether we still need it or not? Though maybe it will naturally go away when we remove support for the F90 code in a few months?

Copy link
Contributor

Choose a reason for hiding this comment

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

EAMxx does need -DSCREAM (and in fact we do have it). But I think v0 should be considered as "EAM" from the point of view of Homme.

@PeterCaldwell
Copy link
Contributor

@wlin7 - I'd like to see a DP test case and -DSCREAM removed from the configure file, but otherwise I'm happy with this PR.

@wlin7
Copy link
Contributor Author

wlin7 commented Mar 23, 2023

Sorry I had an illusion this PR already merged and not watching. DP-SCREAM test added to atm_developer (and tested working well). Note that there is another global LR test for SCREAM in the integration test suite.

@PeterCaldwell , regarding use of -DSCREAM, just needing a handle in configure to determine it is a SCREAM case. This argument set in CAM_CONFIG_OPTS via config_component.xml is a handy one. EAM's configure does not see the actual compset used. If not using this argument, we could use -spa and/or -shoc_sgs, as they are currently only used for SCREAM cases. Maybe less safe if these physics options are extended for other configurations.

@PeterCaldwell
Copy link
Contributor

@wlin7 - Hmm. I think some people (like Po-Lun) are using SCREAM configurations with MAM rather than SPA, so -spa might cause problems. I could also easily imagine people comparing SHOC vs CLUBB, which would make -shoc_sgs in appropriate. I'm not sure of a better approach though. I guess I'd recommend connecting p3 version to -shoc_sgs and adding a warning message to the log file about which version of P3 was added. It's not worth doing something complicated since F90-SCREAM isn't officially supported and will be actively discouraged from use a few months from now.

@wlin7
Copy link
Contributor Author

wlin7 commented Mar 23, 2023

Good points, @PeterCaldwell . That does suggest it is not reliable to use those physics option as an indication of scream config.

How about keeping -DSCREAM for now. It is set in EAM's config_component.xml and passed to configure, and it has an impact on calculation concerning adjust_ps as @bartgol pointed above. When we remove cppdef of SCREAM altogether, we can pass another innocuous flag to configure for the sole purpose of informing it is a SCREAM case -- and not to be used as a cppdef.

@PeterCaldwell
Copy link
Contributor

I thought Luca said above that -DSCREAM was always false for F90 scream runs (so it won’t work to differentiate EAM versus scream). Have you confirmed that’s not the case?

@wlin7
Copy link
Contributor Author

wlin7 commented Mar 23, 2023

Yeah, I agreed with @bartgol 's assessment. No effect mostly because -DCAM and -DSCREAM are used redundantly. The exception is in homme/src/share/prim_driver_base.F90 and homme/src/theta-l_kokkos/prim_driver_mod.F90, which has statements solely condition on -DSCREAM.

homme/src/share/prim_driver_base.F90 is used for SCREAMv0 and regular EAM case.

@wlin7
Copy link
Contributor Author

wlin7 commented Mar 23, 2023

The 9f2d8bb now determines a scream case when p3 is used together with shoc_sgs. DPSCREAM and a regular EAM F2010 cases have been tested and verified the proper p3 version is selected for the build.

Copy link
Contributor

@bartgol bartgol left a comment

Choose a reason for hiding this comment

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

This is fine from the point of view of homme now. I can't comment much on the rest.

brhillman added a commit that referenced this pull request Mar 27, 2023
The alternating switch, determined by the case configuration option (a scream case or else), serves to control which version of Fortran P3 codes being used to build the model. A test is needed to track scream configuration. The version for the EAM version is currently just a skelton, which will be replaced by the eventual P3 PR from v3atm

[BFB] Two new tests SMS_Ln9_P24x1.ne4_ne4.FDPSCREAM-ARM97
and SMS_Ld1.ne30pg2_ne30pg2.F2010-SCREAM-LR-DYAMOND2
@brhillman
Copy link
Contributor

Merged to next.

@brhillman
Copy link
Contributor

gcp12 tests had runtime fails on next:

 1:  ERROR timeaddmonths():  MM out of range
 1:  set_time_float_from_date: error return from ESMF_TimeSet for set_time_float_from_date
 1:  ERROR: CHKRC

@brhillman brhillman merged commit 4a313dd into master Mar 28, 2023
@brhillman brhillman deleted the wlin/atm/p3_alt_eam_scream branch March 28, 2023 21:14
@brhillman
Copy link
Contributor

Merged to master. Note that the issues on gcp12 and on ascent ibm will need to be resolved in a subsequent PR.

crterai pushed a commit that referenced this pull request Jan 18, 2024
The alternating switch, determined by the case configuration option (a scream case or else), serves to control which version of Fortran P3 codes being used to build the model. A test is needed to track scream configuration. The version for the EAM version is currently just a skelton, which will be replaced by the eventual P3 PR from v3atm

[BFB] Two new tests SMS_Ln9_P24x1.ne4_ne4.FDPSCREAM-ARM97
and SMS_Ld1.ne30pg2_ne30pg2.F2010-SCREAM-LR-DYAMOND2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants