Skip to content

Commit

Permalink
Merge pull request #1259 from LLNL/task/white238/spack_package_update
Browse files Browse the repository at this point in the history
The Great Spack Package Merge of 2024
  • Loading branch information
white238 committed Jan 26, 2024
2 parents b89d583 + caa230b commit c5a3195
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .uberenv_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"package_final_phase": "initconfig",
"package_source_dir": "../..",
"spack_url": "https://github.com/spack/spack.git",
"spack_commit": "44f0708af424cb12dd05dd761de1cdae986ea5cf",
"spack_commit": "61421b3a67941f5c91239360b4d7d3ee5c3428df",
"spack_configs_path": "scripts/spack/configs",
"spack_packages_path": ["scripts/spack/radiuss-spack-configs/packages", "scripts/spack/packages"],
"spack_concretizer": "clingo",
Expand Down
11 changes: 11 additions & 0 deletions scripts/spack/configs/blueos_3_ppc64le_ib_p9/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ spack:
blas: [netlib-lapack]
lapack: [netlib-lapack]
mpi: [spectrum-mpi]
zlib-api: [zlib]

# LLNL blueos CUDA
cuda:
Expand Down Expand Up @@ -266,6 +267,16 @@ spack:
- spec: tar@1.26
prefix: /usr
buildable: false
unzip:
buildable: false
externals:
- spec: unzip@6.0
prefix: /usr
zlib:
buildable: false
externals:
- spec: zlib@1.2.7
prefix: /usr

# External dependencies for SCR
lsf:
Expand Down
129 changes: 75 additions & 54 deletions scripts/spack/packages/axom/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
Expand All @@ -10,6 +10,7 @@
from spack.package import *
from spack.util.executable import which_string


