From 22f1dce3ff5ddf8888bdd67e8a6aef38fed7f170 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 20 Aug 2025 08:46:38 -0600 Subject: [PATCH 1/7] moves liblist to driver buildnml making cime more generic --- cime_config/buildnml | 34 +++++++++++++++++++++++++++++++- cime_config/config_component.xml | 15 +++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 7ffc28f82..e43cf0661 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -628,6 +628,35 @@ def compare_drv_flds_in(first, second, infile1, infile2): % (infile1, infile2), ) +def cmeps_lib_list(case): + ufs_driver = os.environ.get("UFS_DRIVER") + mpilib = case.get_value("MPILIB") + if ufs_driver: + logger.info("UFS_DRIVER is set to {}".format(ufs_driver)) + if ufs_driver and ufs_driver == "nems" and not cpl_in_complist: + libs = [] + elif case.get_value("MODEL") == "cesm": + libs = ["gptl", "pio", "csm_share"] + elif case.get_value("MODEL") == "e3sm": + libs = ["gptl", "mct", "spio", "csm_share"] + else: + libs = ["gptl", "mct", "pio", "csm_share"] + + libs.append("FTorch") + + if mpilib == "mpi-serial": + libs.insert(0, mpilib) + + # Build shared code of CDEPS nuopc data models + if not ufs_driver or ufs_driver != "nems": + libs.append("CDEPS") + + ocn_model = case.get_value("COMP_OCN") + + atm_dycore = case.get_value("CAM_DYCORE") + if ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3"): + libs.append("FMS") + return libs ############################################################################### def buildnml(case, caseroot, component): @@ -635,6 +664,9 @@ def buildnml(case, caseroot, component): if component != "drv": raise AttributeError + libs = cmeps_lib_list(case) + case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) + esmfmkfile = os.getenv("ESMFMKFILE") expect( esmfmkfile and os.path.isfile(esmfmkfile), @@ -725,7 +757,7 @@ def buildnml(case, caseroot, component): def _main_func(): caseroot = parse_input(sys.argv) - with Case(caseroot) as case: + with Case(caseroot, read_only=False) as case: buildnml(case, caseroot, "drv") diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 5323b5df2..4d2aa5b8f 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -2522,10 +2522,19 @@ Remote git repository used for this case - - - + + char + + build_def + env_build.xml + Support libraries required + + + + + + logical TRUE,FALSE From e4030eb391b56bdea396147aa2286aff71568716 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 21 Aug 2025 08:06:26 -0600 Subject: [PATCH 2/7] allow for other components to modify CASE_SUPPORT_LIBRARIES --- cime_config/buildnml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index e43cf0661..0b970cc6b 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -7,7 +7,7 @@ _CIMEROOT = os.environ.get("CIMEROOT") if _CIMEROOT is None: raise SystemExit("ERROR: must set CIMEROOT environment variable") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +sys.path.append(os.path.join(_CIMEROOT, "CIME", "Tools")) import shutil, glob, itertools from standard_script_setup import * @@ -629,18 +629,22 @@ def compare_drv_flds_in(first, second, infile1, infile2): ) def cmeps_lib_list(case): + # provide a list of support libs that must be built for this case + # should be ordered with dependent libraries listed after those depended on ufs_driver = os.environ.get("UFS_DRIVER") mpilib = case.get_value("MPILIB") if ufs_driver: logger.info("UFS_DRIVER is set to {}".format(ufs_driver)) + # allows for some libs to have been previously set + libs = case.get_values("CASE_SUPPORT_LIBRARIES") if ufs_driver and ufs_driver == "nems" and not cpl_in_complist: - libs = [] + pass elif case.get_value("MODEL") == "cesm": - libs = ["gptl", "pio", "csm_share"] + libs.extend(["gptl", "pio", "csm_share"]) elif case.get_value("MODEL") == "e3sm": - libs = ["gptl", "mct", "spio", "csm_share"] + libs.extend(["gptl", "mct", "spio", "csm_share"]) else: - libs = ["gptl", "mct", "pio", "csm_share"] + libs.extend(["gptl", "mct", "pio", "csm_share"]) libs.append("FTorch") From 32d3d9d84800b157b8bf89f0006f9879d30a9d3f Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 22 Aug 2025 08:27:15 -0600 Subject: [PATCH 3/7] add comment --- cime_config/buildnml | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/buildnml b/cime_config/buildnml index 0b970cc6b..b8f9e1259 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -631,6 +631,7 @@ def compare_drv_flds_in(first, second, infile1, infile2): def cmeps_lib_list(case): # provide a list of support libs that must be built for this case # should be ordered with dependent libraries listed after those depended on + # the library names should match the keys in variable BUILD_LIB_FILE from config_files.xml ufs_driver = os.environ.get("UFS_DRIVER") mpilib = case.get_value("MPILIB") if ufs_driver: From 5536f787159a37245e670dfacaf10721326f74c9 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 26 Aug 2025 07:50:34 -0600 Subject: [PATCH 4/7] move defaults to xml --- cime_config/buildnml | 14 -------------- cime_config/config_component.xml | 3 +++ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index b8f9e1259..0fac01770 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -638,23 +638,9 @@ def cmeps_lib_list(case): logger.info("UFS_DRIVER is set to {}".format(ufs_driver)) # allows for some libs to have been previously set libs = case.get_values("CASE_SUPPORT_LIBRARIES") - if ufs_driver and ufs_driver == "nems" and not cpl_in_complist: - pass - elif case.get_value("MODEL") == "cesm": - libs.extend(["gptl", "pio", "csm_share"]) - elif case.get_value("MODEL") == "e3sm": - libs.extend(["gptl", "mct", "spio", "csm_share"]) - else: - libs.extend(["gptl", "mct", "pio", "csm_share"]) - - libs.append("FTorch") if mpilib == "mpi-serial": libs.insert(0, mpilib) - - # Build shared code of CDEPS nuopc data models - if not ufs_driver or ufs_driver != "nems": - libs.append("CDEPS") ocn_model = case.get_value("COMP_OCN") diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 4d2aa5b8f..e2023a1a8 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -2525,6 +2525,9 @@ char + + gptl,pio,csm_share,FTorch,CDEPS + build_def env_build.xml Support libraries required From dbf5588452b1c4da3415f0e3cc500f0fa95eb4cf Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 26 Aug 2025 12:46:27 -0600 Subject: [PATCH 5/7] clean up; --- .github/workflows/srt.yml | 2 +- cime_config/buildnml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/srt.yml b/.github/workflows/srt.yml index 31ee1d131..98e97978e 100644 --- a/.github/workflows/srt.yml +++ b/.github/workflows/srt.yml @@ -28,7 +28,7 @@ jobs: LDFLAGS: "-L/usr/lib/x86_64-linux-gnu -lnetcdf -lnetcdff -lpnetcdf" # Versions of all dependencies can be updated here ESMF_VERSION: v8.8.0 - PARALLELIO_VERSION: pio2_6_5 + PARALLELIO_VERSION: pio2_6_6 CIME_MODEL: cesm CIME_DRIVER: nuopc GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cime_config/buildnml b/cime_config/buildnml index 0fac01770..763a2e5e2 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -633,12 +633,12 @@ def cmeps_lib_list(case): # should be ordered with dependent libraries listed after those depended on # the library names should match the keys in variable BUILD_LIB_FILE from config_files.xml ufs_driver = os.environ.get("UFS_DRIVER") - mpilib = case.get_value("MPILIB") if ufs_driver: logger.info("UFS_DRIVER is set to {}".format(ufs_driver)) - # allows for some libs to have been previously set + libs = case.get_values("CASE_SUPPORT_LIBRARIES") + mpilib = case.get_value("MPILIB") if mpilib == "mpi-serial": libs.insert(0, mpilib) From 4161f31cf2d22c3ce8f04c2afd8cf2c2f20f5119 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 28 Aug 2025 07:47:46 -0600 Subject: [PATCH 6/7] update documentation --- cime_config/buildnml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 763a2e5e2..c1c8573c7 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -643,9 +643,9 @@ def cmeps_lib_list(case): libs.insert(0, mpilib) ocn_model = case.get_value("COMP_OCN") - + # These will be handeled by MOM and CAM, included here for backward compatibility. atm_dycore = case.get_value("CAM_DYCORE") - if ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3"): + if ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3") and "FMS" not in libs: libs.append("FMS") return libs From 60a8e23437602cf89bb2abd88f16027f01fc6634 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 28 Aug 2025 07:57:53 -0600 Subject: [PATCH 7/7] reponse to copilot review --- cime_config/buildnml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index c1c8573c7..692e30e54 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -643,9 +643,9 @@ def cmeps_lib_list(case): libs.insert(0, mpilib) ocn_model = case.get_value("COMP_OCN") - # These will be handeled by MOM and CAM, included here for backward compatibility. + # These will be handled by MOM and CAM, included here for backward compatibility. atm_dycore = case.get_value("CAM_DYCORE") - if ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3") and "FMS" not in libs: + if (ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3")) and "FMS" not in libs: libs.append("FMS") return libs