Skip to content

Commit

Permalink
Don't use nc-config in ESMF on any machine
Browse files Browse the repository at this point in the history
This has gone wrong on too many E3SM machines (now Chrysalis)!

Also, remove redundant cmake dependency
  • Loading branch information
xylar committed Apr 9, 2024
1 parent e6c7c5c commit 621ed9c
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions var/spack/repos/builtin/packages/esmf/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ class Esmf(MakefilePackage):
depends_on("[email protected]: ~mpi", when="@8.5:+external-parallelio~mpi")
depends_on("[email protected]:", type="build", when="~external-parallelio")

# Build dependencies
depends_on("[email protected]:", type="build", when="~external-parallelio")

# Testing dependencies
depends_on("perl", type="test")

Expand Down Expand Up @@ -335,37 +332,11 @@ def setup_build_environment(self, env):
##########

if "+netcdf" in spec:
if os.environ.get("NERSC_HOST", "") == "perlmutter":
# nc-config and nf-config don't have the right --libs and
# --flibs
print('Installing ESMF on Perlmutter')
env.set("ESMF_NETCDF", "split")
env.set("ESMF_NETCDF_LIBPATH", spec["netcdf-c"].prefix.lib)
env.set("ESMF_NETCDF_INCLUDE", spec["netcdf-c"].prefix.include)
elif os.environ.get("HOST", "").startswith("ch-fe"):
# nc-config and nf-config don't have the right --libs and
# --flibs
print('Installing ESMF on Chicoma')
env.set("ESMF_NETCDF", "split")
env.set("ESMF_NETCDF_LIBPATH", spec["netcdf-c"].prefix.lib)
env.set("ESMF_NETCDF_INCLUDE", spec["netcdf-c"].prefix.include)
elif os.environ.get("LMOD_SYSTEM_NAME", "") == "frontier":
# nc-config and nf-config don't have the right --libs and
# --flibs
print('Installing ESMF on Frontier')
env.set("ESMF_NETCDF", "split")
env.set("ESMF_NETCDF_LIBPATH", spec["netcdf-c"].prefix.lib)
env.set("ESMF_NETCDF_INCLUDE", spec["netcdf-c"].prefix.include)
else:
# ESMF provides the ability to read Grid and Mesh data in
# NetCDF format.
env.set("ESMF_NETCDF", "nc-config")
env.set("ESMF_NFCONFIG", "nf-config")
netcdfc = spec["netcdf-c"]
if netcdfc.satisfies("~shared"):
nc_config = which(os.path.join(netcdfc.prefix.bin, "nc-config"))
nc_flags = nc_config("--static", "--libs", output=str).strip()
env.set("ESMF_NETCDF_LIBS", nc_flags)
# don't rely on nc-config and nf-config, as --libs adn --flibs
# are not reliable on too many machines
env.set("ESMF_NETCDF", "split")
env.set("ESMF_NETCDF_LIBPATH", spec["netcdf-c"].prefix.lib)
env.set("ESMF_NETCDF_INCLUDE", spec["netcdf-c"].prefix.include)

###################
# Parallel-NetCDF #
Expand Down

0 comments on commit 621ed9c

Please sign in to comment.