def get_spec_path(spec, package_name, path_replacements={}, use_bin=False):
"""Extracts the prefix path for the given spack package
path_replacements is a dictionary with string replacements for the path.
Expand All @@ -32,26 +33,28 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
"""Axom provides a robust, flexible software infrastructure for the development
of multi-physics applications and computational tools."""

maintainers = ["white238"]
maintainers("white238")

homepage = "https://github.com/LLNL/axom"
git = "https://github.com/LLNL/axom.git"
tags = ["radiuss"]

license("BSD-3-Clause")

version("main", branch="main")
version("develop", branch="develop")
version("0.8.1", tag="v0.8.1")
version("0.8.0", tag="v0.8.0")
version("0.7.0", tag="v0.7.0")
version("0.6.1", tag="v0.6.1")
version("0.6.0", tag="v0.6.0")
version("0.5.0", tag="v0.5.0")
version("0.4.0", tag="v0.4.0")
version("0.3.3", tag="v0.3.3")
version("0.3.2", tag="v0.3.2")
version("0.3.1", tag="v0.3.1")
version("0.3.0", tag="v0.3.0")
version("0.2.9", tag="v0.2.9")
version("0.8.1", tag="v0.8.1", commit="0da8a5b1be596887158ac2fcd321524ba5259e15")
version("0.8.0", tag="v0.8.0", commit="71fab3262eb7e1aa44a04c21d072b77f06362f7b")
version("0.7.0", tag="v0.7.0", commit="ea5158191181c137117ae37959879bdc8b107f35")
version("0.6.1", tag="v0.6.1", commit="ee240d3963d7879ae0e9c392902195bd7b04e37d")
version("0.6.0", tag="v0.6.0", commit="65287dc00bc7c271a08cb86c632f5909c30e3506")
version("0.5.0", tag="v0.5.0", commit="db137349b3e28617c3e0570dbd18e4a91654da98")
version("0.4.0", tag="v0.4.0", commit="38c0d7495ece35a30fca5f5b578b8f9d54346bd2")
version("0.3.3", tag="v0.3.3", commit="f0539ef0525469ffda054d86144f310c15b4f9e0")
version("0.3.2", tag="v0.3.2", commit="c446b496e20e6118b8cba7e80f1f84c76a49e463")
version("0.3.1", tag="v0.3.1", commit="cbefc0457a229d8acfb70622360d0667e90e50a2")
version("0.3.0", tag="v0.3.0", commit="20068ccab4b4f70055918b4f17960ec3ed6dbce8")
version("0.2.9", tag="v0.2.9", commit="9e9a54ede3326817c05f35922738516e43b5ec3d")

# https://github.com/spack/spack/issues/31829
patch("examples-oneapi.patch", when="@0.6.1 +examples %oneapi")
Expand Down Expand Up @@ -96,7 +99,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
# Dependencies
# -----------------------------------------------------------------------
# Basics
depends_on("cmake@3.14:", type="build", when="@:0.6.1")
depends_on("cmake@3.14:", type="build")
depends_on("cmake@3.18:", type="build", when="@0.7.0:")
depends_on("cmake@3.21:", type="build", when="+rocm")

Expand All @@ -123,23 +126,25 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
depends_on("umpire@6.0.0", when="@0.6.0")
depends_on("umpire@5:5.0.1", when="@:0.5.0")
depends_on("umpire +openmp", when="+openmp")
depends_on("umpire +cuda", when="+cuda")

with when("+raja"):
depends_on("raja@2022.03.0:", when="@0.7.0:")
depends_on("raja@0.14.0", when="@0.6.0")
depends_on("raja@:0.13.0", when="@:0.5.0")
depends_on("raja~openmp", when="~openmp")
depends_on("raja+openmp", when="+openmp")
depends_on("raja+cuda", when="+cuda")

for val in CudaPackage.cuda_arch_values:
depends_on("raja cuda_arch={0}".format(val), when="+raja cuda_arch={0}".format(val))
depends_on("umpire cuda_arch={0}".format(val), when="+umpire cuda_arch={0}".format(val))
raja_cuda = "raja +cuda cuda_arch={0}".format(val)
umpire_cuda = "umpire +cuda cuda_arch={0}".format(val)
depends_on(raja_cuda, when="+{0}".format(raja_cuda))
depends_on(umpire_cuda, when="+{0}".format(umpire_cuda))

for val in ROCmPackage.amdgpu_targets:
depends_on("raja amdgpu_target={0}".format(val), when="amdgpu_target={0}".format(val))
depends_on("umpire amdgpu_target={0}".format(val), when="amdgpu_target={0}".format(val))
raja_rocm = "raja +rocm amdgpu_target={0}".format(val)
umpire_rocm = "umpire +rocm amdgpu_target={0}".format(val)
depends_on(raja_rocm, when="+{0}".format(raja_rocm))
depends_on(umpire_rocm, when="+{0}".format(umpire_rocm))

depends_on("rocprim", when="+rocm")

Expand Down Expand Up @@ -174,6 +179,8 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
conflicts("+openmp", when="+rocm")
conflicts("+cuda", when="+rocm")

conflicts("^blt@:0.3.6", when="+rocm")

def flag_handler(self, name, flags):
if self.spec.satisfies("%cce") and name == "fflags":
flags.append("-ef")
Expand Down Expand Up @@ -217,7 +224,7 @@ def cache_name(self):

def initconfig_compiler_entries(self):
spec = self.spec
entries = super(Axom, self).initconfig_compiler_entries()
entries = super().initconfig_compiler_entries()

if "+fortran" in spec:
entries.append(cmake_cache_option("ENABLE_FORTRAN", True))
Expand All @@ -226,7 +233,7 @@ def initconfig_compiler_entries(self):
flags = ""
for _libpath in [libdir, libdir + "64"]:
if os.path.exists(_libpath):
if spec.satisfies('^cuda'):
if spec.satisfies("^cuda"):
flags += " -Xlinker -rpath -Xlinker {0}".format(_libpath)
else:
flags += " -Wl,-rpath,{0}".format(_libpath)
Expand All @@ -242,15 +249,14 @@ def initconfig_compiler_entries(self):
# Add optimization flag workaround for Debug builds with
# cray compiler or newer HIP
if "+rocm" in spec:
if "crayCC" in self.compiler.cxx or spec.satisfies("%clang@16"):
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG","-O1 -g -DNDEBUG"))

if spec.satisfies("%cce") or spec.satisfies("%clang@16"):
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-O1 -g -DNDEBUG"))

return entries

def initconfig_hardware_entries(self):
spec = self.spec
entries = super(Axom, self).initconfig_hardware_entries()
entries = super().initconfig_hardware_entries()

if "+cuda" in spec:
entries.append(cmake_cache_option("ENABLE_CUDA", True))
Expand All @@ -262,8 +268,8 @@ def initconfig_hardware_entries(self):
cudaflags = "-restrict --expt-extended-lambda "

# Pass through any cxxflags to the host compiler via nvcc's Xcompiler flag
host_cxx_flags = spec.compiler_flags['cxxflags']
cudaflags += ' '.join(['-Xcompiler=%s ' % flag for flag in host_cxx_flags])
host_cxx_flags = spec.compiler_flags["cxxflags"]
cudaflags += " ".join(["-Xcompiler=%s " % flag for flag in host_cxx_flags])

if not spec.satisfies("cuda_arch=none"):
cuda_arch = spec.variants["cuda_arch"].value[0]
Expand Down Expand Up @@ -293,12 +299,19 @@ def initconfig_hardware_entries(self):
rocm_root = hip_root + "/.."

# Fix blt_hip getting HIP_CLANG_INCLUDE_PATH-NOTFOUND bad include directory
if (self.spec.satisfies('%cce') or self.spec.satisfies('%clang')) and 'toss_4' in self._get_sys_type(spec):
# TODO: verify that this is still needed and is indeed specific to LC
if (
self.spec.satisfies("%cce") or self.spec.satisfies("%clang")
) and "toss_4" in self._get_sys_type(spec):
# Set the patch version to 0 if not already
clang_version= str(self.compiler.version)[:-1] + "0"
hip_clang_include_path = rocm_root + "/llvm/lib/clang/" + clang_version + "/include"
clang_version = str(self.compiler.version)[:-1] + "0"
hip_clang_include_path = (
rocm_root + "/llvm/lib/clang/" + clang_version + "/include"
)
if os.path.isdir(hip_clang_include_path):
entries.append(cmake_cache_path("HIP_CLANG_INCLUDE_PATH", hip_clang_include_path))
entries.append(
cmake_cache_path("HIP_CLANG_INCLUDE_PATH", hip_clang_include_path)
)

# Fixes for mpi for rocm until wrapper paths are fixed
# These flags are already part of the wrapped compilers on TOSS4 systems
Expand All @@ -311,8 +324,9 @@ def initconfig_hardware_entries(self):

# Remove extra link library for crayftn
if "+fortran" in spec and self.is_fortran_compiler("crayftn"):
entries.append(cmake_cache_string("BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE",
"unwind"))
entries.append(
cmake_cache_string("BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE", "unwind")
)

# Additional libraries for TOSS4
hip_link_flags += " -L{0}/../lib64 -Wl,-rpath,{0}/../lib64 ".format(hip_root)
Expand Down Expand Up @@ -359,18 +373,22 @@ def initconfig_hardware_entries(self):
)
)

if "+openmp" in spec and \
"clang" in self.compiler.cxx and \
"+fortran" in spec and self.is_fortran_compiler("xlf"):
openmp_gen_exp = ( "$<$<NOT:$<COMPILE_LANGUAGE:Fortran>>:"
"-fopenmp=libomp>;$<$<COMPILE_LANGUAGE:"
"Fortran>:-qsmp=omp>")
if (
"+openmp" in spec
and "clang" in self.compiler.cxx
and "+fortran" in spec
and self.is_fortran_compiler("xlf")
):
openmp_gen_exp = (
"$<$<NOT:$<COMPILE_LANGUAGE:Fortran>>:"
"-fopenmp=libomp>;$<$<COMPILE_LANGUAGE:"
"Fortran>:-qsmp=omp>"
)

description = "Different OpenMP linker flag between CXX and Fortran"
entries.append(cmake_cache_string(
"BLT_OPENMP_LINK_FLAGS",
openmp_gen_exp,
description))
entries.append(
cmake_cache_string("BLT_OPENMP_LINK_FLAGS", openmp_gen_exp, description)
)

if spec.satisfies("target=ppc64le:"):
# Fix for working around CMake adding implicit link directories
Expand All @@ -387,16 +405,15 @@ def initconfig_hardware_entries(self):
if _existing_paths:
entries.append(
cmake_cache_string(
"BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE",
";".join(_existing_paths),
"BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE", ";".join(_existing_paths)
)
)

return entries

def initconfig_mpi_entries(self):
spec = self.spec
entries = super(Axom, self).initconfig_mpi_entries()
entries = super().initconfig_mpi_entries()

if "+mpi" in spec:
entries.append(cmake_cache_option("ENABLE_MPI", True))
Expand All @@ -406,10 +423,14 @@ def initconfig_mpi_entries(self):
entries.append(cmake_cache_option("ENABLE_MPI", False))

# Replace /usr/bin/srun path with srun flux wrapper path on TOSS 4
if 'toss_4' in self._get_sys_type(spec):
# TODO: Remove this logic by adding `using_flux` case in
# spack/lib/spack/spack/build_systems/cached_cmake.py:196 and remove hard-coded
# path to srun in same file.
if "toss_4" in self._get_sys_type(spec):
srun_wrapper = which_string("srun")
mpi_exec_index = [index for index,entry in enumerate(entries)
if "MPIEXEC_EXECUTABLE" in entry]
mpi_exec_index = [
index for index, entry in enumerate(entries) if "MPIEXEC_EXECUTABLE" in entry
]
del entries[mpi_exec_index[0]]
entries.append(cmake_cache_path("MPIEXEC_EXECUTABLE", srun_wrapper))

Expand All @@ -418,7 +439,7 @@ def initconfig_mpi_entries(self):
def find_path_replacement(self, path1, path2, path_replacements, name, entries):
root = os.path.commonprefix([path1, path2])
if root.endswith(os.path.sep):
root = root[:-len(os.path.sep)]
root = root[: -len(os.path.sep)]
if root:
path_replacements[root] = "${" + name + "}"
entries.append(cmake_cache_path(name, root))
Expand All @@ -433,7 +454,7 @@ def initconfig_package_entries(self):
entries.append("# TPLs")
entries.append("#------------------{0}\n".format("-" * 60))

# Try to find the common prefix of the TPL directory.
# Try to find the common prefix of the TPL directory.
# If found, we will use this in the TPL paths
path1 = os.path.realpath(spec["conduit"].prefix)
path2 = os.path.realpath(self.prefix)
Expand Down Expand Up @@ -509,7 +530,7 @@ def initconfig_package_entries(self):

if spec.satisfies("^py-jsonschema"):
jsonschema_dir = get_spec_path(spec, "py-jsonschema", path_replacements, use_bin=True)
jsonschema_path = os.path.join(jsonschema_dir, 'jsonschema')
jsonschema_path = os.path.join(jsonschema_dir, "jsonschema")
entries.append(cmake_cache_path("JSONSCHEMA_EXECUTABLE", jsonschema_path))

enable_docs = spec.satisfies("^doxygen") or spec.satisfies("^py-sphinx")
Expand Down

0 comments on commit c5a3195

Please sign in to comment.