ctsm5.3.035: b4b-dev merge 2025-03-27#3037
Merged
samsrabin merged 40 commits intoESCOMP:masterfrom Mar 29, 2025
Merged
Conversation
Slightly modified.
merges ctsm5.3.031
Merge master 20250314
I don't understand how the previous version has been working on derecho: it seemed to be relying on things set in the share subdirectory, but I was finding that the settings there didn't carry back to this top-level location. Maybe the derecho build relies on some environment variables or compiler flags that are set by modules??? In any case, I had a lot of problems getting it to work on my Mac. This version works on my Mac. It's possible that not all of these changes are needed, but this new version makes more sense to me. A lot of these changes were copied from the top-level CMakeLists.txt in the share directory.
This came from working with Adrianna to get things working on her Mac. She used a version of ESMF with internal PIO, so I don't think we can do this find of PIO. And it turns out that it works to remove this, both in her build and in mine, as long as we remove the unneeded shr_pio_mod.F90 from the unit test build. I don't understand why this works: I thought it would need `-lpio` or something like that in the link line since ESMF depends on the PIO library. But maybe pio is folded into the esmf library or picked up dynamically through rpath or something like that??? The current state - with PIO not included in the unit test build - means that we may not be able to use PIO stuff directly from unit tests, but as Adrianna points out, that's probably a good thing anyway. I'm also concerned that it might be fragile - so we might need to add it back in later. But since it isn't needed for now, I'm not even sure that what's there works.
It turns out that the previous commit - where I had removed PIO stuff from the CMake build - didn't work on derecho. I think we can get the necessary pio stuff from the ESMF link flags, and I'm hopeful that doing it this way will work regardless of whether the setup uses PIO internal to ESMF or an external, separate PIO library.
This time rebased to b4b-dev
Avoid mksurfdata_esmf pitfall with --model-mesh-nx, ny
Get pFUnit-based unit tests working on my Mac
### Description of changes
With recent versions of CTSM, the unit test build wasn't working on my Mac, and Adrianna was having the same problem. The problem was that the unit test build wasn't finding the esmf library. I don't understand how this was working on derecho; my best guess is that the modules are adding something needed to the link line that isn't added on a simpler system that doesn't use modules.
This PR explicitly finds ESMF and adds necessary includes and link line flags. This borrows from what's done for the share unit test build, though differs somewhat from that. This also removes some things that are unneeded. It also removes `shr_pio_mod.F90` from the unit test build. I believe that that change (credit to Adrianna) allows the unit test build to work in either of two configurations: either with a separately-built PIO library (which is now the recommended configuration for CESM) or without that and instead building ESMF with its internal PIO library (which is the default build for ESMF and is simpler to set up). Some of the other diffs in this PR were also made with that goal of supporting both of these configurations. Thus, PIO isn't referenced directly in the unit test build; instead, if it's needed, it will be picked up via ESMF's link libraries (in the line `link_libraries(${ESMF_INTERFACE_LINK_LIBRARIES})`; note that that line adds some duplicate things to the link line, which results in some warnings, but this doesn't seem to cause any issues).
I have tested this on my Mac (with the current version of https://github.com/billsacks/mac_cime_configuration - `37262a9bca308179e50524d39c9e45e1b205bb18`) and on derecho. Unit tests build in both places. (The first commit on this branch worked on my Mac and on derecho, but not on Adrianna's Mac, where she didn't have a separate PIO library. The second commit worked on my Mac and Adrianna's Mac but not on derecho. The third - and latest - commit works on my Mac and derecho; I'm hopeful it will work for Adrianna, too.)
(I had some related discussion with Erik a few months ago: ESCOMP#2853 (comment) . He mentioned needing to remove the find of ESMF from CTSM's unit test build, but things are working for me now that it's back.)
### Specific notes
Contributors other than yourself, if any: Adrianna
CTSM Issues Fixed (include github issue #):
Fixes ESCOMP#2453
Are answers expected to change (and if so in what way)? No
Any User Interface Changes (namelist or namelist defaults changes)? No
Does this create a need to change or add documentation? Did you do so? No
Testing performed, if any:
- pFUnit-based unit testing on derecho (using the instructions in `README.unit_testing`)
- pFUnit-based unit testing on my Mac
Also delete a TODO.
Update single point docs (and improve subset_data etc. erroring)
Fixes to enable passing FATES two-stream ERS and ERI restart tests PR ESCOMP#2949
ekluzek
approved these changes
Mar 28, 2025
This was referenced Mar 29, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Merge b4b-dev to master. Includes these PRs:
Remaining work
SMS_D_Mmpi-serial_Ld5.5x5_amazon.I2000Clm60FatesCrujraRs.izumi_nag.clm-FatesColdSMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_intel.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWOSpecific notes
Contributors other than yourself, if any: @slevis-lmwg, @billsacks
Are answers expected to change (and if so in what way)?: No
Any User Interface Changes (namelist or namelist defaults changes)? No
Does this create a need to change or add documentation? Did you do so? Yes; PR ESCOMP/ctsm-docs#8
Testing performed, if any:
aux_clm, Derecho: OKaux_clm, Izumi: OK