Skip to content

Conversation

@jgfouca
Copy link
Member

@jgfouca jgfouca commented Nov 25, 2024

Following the pattern of a recent P3 PR, this PR changes the bfb unit tests to be based on baseline files instead of fortran calls. Unlike in that PR, we are actually able to completely remove all dependence on fortran code here because SHOC doesn't need any f90 init routines.

Change list:

  1. Main change: For all the BFB SHOC unit tests, use baseline files instead of calling fortran!
  2. Remove all of the CXX->f90 bridge code
  3. Cleanup of shoc_init situation. SHOC has no global data, so you only need to call it if you need to compute npbl
  4. Reorg by moving some less-interesting testing stuff into shoc/tests/infra. Now, the files presented in the public interface (just shoc directory) is a lot cleaner.
  5. All shoc tests (bfb and run_and_cmp) accept the same set of arguments (-c for compare, -g for generate, -b for baseline dir, and -n for no baselines).
  6. Some of the tests that just confirm that DIFFs are caught do need to do thread count spreads.
  7. Remove the ability of shoc.F90 to call CXX impls..
  8. gen-boiler can now generate _host functions for function that have array data.
  9. No longer need to worry about transposing array data, we never cross language boundary anymore.
  10. There were a lot of f90 functions that had a property test but were never actually used in the CXX. I removed all of these:
  • shoc_impli_sfc_fluxes_tests.cpp
  • shoc_impli_srf_stress_tests.cpp
  • shoc_impli_srf_tke_tests.cpp
  • shoc_energy_total_fixer_tests.cpp
  • shoc_energy_dse_fixer_tests.cpp
  • shoc_energy_threshold_fixer_tests.cpp
  • shoc_fterm_input_third_moms_tests.cpp
  • shoc_fterm_diag_third_moms_tests.cpp
  • shoc_omega_diag_third_moms_tests.cpp
  • shoc_xy_diag_third_moms_tests.cpp
  • shoc_aa_diag_third_moms_tests.cpp
  • shoc_w3_diag_third_moms_tests.cpp

[BFB]


Moved over from: E3SM-Project/scream#3121

P3 DIFFs are expected because I caught a few places that were transposing views that didn't need to do that anymore. SHOC fails are expected because the baselines haven't been generated for the containers yet.

Follow on work:

  • Port P3 init code from fortran; this is the last of the fortran being used by either p3 or shoc
  • Remove all references to "fortran" or "Fortran". These names are all obsolete.

…_f90_shoc

* origin/master: (326 commits)
  EAMxx: Add aerosols and gases outputs to ensure the microscopy baseline test is sensitive to changes in the interface.
  fix standard names for low/med/hgh cloud area fraction types
  Add standard name metadata to most EAMxx output variables
  EAMxx: Update mam4xx submodule to fix CUDA test.
  EAMxx:  Modify microphysics interface to include sethet (washout rates) computations.
  Bump DavidAnson/markdownlint-cli2-action from 17 to 18
  EAMxx: Moves fences into the interface and remove extra comments
  EAMxx: Adds missing namelist entries for multi process test
  EAMxx: Remove all diffs from microphysics cpp file
  ff mam4xx to current main
  Revert "EAMxx: Clang format"
  EAMxx:Inits constituent fluxes to zero
  fix cuda compile warnings
  EAMxx: Moves online emiss and constituent init to a new function hpp file
  EAMxx: Fixed some comments paths and other minor cleanup
  EAMxx: Clang format
  EAMxx: Fixes a gpu bug requiring a particular format for dstflx
  update mam4xx submodule to fix gpu compilation error
  EAMxx:Removes accidently added file
  EAMxx: Some codes re-arranged after rebase
  ...
@jgfouca jgfouca added BFB PR leaves answers BFB EAMxx C++ based E3SM atmosphere model (aka SCREAM) labels Nov 25, 2024
@jgfouca jgfouca self-assigned this Nov 25, 2024
@github-actions
Copy link

github-actions bot commented Nov 25, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://E3SM-Project.github.io/E3SM/pr-preview/pr-6779/
on branch gh-pages at 2024-11-29 21:01 UTC

@AaronDonahue AaronDonahue changed the title Removes all fortran from SHOC EAMxx: Removes all fortran from SHOC Dec 2, 2024
using Array1 = typename KT::template lview<Scalar*>;
using Array2 = typename KT::template lview<Scalar**>;
using Array3 = typename KT::template lview<Scalar***>;
using Array1 = typename FortranData::Array1;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the meaning of "FortranData" here? Should this be maybe called something like "BaselineData" or is there still some Fortran reminescence?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bartgol , I made note of those in the follow-on work. These will be renamed but i don't think it's worth doing another CI run on this PR.

jgfouca added a commit that referenced this pull request Dec 3, 2024
Following the pattern of a recent P3 PR, this PR changes the bfb unit
tests to be based on baseline files instead of fortran calls. Unlike
in that PR, we are actually able to completely remove all dependence
on fortran code here because SHOC doesn't need any f90 init routines.

Change list:
1) Main change: For all the BFB SHOC unit tests, use baseline files instead of calling fortran!
2) Remove all of the CXX->f90 bridge code
3) Cleanup of shoc_init situation. SHOC has no global data, so you only need to call it if you need to compute npbl
4) Reorg by moving some less-interesting testing stuff into shoc/tests/infra. Now, the files presented in the public interface (just shoc directory) is a lot cleaner.
5) All shoc tests (bfb and run_and_cmp) accept the same set of arguments (-c for compare, -g for generate, -b for baseline dir, and -n for no baselines).
6) Some of the tests that just confirm that DIFFs are caught do need to do thread count spreads.
7) Remove the ability of shoc.F90 to call CXX impls..
8) gen-boiler can now generate _host functions for function that have array data.
9) No longer need to worry about transposing array data, we never cross language boundary anymore.

