Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 37 additions & 28 deletions CIME/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,44 +738,53 @@ def _build_libraries(
if not os.path.exists(shared_item):
os.makedirs(shared_item)

mpilib = case.get_value("MPILIB")
ufs_driver = os.environ.get("UFS_DRIVER")
libs = list(dict.fromkeys(case.get_values("CASE_SUPPORT_LIBRARIES")))
logger.info(f"libs from case_support_libraries {libs}")
build_script = {}
cpl_in_complist = False
for l in complist:
if "cpl" in l:
cpl_in_complist = True
if ufs_driver:
logger.info("UFS_DRIVER is set to {}".format(ufs_driver))

# This is a bit hacky. The host model should define whatever
# shared libs it might need.
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"]
# The libs variable should include a list of required support libraries.
# The following block is provided for backward compatibility.
if len(libs) < 1:
logger.warning(
"The model is using a deprecated method of determining support "
"libraries, please migrate to 'CASE_SUPPORT_LIBRARIES' variable."
)
mpilib = case.get_value("MPILIB")
ufs_driver = os.environ.get("UFS_DRIVER")
if ufs_driver:
logger.info("UFS_DRIVER is set to {}".format(ufs_driver))

# This is a bit hacky. The host model should define whatever
# shared libs it might need.
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")
libs.append("FTorch")

if mpilib == "mpi-serial":
libs.insert(0, mpilib)
if mpilib == "mpi-serial":
libs.insert(0, mpilib)

if uses_kokkos(case) and comp_interface != "nuopc":
libs.append("ekat")
if uses_kokkos(case) and comp_interface != "nuopc":
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.

@bartgol if I understood your suggestion from #4837 correctly, the uses_kokkos function can be deprecated since the host model will define the shared libs in its config_component.xml?

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.

That's correct, this code is only still here for backward compatibility.

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.

Yeah, that was my idea. I don't want to inject knowledge about host model tpls into CIME. All CIME should care about is a list of libs names, and where to find their build scripts.

libs.append("ekat")

# Build shared code of CDEPS nuopc data models
build_script = {}
if comp_interface == "nuopc" and (not ufs_driver or ufs_driver != "nems"):
libs.append("CDEPS")
# Build shared code of CDEPS nuopc data models
if comp_interface == "nuopc" and (not ufs_driver or ufs_driver != "nems"):
libs.append("CDEPS")

ocn_model = case.get_value("COMP_OCN")
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")
atm_dycore = case.get_value("CAM_DYCORE")
if ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3"):
libs.append("FMS")

files = Files(comp_interface=comp_interface)
for lib in libs:
Expand Down
Loading
Loading