Skip to content

Transition CCPP framework from ccpp-prebuild to ccpp-capgen v1 - #695

Open
climbfuji wants to merge 36 commits into
NCAR:mainfrom
climbfuji:feature/capgen-ng
Open

Transition CCPP framework from ccpp-prebuild to ccpp-capgen v1#695
climbfuji wants to merge 36 commits into
NCAR:mainfrom
climbfuji:feature/capgen-ng

Conversation

@climbfuji

@climbfuji climbfuji commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the CCPP framework code generator from ccpp-prebuild to ccpp-capgen v1. The large update of the ccpp-framework code also requires changes in ccpp-physics and ccpp-scm.

The most important changes in CCPP-SCM are:

  • Update of CMake build system: the top-level CMakeLists.txt now drives the build and is invoked from scm/bin via cmake ../...
  • CCPP metadata changes in ccpp-scm due to a much simpler and cleaner handling of DDTs, bug fixes of inconsistencies between Fortran and Metadata, and the new type = control metadata tables.
  • Update of CCPP API (calls to ccpp_* in the SCM host model code).

Dependencies

Testing

  • CI
  • Manual testing on @climbfuji's devbox with gcc@14.2.1

Comment thread ccpp/framework-symlink/capgen-ng Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this, for my development only

Comment thread ccpp/CMakeLists.txt Outdated
Comment thread ccpp/CMakeLists.txt Outdated
climbfuji and others added 3 commits June 1, 2026 09:00
Changes to get the SCM tests to run:
* clm_lake was included in a SDF, but not used. In the Cap, there is a (new?) check to see if the active conditions are met before calling the scheme. This was causing a runtime error. CLM Lake returns if not turned on, so having this new runtime check beforehand triggered the failure before entering the scheme. I removed the unused CLM Lake from the SDF and it worked fine.
* Remove GFS_v16_debug SDFs from test list. (I see these were removed from the CCPP SCM?)
* Add snippet to ccpp/CMakeLists to build only requested SDFs (i.e., -DCCPP_SUITES).
* Uncomment and test 32-bit and Intel oneAPI in CMakeLists.
…; fix metadata-fortran inconsistencies, fix GitHub actions take 1
@dustinswales

dustinswales commented Jun 3, 2026

Copy link
Copy Markdown
Member

@climbfuji Looks like most of the tests are B4B, the only exception are the GNU release (optimized) tests. Could this be from compilation flag changes (e.g., Adding -fPIC)? The differences appear to be rounding errors for the GFS based tests, whereas the HRRR_gf and WoFs tests show non-negligible differences. For example:
HRRR_gf q:
Screenshot 2026-06-03 at 9 36 38 AM
HRRR_gf u-wind.
Screenshot 2026-06-03 at 9 36 15 AM

Full set of difference plots are stored as artifacts here

@climbfuji

Copy link
Copy Markdown
Contributor Author

@climbfuji Looks like most of the tests are B4B, the only exception are the GNU release (optimized) tests. Could this be from compilation flag changes (e.g., Adding -fPIC)? The differences appear to be rounding errors for the GFS based tests, whereas the HRRR_gf and WoFs tests show non-negligible differences. For example: HRRR_gf q: Screenshot 2026-06-03 at 9 36 38 AM HRRR_gf u-wind. Screenshot 2026-06-03 at 9 36 15 AM

Full set of difference plots are stored as artifacts here

Thanks for doing this comparison. The NEPTUNE runs are also not b4b identical. I think this is predominantly because the caps look different and the compiler optimizes the code differently.

But for the two suites you mentioned, what do they have in common that the other suites don't have?

I am certain that the much stricter validator and code generator helped identify and fix a few actual bugs.

@grantfirl

Copy link
Copy Markdown
Collaborator

@dustinswales @climbfuji GNU release RTs for the SCM have been changing results basically every PR. It seems like something is just not reproducible or otherwise fishy with the environment. I wouldn't base any decisions on whether GNU release tests are b4b or not.

@dustinswales

Copy link
Copy Markdown
Member

@dustinswales @climbfuji GNU release RTs for the SCM have been changing results basically every PR. It seems like something is just not reproducible or otherwise fishy with the environment. I wouldn't base any decisions on whether GNU release tests are b4b or not.

@grantfirl Thanks. I thought it was an odd result.
@climbfuji The HRRR/WoFs suites are quite different than the GFS suites:
Screenshot 2026-06-03 at 11 30 13 AM

In any event... I've seen enough to warrant trying capgen-ng in the UFS. Any objections @climbfuji?

@climbfuji

Copy link
Copy Markdown
Contributor Author

No objections at all, please go ahead. I can also help out if you share a working branch and/or a checkout on Ursa, for example. I expect we'll have to fiddle a bit with the physics called from the dycore ...

@climbfuji

Copy link
Copy Markdown
Contributor Author

@dustinswales @grantfirl Looks like we'll have a clean pass through all CI tests in a few minutes.

@climbfuji

Copy link
Copy Markdown
Contributor Author

@dustinswales @grantfirl I think this is good now. We've got the tendencies and C3 updates in this branch (updated today from main), and the tests all pass.

@dustinswales

Copy link
Copy Markdown
Member

@dustinswales @grantfirl I think this is good now. We've got the tendencies and C3 updates in this branch (updated today from main), and the tests all pass.

@climbfuji Thanks for these bug fixes.
(I apologize for my slow response. I'm in the MPAS workshop this week)

@climbfuji climbfuji changed the title DRAFT: Update to capgen-ng Transition CCPP framework from ccpp-prebuild to ccpp-capgen v1 Jun 30, 2026
@climbfuji
climbfuji force-pushed the feature/capgen-ng branch from 50fa6f8 to fa33ff6 Compare June 30, 2026 22:25
@climbfuji
climbfuji marked this pull request as ready for review June 30, 2026 22:25

@scrasmussen scrasmussen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As part of my review I submitted the PR climbfuji#6 . It has the following changes that I noticed while reviewing and testing this PR. If there are any issues just let me know, thanks for this work!

DESCRIPTION OF REVIEW PR CHANGES:

  • CMakeLists.txt
    • End of line characters were ^M, indicating mixed Windows and Linux carriage returns, ran dos2unix on the file
    • another commit reduces Intel compile time optimization from default -O3 to -O2 and removes -qoverride-limits. These two changes reduce ifx -j4 compile time from 93 minutes to 2 min 8 sec.
  • suites that were removed also needed to be removed from suite_info.py
  • changed macros in scm.F90 and scm_time_integration.F90 to parameters. I though the macro additions came from a coding agent but if there is a reason to keep the macros I can remove them!

Comment thread ccpp/suites/suite_SCM_GFS_v16_debug.xml Outdated
@climbfuji

Copy link
Copy Markdown
Contributor Author

As part of my review I submitted the PR climbfuji#6 . It has the following changes that I noticed while reviewing and testing this PR. If there are any issues just let me know, thanks for this work!

DESCRIPTION OF REVIEW PR CHANGES:

  • CMakeLists.txt

    • End of line characters were ^M, indicating mixed Windows and Linux carriage returns, ran dos2unix on the file
    • another commit reduces Intel compile time optimization from default -O3 to -O2 and removes -qoverride-limits. These two changes reduce ifx -j4 compile time from 93 minutes to 2 min 8 sec.
  • suites that were removed also needed to be removed from suite_info.py

  • changed macros in scm.F90 and scm_time_integration.F90 to parameters. I though the macro additions came from a coding agent but if there is a reason to keep the macros I can remove them!

Thanks for these updates. No coding agent ever touched the SCM code for this PR. I personally prefer macros over defining variables that are never used, but it's a personal preference and I don't mind parameters either.

@scrasmussen

Copy link
Copy Markdown
Member

Thanks for these updates. No coding agent ever touched the SCM code for this PR. I personally prefer macros over defining variables that are never used, but it's a personal preference and I don't mind parameters either.

Ok, good to know! The coding agent I've been using had started using them more, so I guessed incorrectly. I'll change the PR back to the original macros, I can see the logic in using them for variables that aren't used

* Removing Intel -qoverride-limits flag and setting release build to use -O2 optimization, instead of the default -O3, decrease the -j4 compile time from 94 minutes to 2

* ran dos2unix on this file to remove ^M end-of-line characters

* Suite info cleanup, suite has been removed

@scrasmussen scrasmussen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything building and looking good to me!

Comment thread ccpp/suites/suite_SCM_GFS_v16_debug.xml
Comment thread ccpp/suites/suite_SCM_GFS_v16_ugwpv1.xml
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.

4 participants