Skip to content

Commit

Permalink
Merge branch 'jcsda_emc_spack_stack' into feature/fv3_jedi
Browse files Browse the repository at this point in the history
  • Loading branch information
climbfuji authored Oct 2, 2023
2 parents 1939921 + a90e852 commit 6923f36
Show file tree
Hide file tree
Showing 34 changed files with 512 additions and 257 deletions.
119 changes: 66 additions & 53 deletions lib/jcsda-emc/spack-stack/stack/meta_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,14 @@ def setup_meta_modules():
module_choice = module_config["default"]["enable"][0]
logging.info(" ... configured to use {} modules".format(module_choice))

# Prevent the use of tcl modules on macOS because sed syntax is different
if module_choice == "tcl" and sys.platform == "darwin":
raise Exception("Use of tcl modules on macOS not supported - sed syntax differs")
# Need to set a few variables when tcl modules are used
if module_choice == "tcl":
module_replace_patterns = ["is-loaded", "module load", "depends-on"]
# sed syntax differs on macOS
if sys.platform == "darwin":
sed_syntax_fix = "''"
else:
sed_syntax_fix = ""

# Top-level module directory
module_dir = substitute_config_vars(module_config["default"]["roots"][module_choice])
Expand Down Expand Up @@ -297,8 +302,13 @@ def setup_meta_modules():
# Then, check for mpi providers - recursively for compilers
mpi_dict = get_matched_dict(module_dir, mpi_candidate_list, compiler_candidate_list)
if not mpi_dict:
raise Exception("No matching MPI providers found")
logging.info(" ... stack mpi providers: '{}'".format(mpi_dict))
user_input = input(
"No matching MPI providers found, proceed without creating MPI module hierarchy? (yes/no): "
)
if not user_input.lower() in ["yes", "y"]:
raise Exception("No matching MPI providers found")
else:
logging.info(" ... stack mpi providers: '{}'".format(mpi_dict))

# For some environments, there are only compiler+mpi-dependent modules,
# and therefore the compiler itself is not recorded in compiler_dict.
Expand Down Expand Up @@ -422,18 +432,13 @@ def setup_meta_modules():
logging.debug(
" ... ... ... removing compiler prefices in {}".format(filepath)
)
cmd = "sed -i 's#is-loaded {}/{}/#is-loaded #g' {}".format(
compiler_name, compiler_version, filepath
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
cmd = "sed -i 's#load {}/{}/#load #g' {}".format(
compiler_name, compiler_version, filepath
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
for pattern in module_replace_patterns:
cmd = "sed -i {4} 's#{0} {1}/{2}/#{0} #g' {3}".format(
pattern, compiler_name, compiler_version, filepath, sed_syntax_fix
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))

# Read compiler template into module_content string
with open(COMPILER_TEMPLATES[module_choice]) as f:
Expand Down Expand Up @@ -646,40 +651,34 @@ def setup_meta_modules():
filepath
)
)
# Search patterns
patterns = ["is-loaded", "module load", "depends-on"]
# First, compiler-only dependent modules
cmd = "sed -i 's#is-loaded {}/{}/#is-loaded #g' {}".format(
compiler_name, compiler_version, filepath
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
cmd = "sed -i 's#load {}/{}/#load #g' {}".format(
compiler_name, compiler_version, filepath
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
for pattern in module_replace_patterns:
cmd = "sed -i {4} 's#{0} {1}/{2}/#{0} #g' {3}".format(
pattern,
compiler_name,
compiler_version,
filepath,
sed_syntax_fix,
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
# Then, compiler+mpi-dependent modules
cmd = "sed -i 's#is-loaded {}/{}/{}/{}/#is-loaded #g' {}".format(
mpi_name,
mpi_version,
compiler_name,
compiler_version,
filepath,
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
cmd = "sed -i 's#load {}/{}/{}/{}/#load #g' {}".format(
mpi_name,
mpi_version,
compiler_name,
compiler_version,
filepath,
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))
for pattern in module_replace_patterns:
cmd = "sed -i {6} 's#{0} {1}/{2}/{3}/{4}/#{0} #g' {5}".format(
pattern,
mpi_name,
mpi_version,
compiler_name,
compiler_version,
filepath,
sed_syntax_fix,
)
status = os.system(cmd)
if not status == 0:
raise Exception("Error while calling '{}'".format(cmd))

# Read compiler lua template into module_content string
with open(MPI_TEMPLATES[module_choice]) as f:
Expand All @@ -698,7 +697,10 @@ def setup_meta_modules():
f.write(module_content)
logging.info(" ... writing {}".format(mpi_module_file))

del package_name
try:
del package_name
except:
pass
# Create python modules. Need to accommodate both external
# Python distributions and spack-built Python distributions.
# If there is no package config info for Python, then we are
Expand Down Expand Up @@ -748,10 +750,21 @@ def setup_meta_modules():
python_dict = get_matched_dict(compiler_install_dir, python_candidate_list)
logging.info(" ... stack python providers: '{}'".format(python_dict))
if not python_dict:
raise Exception(
"""No matching Python version found. Make sure that the
Python version in the package config matches what spack installed."""
user_input = input(
"No matching Python version found found, proceed without creating Python modules? (yes/no): "
)
if not user_input.lower() in ["yes", "y"]:
raise Exception(
""""No matching Python version found. Make sure that the
Python version in the package config matches what spack installed."""
)
else:
logging.info(
"Metamodule generation completed successfully in {}".format(
meta_module_dir
)
)
return

for compiler_name in compiler_dict.keys():
for compiler_version in compiler_dict[compiler_name]:
Expand Down
11 changes: 7 additions & 4 deletions var/spack/repos/builtin/packages/awscli/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Awscli(PythonPackage):

pypi = "awscli/awscli-1.16.308.tar.gz"

version("1.29.41", sha256="c029edd2c0bd72fb49cefe1a8f83ce2b46ba31ab45769677f7ba0771461078cb")
version("1.27.84", sha256="a27a7d1f3efa9dd2acf9d8bd72b939337d53da4ac71721cde6d5dff94aa446f7")
version("1.27.56", sha256="58fd7122547db71646c053c914bd4f9b673356dd8c9520ae6d35560a8aec208b")
version("1.16.308", sha256="3632fb1db2538128509a7b5e89f2a2c4ea3426bec139944247bddc4d79bf7603")
Expand All @@ -22,22 +23,24 @@ class Awscli(PythonPackage):
depends_on("[email protected]:", when="@1.25:", type=("build", "run"))

# py-botocore is pinned to the patch version number
depends_on("[email protected]", when="@1.29.41", type=("build", "run"))
depends_on("[email protected]", when="@1.27.84", type=("build", "run"))
depends_on("[email protected]", when="@1.27.56", type=("build", "run"))
depends_on("[email protected]", when="@1.16.308", type=("build", "run"))
depends_on("[email protected]", when="@1.16.179", type=("build", "run"))

depends_on("[email protected]:0.4.4", when="@1.27", type=("build", "run"))
depends_on("[email protected]:0.4.4", when="@1.27:", type=("build", "run"))
depends_on("[email protected]:0.3.9", when="@1.16", type=("build", "run"))

depends_on("[email protected]:0.16", when="@1.27", type=("build", "run"))
depends_on("[email protected]:0.16", when="@1.27:", type=("build", "run"))
depends_on("[email protected]:0.15", when="@1.16", type=("build", "run"))

depends_on("[email protected]:6.0", when="@1.29", type=("build", "run"))
depends_on("[email protected]:5.4", when="@1.27", type=("build", "run"))
depends_on("[email protected]:5.2", when="@1.16", type=("build", "run"))

depends_on("[email protected]:4.7", when="@1.27", type=("build", "run"))
depends_on("[email protected]:4.7", when="@1.27:", type=("build", "run"))
depends_on("[email protected]:3.5.0", when="@1.16", type=("build", "run"))

depends_on("[email protected]:0.6", when="@1.27", type=("build", "run"))
depends_on("[email protected]:0.6", when="@1.27:", type=("build", "run"))
depends_on("[email protected]:0.2", when="@1.16", type=("build", "run"))
2 changes: 1 addition & 1 deletion var/spack/repos/builtin/packages/bufr/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _setup_bufr_environment(self, env, suffix):
lib = find_libraries(libname + append, root=self.prefix, shared=shared, recursive=True)
lib_envname = "BUFR_LIB{0}".format(suffix) + append
inc_envname = "BUFR_INC{0}".format(suffix) + append
include_dir = "include_{0}".format(suffix)
include_dir = "{0}_{1}".format(self.prefix.include.bufr, suffix)

env.set(lib_envname, lib[0])
env.set(inc_envname, include_dir)
Expand Down
1 change: 1 addition & 0 deletions var/spack/repos/builtin/packages/eckit/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Eckit(CMakePackage):

maintainers("skosukhin", "climbfuji")

version("1.24.4", sha256="b6129eb4f7b8532aa6905033e4cf7d09aadc8547c225780fea3db196e34e4671")
version("1.23.1", sha256="cd3c4b7a3a2de0f4a59f00f7bab3178dd59c0e27900d48eaeb357975e8ce2f15")
version("1.23.0", sha256="3cac55ddf7036ecd32cb0974a1ec3a2d347de574ab3a2c0bb6c6f8982e5a7a09")
version("1.22.1", sha256="a3463d07e47e3bd3e5efa13fdc03d7d3a30ada919ccec3259c6c9c7da4cfdfd9")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/cmake/atlas_compile_flags.cmake 2023-07-10 04:13:02.000000000 -0600
+++ b/cmake/atlas_compile_flags.cmake 2023-08-21 14:29:10.000000000 -0600
@@ -21,6 +21,8 @@

endif()

+ecbuild_add_cxx_flags("-fp-speculation=safe")
+
if( CMAKE_CXX_COMPILER_ID MATCHES NVHPC )
ecbuild_add_cxx_flags("--diag_suppress declared_but_not_referenced --display_error_number" NAME atlas_cxx_disable_warnings )
# For all the variables with side effects (constructor/dectructor functionality)
21 changes: 13 additions & 8 deletions var/spack/repos/builtin/packages/ecmwf-atlas/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@ class EcmwfAtlas(CMakePackage):

version("master", branch="master")
version("develop", branch="develop")
version("0.34.0", sha256="48536742cec0bc268695240843ac0e232e2b5142d06b19365688d9ea44dbd9ba")
version("0.33.0", sha256="a91fffe9cecb51c6ee8549cbc20f8279e7b1f67dd90448e6c04c1889281b0600")
version("0.32.1", sha256="3d1a46cb7f50e1a6ae9e7627c158760e132cc9f568152358e5f78460f1aaf01b")
version("0.31.1", sha256="fa9274c74c40c2115b9c6120a7040e357b0c7f37b20b601b684d2a83a479cdfb")
version("0.31.0", sha256="fa4ff8665544b8e19f79d171c540a9ca8bfc4127f52a3c4d4d618a2fe23354d7")

depends_on("ecbuild", type=("build"))
depends_on("eckit")
depends_on("boost cxxstd=14 visibility=hidden", when="@0.26.0:", type=("build", "run"))
depends_on("eckit@:1.23", when="@:0.33")
depends_on("[email protected]:", when="@0.34:")
depends_on("boost cxxstd=14 visibility=hidden", when="@0.26.0:0.33.99", type=("build", "run"))
depends_on("boost cxxstd=17 visibility=hidden", when="@0.34.0:", type=("build", "run"))
variant("fckit", default=True)
depends_on("fckit", when="+fckit")
depends_on("fckit@:0.10", when="@:0.33 +fckit")
depends_on("[email protected]:", when="@0.34: +fckit")
depends_on("python")

patch("clang_include_array.patch", when="%apple-clang")
patch("clang_include_array.patch", when="%clang")
patch("intel_vectorization.patch", when="%intel")
patch("intel_vectorization_v0p33.patch", when="@:0.33 %intel")
patch("intel_vectorization_v0p34.patch", when="@0.34: %intel")

variant(
"build_type",
Expand All @@ -43,7 +48,7 @@ class EcmwfAtlas(CMakePackage):
values=("Debug", "Release", "RelWithDebInfo"),
)

variant('openmp', default=True, description='Use OpenMP?')
variant("openmp", default=True, description="Use OpenMP?")
depends_on("llvm-openmp", when="+openmp %apple-clang", type=("build", "run"))
variant("shared", default=True)

Expand All @@ -61,7 +66,7 @@ class EcmwfAtlas(CMakePackage):

def cmake_args(self):
args = [
self.define_from_variant('ENABLE_OMP', 'openmp'),
self.define_from_variant("ENABLE_OMP", "openmp"),
self.define_from_variant("ENABLE_FCKIT", "fckit"),
self.define_from_variant("ENABLE_TRANS", "trans"),
self.define_from_variant("ENABLE_EIGEN", "eigen"),
Expand All @@ -74,8 +79,8 @@ def cmake_args(self):

@when("+fismahigh")
def patch(self):
filter_file("http://www\.ecmwf\.int", "", "cmake/atlas-import.cmake.in")
filter_file("int\.ecmwf", "", "cmake/atlas-import.cmake.in")
filter_file("http://www\.ecmwf\.int", "", "cmake/atlas-import.cmake.in") # noqa: W605
filter_file("int\.ecmwf", "", "cmake/atlas-import.cmake.in") # noqa: W605
filter_file('http[^"]+', "", "cmake/atlas_export.cmake")
patterns = [".travis.yml", "tools/install*.sh", "tools/github-sha.sh"]
for pattern in patterns:
Expand Down
8 changes: 7 additions & 1 deletion var/spack/repos/builtin/packages/esmf/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Esmf(MakefilePackage):
# Develop is a special name for spack and is always considered the newest version
version("develop", branch="develop")
# generate chksum with spack checksum [email protected]
version("8.5.0", sha256="acd0b2641587007cc3ca318427f47b9cae5bfd2da8d2a16ea778f637107c29c4")
version("8.4.2", sha256="969304efa518c7859567fa6e65efd960df2b4f6d72dbf2c3f29e39e4ab5ae594")
version("8.4.1", sha256="1b54cee91aacaa9df400bd284614cbb0257e175f6f3ec9977a2d991ed8aa1af6")
version(
Expand All @@ -42,7 +43,7 @@ class Esmf(MakefilePackage):
sha256="0ff43ede83d1ac6beabd3d5e2a646f7574174b28a48d1b9f2c318a054ba268fd",
deprecated=True,
)
version("8.3.0b09", commit="5b7e546c4b")
version("8.3.0b09", commit="5b7e546c4b", deprecated=True)
version("8.2.0", sha256="27866c31fdb63c58e78211de970470ca02d274f5d4d6d97e94284d63b1c1d9e4")
version("8.1.1", sha256="629690c7a488e84ac7252470349458d7aaa98b54c260f8b3911a2e2f3e713dd0")
version(
Expand Down Expand Up @@ -221,6 +222,11 @@ def setup_build_environment(self, env):
elif self.compiler.name == "intel" or self.compiler.name == "oneapi":
env.set("ESMF_COMPILER", "intel")
elif self.compiler.name in ["clang", "apple-clang"]:
# Turn off OpenMP with both versions of clang compilers
# to avoid having to add clang OpenMP libraries to the
# Fortran linker command.
env.set("ESMF_OPENMP", "OFF")
#
env.set("ESMF_COMPILER", "gfortranclang")
with self.compiler.compiler_environment():
gfortran_major_version = int(
Expand Down
Loading

0 comments on commit 6923f36

Please sign in to comment.