Skip to content

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

Merged
grantfirl merged 41 commits into
NCAR:mainfrom
climbfuji:feature/capgen-ng
Aug 14, 2026
Merged

Transition CCPP framework from ccpp-prebuild to ccpp-capgen v1#695
grantfirl merged 41 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
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.

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

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

@scrasmussen

Copy link
Copy Markdown
Member

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

@grantfirl I've been able to run bomex and twpice cases on Derecho. I also tested with the DEFAULT_MPI_COMMAND = 'mpirun -np 1' command in run_scm.py just in case that was causing an issue.

But that was on Derecho, I'm starting to test it locally on my Linux box right now and can also test on a Mac. How are you setting up the environment to build? Using a Dockerfile, conda env, something else?

@grantfirl

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

@grantfirl I've been able to run bomex and twpice cases on Derecho. I also tested with the DEFAULT_MPI_COMMAND = 'mpirun -np 1' command in run_scm.py just in case that was causing an issue.

But that was on Derecho, I'm starting to test it locally on my Linux box right now and can also test on a Mac. How are you setting up the environment to build? Using a Dockerfile, conda env, something else?

On my local Mac, I've installed spack-stack using the instructions that they provided, although I've been stuck at 1.9.1 or something. I tried to update to 2+ in the past 6 months but ran into issues. I should probably try to update again and retry.

Now that Ursa is back, I'll try to run there too. I'd just really like to be able to run locally since, historically, I've enjoyed doing development on my Mac with the SCM. It shouldn't hold up this PR, though. If we can test successfully on Derecho and Ursa, that is good enough, and I can troubleshoot my Mac after this is merged.

@scrasmussen

Copy link
Copy Markdown
Member

On my local Mac, I've installed spack-stack using the instructions that they provided, although I've been stuck at 1.9.1 or something. I tried to update to 2+ in the past 6 months but ran into issues. I should probably try to update again and retry.

Now that Ursa is back, I'll try to run there too. I'd just really like to be able to run locally since, historically, I've enjoyed doing development on my Mac with the SCM. It shouldn't hold up this PR, though. If we can test successfully on Derecho and Ursa, that is good enough, and I can troubleshoot my Mac after this is merged.

@grantfirl I tried to build the spack-stack on my mac and it wasn't going as smoothly as I liked so I just quickly updated the Dockerfiles we already have so it's at least easy to build and run the SCM locally. I submitted those changes in #713. Not a long term spack solution and probably doesn't match your local workflow (the image doesn't have dev IDEs, etc) but thought I'd at least throw it out there

@grantfirl

Copy link
Copy Markdown
Collaborator

@scrasmussen @dustinswales I'm able to compile and run now on Ursa. It turns out that just checking out this branch in my existing clone on Ursa was a bad idea. I failed to remove the contents of the previous run directory and there were some weird linking problems created when using the updated code and run script. After removing everything in the run directory and trying to re-run, I was successful running on Ursa, which is good enough to merge, I think.

I did notice that one helpful function is now no longer part of CMakeLists.txt, but I created an issue to address this in a follow-up. See #714.

@hertneky

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

I built/ran RTs successfully with GNU on Ursa, but for intel, while it built fine, I get a run error stderr: "Abort(1090319) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Unknown error class, error stack:

@grantfirl @scrasmussen Did either of you test with the ursa_intel build? I thought I would test both compilers since it's a big change to the build structure.

Derecho/gnu is also good. I didn't test derecho/intel yet as the build is in the queue.

@grantfirl

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

I built/ran RTs successfully with GNU on Ursa, but for intel, while it built fine, I get a run error stderr: "Abort(1090319) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Unknown error class, error stack:

@grantfirl @scrasmussen Did either of you test with the ursa_intel build? I thought I would test both compilers since it's a big change to the build structure.

Derecho/gnu is also good. I didn't test derecho/intel yet as the build is in the queue.

@hertneky I built and succesfully with intel on Ursa.

BTW, @scrasmussen @hertneky @climbfuji @dustinswales , I'm creating a new physics PR with the physics changes coming directly from ufs/dev. It should be a superset of the existing ccpp-physics PR into scm/dev and it should supercede it, since it started from the same place but included more changes from @dustinswales .

@hertneky

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

I built/ran RTs successfully with GNU on Ursa, but for intel, while it built fine, I get a run error stderr: "Abort(1090319) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Unknown error class, error stack:
@grantfirl @scrasmussen Did either of you test with the ursa_intel build? I thought I would test both compilers since it's a big change to the build structure.
Derecho/gnu is also good. I didn't test derecho/intel yet as the build is in the queue.

@hertneky I built and succesfully with intel on Ursa.

BTW, @scrasmussen @hertneky @climbfuji @dustinswales , I'm creating a new physics PR with the physics changes coming directly from ufs/dev. It should be a superset of the existing ccpp-physics PR into scm/dev and it should supercede it, since it started from the same place but included more changes from @dustinswales .