There were a lot of f90 functions that had a property test but were never actually used in the CXX. I removed all of these:
* shoc_impli_sfc_fluxes_tests.cpp
* shoc_impli_srf_stress_tests.cpp
* shoc_impli_srf_tke_tests.cpp
* shoc_energy_total_fixer_tests.cpp
* shoc_energy_dse_fixer_tests.cpp
* shoc_energy_threshold_fixer_tests.cpp
* shoc_fterm_input_third_moms_tests.cpp
* shoc_fterm_diag_third_moms_tests.cpp
* shoc_omega_diag_third_moms_tests.cpp
* shoc_xy_diag_third_moms_tests.cpp
* shoc_aa_diag_third_moms_tests.cpp
* shoc_w3_diag_third_moms_tests.cpp

[BFB]

Moved over from: E3SM-Project/scream#3121

P3 DIFFs are expected because I caught a few places that were transposing views that didn't need to do that anymore. SHOC fails are expected because the baselines haven't been generated for the containers yet.

Follow on work:

Port P3 init code from fortran; this is the last of the fortran being used by either p3 or shoc
Remove all references to "fortran" or "Fortran". These names are all obsolete.
@jgfouca jgfouca merged commit 8f12c3f into master Dec 3, 2024
14 of 21 checks passed
@jgfouca jgfouca deleted the jgfouca/bfb_unit_no_f90_shoc branch December 3, 2024 18:16
@rljacob
Copy link
Member

rljacob commented Dec 5, 2024

This should have been tested overnight on next before merging to mater since it touched code outside of eamxx.

@bartgol
Copy link
Contributor

bartgol commented Dec 5, 2024

This should have been tested overnight on next before merging to mater since it touched code outside of eamxx.

You're right that it touches one file outside of eamxx, but I think this is somewhat of a special case. All the code removed from shoc.F90 was code guarded by ifdef SCREAM_CONFIG_IS_CMAKE, which is only defined if eamxx is built. All EAM cases (including MMF) should NOT be affected by that.

@whannah1
Copy link
Contributor

whannah1 commented Dec 5, 2024

@bartgol

> grep "SCREAM_CONFIG_IS_CMAKE" components/eam/src/physics/crm/pam/* -r
components/eam/src/physics/crm/pam/external/physics/scream_cxx_interfaces/CMakeLists.txt:add_definitions(-DSCREAM_CIME_BUILD -DHAVE_MPI -DSCREAM_CONFIG_IS_CMAKE)

@bartgol
Copy link
Contributor

bartgol commented Dec 5, 2024

@bartgol

> grep "SCREAM_CONFIG_IS_CMAKE" components/eam/src/physics/crm/pam/* -r
components/eam/src/physics/crm/pam/external/physics/scream_cxx_interfaces/CMakeLists.txt:add_definitions(-DSCREAM_CIME_BUILD -DHAVE_MPI -DSCREAM_CONFIG_IS_CMAKE)

Ah, crap, I only ran git grep without --recurse-submodules... One of the reasons why I sometimes don't like submods.

@whannah1
Copy link
Contributor

whannah1 commented Dec 5, 2024

yea - and there's a list of reasons why pulling PAM into the repo makes sense. I hope to do that in the next year or so, but it depends on what we do with YAKL, among other things.

@rljacob rljacob changed the title EAMxx: Removes all fortran from SHOC EAMxx: Removes all fortran from C++ SHOC Dec 5, 2024
@bartgol
Copy link
Contributor

bartgol commented Dec 5, 2024

That said, I think the code that Jim purged from shoc.F90 is ONLY needed for eamxx's ability to call f90 implementation as part of the CXX-vs-F90 bfb testing. If PAM uses scream cxx impl, it should still be able to build with this PR merged.

@whannah1
Copy link
Contributor

whannah1 commented Dec 5, 2024

@bartgol yea, it's an easy fix for PAM to remove the include statements, I created a PR yesterday.

@rljacob
Copy link
Member

rljacob commented Dec 5, 2024

@bartgol your request for an exception in the future is denied.

@mahf708
Copy link
Contributor

mahf708 commented Dec 5, 2024

This should have been tested overnight on next before merging to mater since it touched code outside of eamxx.

I think this is a problem for how MMF (especially PAM) logic is constructed. I would be hesitant to make this into an EAMxx responsibility. I think PAM should be reworked to rely on EAMxx code more cleanly and abstractly. It's not designed well imo

@mahf708
Copy link
Contributor

mahf708 commented Dec 5, 2024

This keeps happening ...

@mahf708
Copy link
Contributor

mahf708 commented Dec 5, 2024

The outside code in this PR is really eamxx code. The issue is that PAM calls stuff way in the weeds, so we end up breaking it with every little touch. This is a PAM problem

For example, MMF is pulling stuff that it really doesn't need to pull and it is unclear if it ever needed it... 👀

@bartgol
Copy link
Contributor

bartgol commented Dec 5, 2024

@bartgol your request for an exception in the future is denied.

Tbc, I wasn't requesting exceptions. I was just pointing out that the collateral damage in this case should be minimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BFB PR leaves answers BFB EAMxx C++ based E3SM atmosphere model (aka SCREAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants