Use the checkout_externals utility to checkout physics submodules with cmake#1421
Use the checkout_externals utility to checkout physics submodules with cmake#1421jim-p-w wants to merge 1 commit intoMPAS-Dev:developfrom
Conversation
|
@jim-p-w Could you base your branch on the v8.3.0 tag? |
Will do. |
|
FYI, we are addressing the same issue in different routes: I would advocate we adopt the git submodules universally. |
src/core_atmosphere/CMakeLists.txt
Outdated
| message( FATAL_ERROR "Failed to checkout external repos via manage_externals" ) | ||
| else() | ||
| message(STATUS "Directory ${DIR_TO_CHECK} already exists, skipping clone") | ||
| message( STATUS "Finished checking out external repos via manage_externals" ) |
There was a problem hiding this comment.
It will be great to add a logic if physics_mmm and UGWP exist, skip running checkout_externals. Thanks!
There was a problem hiding this comment.
Although physics_mmm and UGWP may already exist, they may be out of sync with the tag specified in the Externals.cfg file.
There was a problem hiding this comment.
I think an "existence" check is consistent with all other "git lone" in this CMakeLists.txt.
Folks may want to make modifications inside physics_mmm or UGWP and don't want them to get overwritten by checkout_externals. This check does not break anything if one do a clean clone of MPAS-Model
There was a problem hiding this comment.
checkout_externals will not overwrite dirty checkouts.
I think keeping the logic as one-to-one with the make build where possible helps reduce issues such as this one where extra or divergent code may lead to unexpected difference in behavior.
That said, it would be nice to wholly use submodules (in my opinion).
There was a problem hiding this comment.
@islas Thanks for the discussion!
Will we get any issue if we add an existence check?
If physics_mmm or UGWP is out of sync, it is mostly due to some corner cases and in those situations, developers/users are expected to handle it manually.
It is nice that if we may use git submodules for all subcomponents.
GSL is transitioning to do that.
Adding an existence check here will help a little bit since we use git clone --recursive to get all codes and don't want check_externals to do duplicate or unexpected work in that situation. Thanks!
There was a problem hiding this comment.
Because an existence check of directories is not sufficient to know the correct code has been checked out my inclination is to always run checkout_externals. For example, if the main branch is checked out, as currently implemented the correct tag will get checked out.
Also, in the event a different tag is needed, editing src/core_atmosphere/Externals.cfg and rerunning cmake will update things properly without requiring manual deletion of directories.
There was a problem hiding this comment.
@jim-p-w Thanks for the discussion! FYI, I would like to provide a few alternate scenarios:
- One makes modifications under
physics_mmmorUGWP, commits them to personal fork/branch. So these directories are clean (not dirty). If one wants to rebuild the MPAS-Model,checkout_externalswill "overwrites" (to be accurate, switches the top reference) all changes. This is NOT what we expect. - If one add anything under
physics_mmmorUGWP, even touching a file, these directories will be dirty andcheckout_externalswill no longer take effect (per previous @islas's comment), right? - I think we can only be able to make sure checking out specified frozen checkouts from a clean clone. For other situations, if one want to update hash/tag or get back the default frozen checkout, one can run
checkout_externalsorgit checkoutmanually at the command line instead of our forcing it in the CMake runtime. - This PR changes the current behavior:
if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_MMM_DIR})
......
if(NOT EXISTS ${ATMOSPHERE_CORE_PHYSICS_NOAA_DIR})
......
and it may break downstream applications.
There was a problem hiding this comment.
@guoqing-noaa I think we can all agree that the existing CMakeLists.txt file is not correct. If I've understood the changes proposed in ufs-community#231 , it seems that there are a couple of potential drawbacks:
- If we create a fresh clone of MPAS-Model, compile, change one of the tags in the
Externals.cfgfile, and re-compile, the build will not use the updated physics repository tags (because, e.g., thephysics_mmmdirectory already exists). This is also a problem if we locally merge a branch that switches external physics repository tags and makes corresponding MPAS-Model code changes to work with the new external tag: compiling will make use of the modified MPAS-Model code without the corresponding updates to the external physics. - The behavior of the CMake build is inconsistent with that of the GNU Make build.
While it requires a change in expectations (i.e., the external physics used by the build will always be those specified in the Externals.cfg file), it looks to me like the changes proposed in this PR should address both of the above drawbacks.
I'm not sure if we'll reach an agreement in this PR discussion thread. If you intend to update the ufs-community fork in the near future with changes to the MPAS-Dev/MPAS-Model develop branch, perhaps that can be followed by a PR to the ufs-community fork to enforce whatever behavior you'd prefer, and subsequent merges of MPAS-Dev/MPAS-Model develop would hopefully leave those changes in place.
There was a problem hiding this comment.
@mgduda Thanks for the discussions! We have different use situations and preferences. That's fine and expected. We can make a little bit tweaks in the ufs-community fork after this PR is merged. Thanks!
6102275 to
b0b584e
Compare
|
I'm making this a draft until the target branch gets updated to be v8.3.0 |
What I'm suggesting is that your PR branch should begin at the |
b0b584e to
aaf4eaa
Compare
…h cmake. core_atmosphere requires specific versions of the physics code from https://github.com/NCAR/MMM-physics.git and https://github.com/NOAA-GSL/UGWP.git The checkout_externals utility uses the versions of those repositories specified in src/core_atmosphere/Externals.cfg. The gnu make build system uses checkout_externals; this change modifies the cmake build files to use the same mechanism as the make build system.
8ff5e97 to
365f28c
Compare
core_atmosphere requires specific versions of the physics code from https://github.com/NCAR/MMM-physics.git and https://github.com/NOAA-GSL/UGWP.git
The checkout_externals utility uses the versions of those repositories specified in src/core_atmosphere/Externals.cfg.
The gnu make build system uses checkout_externals; this change modifies the cmake build files to use the same mechanism as the make build system.
This PR fixes issue 1420
This was tested by building MPAS-Model code with cmake. It was also tested by building mpas-bundle.
This change was copied from wrf-model where it has been in use for about a year.