@grantfirl Great - For intel, I will trust your test then and chalk it up to something wrong on my end.

@hertneky hertneky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should update the UG for the cmake changes. In scm/doc/TechGuide/chap_quick.rst there are 3 instances of cmake ../src that need to be changed to cmake ../..

Ursa and Derecho SCM RTs ran successfully for me on GNU.

@hertneky

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

I built/ran RTs successfully with GNU on Ursa, but for intel, while it built fine, I get a run error stderr: "Abort(1090319) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Unknown error class, error stack:
@grantfirl @scrasmussen Did either of you test with the ursa_intel build? I thought I would test both compilers since it's a big change to the build structure.
Derecho/gnu is also good. I didn't test derecho/intel yet as the build is in the queue.

@hertneky I built and succesfully with intel on Ursa.
BTW, @scrasmussen @hertneky @climbfuji @dustinswales , I'm creating a new physics PR with the physics changes coming directly from ufs/dev. It should be a superset of the existing ccpp-physics PR into scm/dev and it should supercede it, since it started from the same place but included more changes from @dustinswales .

@grantfirl Great - For intel, I will trust your test then and chalk it up to something wrong on my end.

@grantfirl I refreshed the build a 2nd time and then ursa-intel ran fine. Not sure what it was.

@grantfirl

Copy link
Copy Markdown
Collaborator

We should update the UG for the cmake changes. In scm/doc/TechGuide/chap_quick.rst there are 3 instances of cmake ../src that need to be changed to cmake ../..

Ursa and Derecho SCM RTs ran successfully for me on GNU.

I think that these should now be fixed.

@hertneky
hertneky self-requested a review August 13, 2026 22:16
@hertneky

Copy link
Copy Markdown
Collaborator

@scrasmussen @hertneky Have you all tested this PR anywhere besides the GitHub CI servers? I'm having trouble running locally on my Mac. I keep running into MPI broken pipe errors when trying to use the run script. I don't know if it has to do with my environment or something else. I'm still able to run the top of main just fine, though.

I built/ran RTs successfully with GNU on Ursa, but for intel, while it built fine, I get a run error stderr: "Abort(1090319) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Unknown error class, error stack:
@grantfirl @scrasmussen Did either of you test with the ursa_intel build? I thought I would test both compilers since it's a big change to the build structure.
Derecho/gnu is also good. I didn't test derecho/intel yet as the build is in the queue.

@hertneky I built and succesfully with intel on Ursa.
BTW, @scrasmussen @hertneky @climbfuji @dustinswales , I'm creating a new physics PR with the physics changes coming directly from ufs/dev. It should be a superset of the existing ccpp-physics PR into scm/dev and it should supercede it, since it started from the same place but included more changes from @dustinswales .

@grantfirl Great - For intel, I will trust your test then and chalk it up to something wrong on my end.

@grantfirl I refreshed the build a 2nd time and then ursa-intel ran fine. Not sure what it was.

Derecho intel has now also run scm rts successfully.

@grantfirl

Copy link
Copy Markdown
Collaborator

All, I reran RTs on Ursa using both compilers after updating the PR branches from main and ufs/dev. There were some runtime errors, but I don't think that they're related to this PR, exactly. They may also be one-off type errors that could be fixed with requesting more memory. For all tests, I ran cmake/make on the login node and ran the RTs (using the full case length, not 10% as is done during CI RTs) on compute nodes.

All RRTMGP tests ran into insufficient memory errors in release mode, both for ifx and gfortran. The TEMPO tests ran into a segmentation fault later in the run. This one is weird since the same tests run on CI, albeit only to 10% of the runtime.

I think that all RT failures can be investigated after this PR is merged. It has been tested to the hilt in this model, UFS, and NEPTUNE, so I don't have any doubts as to the efficacy of the capgen-ng caps. I think we shouldn't delay this any longer to investigate minor RT issues on Ursa.

@climbfuji

Copy link
Copy Markdown
Contributor Author

I agree, and I am thankful for all your efforts. With so many moving parts and different branches, it is hard to stay on top!

Please let me know if and if yes, how, I should update the PR description (or feel free to do it yourself). Thanks.

@grantfirl
grantfirl merged commit 0fab407 into NCAR:main Aug 14, 2026
@grantfirl

Copy link
Copy Markdown
Collaborator

I agree, and I am thankful for all your efforts. With so many moving parts and different branches, it is hard to stay on top!

Please let me know if and if yes, how, I should update the PR description (or feel free to do it yourself). Thanks.

I wouldn't worry about the PR description. There is plenty of documentation of everything that went on in the comments.

Phenomenal work to get the capgen rewrite done and working across so many hosts!

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.

5 participants