diff --git a/lib/spack/spack/build_systems/cached_cmake.py b/lib/spack/spack/build_systems/cached_cmake.py index ca9eae52b40400..e142d768277028 100644 --- a/lib/spack/spack/build_systems/cached_cmake.py +++ b/lib/spack/spack/build_systems/cached_cmake.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import collections.abc import os +import re from typing import Tuple import llnl.util.filesystem as fs @@ -15,6 +16,12 @@ from .cmake import CMakeBuilder, CMakePackage +def spec_uses_toolchain(spec): + gcc_toolchain_regex = re.compile(".*gcc-toolchain.*") + using_toolchain = list(filter(gcc_toolchain_regex.match, spec.compiler_flags["cxxflags"])) + return using_toolchain + + def cmake_cache_path(name, value, comment="", force=False): """Generate a string for a cmake cache variable""" force_str = " FORCE" if force else "" @@ -132,6 +139,11 @@ def initconfig_compiler_entries(self): "endif()\n", ] + # We defined hipcc as top-level compiler for packages when +rocm. + # This avoid problems coming from rocm flags being applied to another compiler. + if "+rocm" in spec: + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)) + flags = spec.compiler_flags # use global spack compiler flags @@ -213,7 +225,7 @@ def initconfig_mpi_entries(self): else: # starting with cmake 3.10, FindMPI expects MPIEXEC_EXECUTABLE # vs the older versions which expect MPIEXEC - if self.pkg.spec["cmake"].satisfies("@3.10:"): + if spec["cmake"].satisfies("@3.10:"): entries.append(cmake_cache_path("MPIEXEC_EXECUTABLE", mpiexec)) else: entries.append(cmake_cache_path("MPIEXEC", mpiexec)) @@ -248,12 +260,17 @@ def initconfig_hardware_entries(self): # Include the deprecated CUDA_TOOLKIT_ROOT_DIR for supporting BLT packages entries.append(cmake_cache_path("CUDA_TOOLKIT_ROOT_DIR", cudatoolkitdir)) - archs = spec.variants["cuda_arch"].value - if archs[0] != "none": - arch_str = ";".join(archs) - entries.append( - cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(arch_str)) - ) + # CUDA_FLAGS + cuda_flags = [] + + if not spec.satisfies("cuda_arch=none"): + cuda_archs = ";".join(spec.variants["cuda_arch"].value) + entries.append(cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", cuda_archs)) + + if spec_uses_toolchain(spec): + cuda_flags.append("-Xcompiler {}".format(spec_uses_toolchain(spec)[0])) + + entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", " ".join(cuda_flags))) if "+rocm" in spec: entries.append("#------------------{0}".format("-" * 30)) @@ -262,9 +279,6 @@ def initconfig_hardware_entries(self): # Explicitly setting HIP_ROOT_DIR may be a patch that is no longer necessary entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) - entries.append( - cmake_cache_path("HIP_CXX_COMPILER", "{0}".format(self.spec["hip"].hipcc)) - ) llvm_bin = spec["llvm-amdgpu"].prefix.bin llvm_prefix = spec["llvm-amdgpu"].prefix # Some ROCm systems seem to point to //rocm-/ and @@ -277,11 +291,9 @@ def initconfig_hardware_entries(self): archs = self.spec.variants["amdgpu_target"].value if archs[0] != "none": arch_str = ";".join(archs) - entries.append( - cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str)) - ) - entries.append(cmake_cache_string("AMDGPU_TARGETS", "{0}".format(arch_str))) - entries.append(cmake_cache_string("GPU_TARGETS", "{0}".format(arch_str))) + entries.append(cmake_cache_string("CMAKE_HIP_ARCHITECTURES", arch_str)) + entries.append(cmake_cache_string("AMDGPU_TARGETS", arch_str)) + entries.append(cmake_cache_string("GPU_TARGETS", arch_str)) return entries diff --git a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml index bf298d606db0ea..63feea65ffb232 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/data-vis-sdk/spack.yaml @@ -1,6 +1,8 @@ spack: view: false packages: + all: + require: target=x86_64_v3 cmake: variants: ~ownlibs ecp-data-vis-sdk: @@ -20,8 +22,6 @@ spack: require: '@14:' # Minimize LLVM variants: ~lldb~lld~libomptarget~polly~gold libunwind=none compiler-rt=none - all: - require: target=x86_64_v3 definitions: - paraview_specs: diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml index c8146cef60fd18..b8ef26faf5f905 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-rhel/spack.yaml @@ -81,7 +81,7 @@ spack: - boost +python +filesystem +iostreams +system - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit # - cp2k +mpi # libxsmm: ftn-78 ftn: ERROR in command linel; The -f option has an invalid argument, "tree-vectorize". diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml index c1a3135a272627..d4dadd8053e8ca 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-cray-sles/spack.yaml @@ -71,7 +71,7 @@ spack: - butterflypack - boost +python +filesystem +iostreams +system - cabana - - chai ~benchmarks ~tests + - chai - conduit # - cp2k +mpi # cp2k: Error: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/COMPLEX(4)). - datatransferkit diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse-v2/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse-v2/spack.yaml index 43042b09a9bcf9..bc6c00c7c79901 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse-v2/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse-v2/spack.yaml @@ -64,7 +64,7 @@ spack: - butterflypack - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit - cp2k +mpi @@ -214,7 +214,7 @@ spack: - arborx +cuda cuda_arch=75 ^kokkos +wrapper - cabana +cuda cuda_arch=75 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=75 - caliper +cuda cuda_arch=75 - - chai ~benchmarks ~tests +cuda cuda_arch=75 ^umpire ~shared + - chai +cuda cuda_arch=75 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=75 # cp2k: cp2k only supports cuda_arch ('35', '37', '60', '70', '80') - flecsi +cuda cuda_arch=75 - ginkgo +cuda cuda_arch=75 @@ -261,7 +261,7 @@ spack: - arborx +cuda cuda_arch=80 ^kokkos +wrapper - cabana +cuda cuda_arch=80 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=80 - caliper +cuda cuda_arch=80 - - chai ~benchmarks ~tests +cuda cuda_arch=80 ^umpire ~shared + - chai +cuda cuda_arch=80 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=80 # cp2k: Error: KeyError: 'Point environment variable LIBSMM_PATH to the absolute path of the libsmm.a file' - flecsi +cuda cuda_arch=80 - ginkgo +cuda cuda_arch=80 @@ -308,7 +308,7 @@ spack: - arborx +cuda cuda_arch=90 ^kokkos +wrapper - cabana +cuda cuda_arch=90 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=90 - caliper +cuda cuda_arch=90 - - chai ~benchmarks ~tests +cuda cuda_arch=90 ^umpire ~shared + - chai +cuda cuda_arch=90 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=90 # cp2k: cp2k only supports cuda_arch ('35', '37', '60', '70', '80') - flecsi +cuda cuda_arch=90 - ginkgo +cuda cuda_arch=90 diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse_v1/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse_v1/spack.yaml index c35860c4b5f711..1799e7e521b18b 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse_v1/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-neoverse_v1/spack.yaml @@ -64,13 +64,13 @@ spack: - butterflypack - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit - cp2k +mpi - datatransferkit - dyninst - - ecp-data-vis-sdk ~cuda ~rocm +adios2 +ascent +cinema +darshan +faodel +hdf5 +paraview +pnetcdf +sz +unifyfs +veloc ~visit +vtkm +zfp # +visit: ? + - ecp-data-vis-sdk ~cuda ~rocm +adios2 +ascent +cinema +darshan +faodel +hdf5 +paraview +pnetcdf +sz +unifyfs +veloc ~visit +vtkm +zfp # +visit: ? - exaworks - flecsi - flit @@ -214,7 +214,7 @@ spack: - arborx +cuda cuda_arch=75 ^kokkos +wrapper - cabana +cuda cuda_arch=75 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=75 - caliper +cuda cuda_arch=75 - - chai ~benchmarks ~tests +cuda cuda_arch=75 ^umpire ~shared + - chai +cuda cuda_arch=75 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=75 # cp2k: cp2k only supports cuda_arch ('35', '37', '60', '70', '80') - flecsi +cuda cuda_arch=75 - ginkgo +cuda cuda_arch=75 @@ -261,7 +261,7 @@ spack: - arborx +cuda cuda_arch=80 ^kokkos +wrapper - cabana +cuda cuda_arch=80 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=80 - caliper +cuda cuda_arch=80 - - chai ~benchmarks ~tests +cuda cuda_arch=80 ^umpire ~shared + - chai +cuda cuda_arch=80 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=80 # cp2k: Error: KeyError: 'Point environment variable LIBSMM_PATH to the absolute path of the libsmm.a file' - flecsi +cuda cuda_arch=80 - ginkgo +cuda cuda_arch=80 @@ -308,7 +308,7 @@ spack: - arborx +cuda cuda_arch=90 ^kokkos +wrapper - cabana +cuda cuda_arch=90 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=90 - caliper +cuda cuda_arch=90 - - chai ~benchmarks ~tests +cuda cuda_arch=90 ^umpire ~shared + - chai +cuda cuda_arch=90 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=90 # cp2k: cp2k only supports cuda_arch ('35', '37', '60', '70', '80') - flecsi +cuda cuda_arch=90 - ginkgo +cuda cuda_arch=90 diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml index 7e236cd76d5c68..88dd07cccc7e79 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml @@ -76,7 +76,7 @@ spack: - butterflypack - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit # - cp2k +mpi # dbcsr diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml index bc08f000212ab2..5389de4d0d99de 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-power/spack.yaml @@ -65,7 +65,7 @@ spack: - butterflypack - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit - cp2k +mpi @@ -218,7 +218,7 @@ spack: - amrex +cuda cuda_arch=70 - arborx +cuda cuda_arch=70 ^kokkos +wrapper - caliper +cuda cuda_arch=70 - - chai ~benchmarks ~tests +cuda cuda_arch=70 ^umpire ~shared + - chai +cuda cuda_arch=70 ^umpire ~shared # - cp2k +mpi +cuda cuda_arch=70 # dbcsr - ecp-data-vis-sdk ~rocm +adios2 ~ascent +hdf5 +vtkm +zfp ~paraview +cuda cuda_arch=70 - exago +mpi +python +raja +hiop ~rocm +cuda cuda_arch=70 ~ipopt ^hiop@1.0.0 ~sparse +mpi +raja ~rocm +cuda cuda_arch=70 #^raja@0.14.0 diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml index e0e20b0afdffdc..c234339d8dc7ce 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml @@ -214,7 +214,7 @@ spack: - arborx +rocm amdgpu_target=gfx908 - cabana +rocm amdgpu_target=gfx908 - caliper +rocm amdgpu_target=gfx908 - - chai ~benchmarks +rocm amdgpu_target=gfx908 + - chai +rocm amdgpu_target=gfx908 # - cp2k +mpi +rocm amdgpu_target=gfx908 # cp2k: Error: KeyError: 'No spec with name rocm in... "-L{}".format(spec["rocm"].libs.directories[0]), - ecp-data-vis-sdk +paraview +vtkm +rocm amdgpu_target=gfx908 - exago +mpi +python +raja +hiop +rocm amdgpu_target=gfx908 ~ipopt cxxflags="-Wno-error=non-pod-varargs" ^hiop@1.0.0 ~sparse +mpi +raja +rocm amdgpu_target=gfx908 @@ -256,7 +256,7 @@ spack: - arborx +rocm amdgpu_target=gfx90a - cabana +rocm amdgpu_target=gfx90a - caliper +rocm amdgpu_target=gfx90a - - chai ~benchmarks +rocm amdgpu_target=gfx90a + - chai +rocm amdgpu_target=gfx90a # - cp2k +mpi +rocm amdgpu_target=gfx90a # cp2k: Error: KeyError: 'No spec with name rocm in... "-L{}".format(spec["rocm"].libs.directories[0]), - ecp-data-vis-sdk +paraview +vtkm +rocm amdgpu_target=gfx90a - exago +mpi +python +raja +hiop +rocm amdgpu_target=gfx90a ~ipopt cxxflags="-Wno-error=non-pod-varargs" ^hiop@1.0.0 ~sparse +mpi +raja +rocm amdgpu_target=gfx90a diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml index afd2058c9ad69c..bae0d73f5a2d7f 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml @@ -69,7 +69,7 @@ spack: - butterflypack - cabana - caliper - - chai ~benchmarks ~tests + - chai - charliecloud - conduit - cp2k +mpi @@ -78,7 +78,7 @@ spack: - drishti - dxt-explorer - dyninst - - ecp-data-vis-sdk ~cuda ~rocm +adios2 +ascent +cinema +darshan +faodel +hdf5 +paraview +pnetcdf +sz +unifyfs +veloc +visit +vtkm +zfp # adios2~cuda, ascent~cuda, darshan-runtime, darshan-util, faodel, hdf5, libcatalyst, parallel-netcdf, paraview~cuda, py-cinemasci, sz, unifyfs, veloc, visit, vtk-m, zfp + - ecp-data-vis-sdk ~cuda ~rocm +adios2 +ascent +cinema +darshan +faodel +hdf5 +paraview +pnetcdf +sz +unifyfs +veloc +visit +vtkm +zfp # adios2~cuda, ascent~cuda, darshan-runtime, darshan-util, faodel, hdf5, libcatalyst, parallel-netcdf, paraview~cuda, py-cinemasci, sz, unifyfs, veloc, visit, vtk-m, zfp - exaworks - flecsi - flit @@ -222,7 +222,7 @@ spack: # - arborx +cuda cuda_arch=80 ^kokkos +wrapper # - cabana +cuda cuda_arch=80 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=80 # - caliper +cuda cuda_arch=80 - # - chai ~benchmarks ~tests +cuda cuda_arch=80 ^umpire ~shared + # - chai +cuda cuda_arch=80 ^umpire ~shared # - cusz +cuda cuda_arch=80 # - dealii +cuda cuda_arch=80 # - ecp-data-vis-sdk ~rocm +adios2 ~ascent +hdf5 +vtkm +zfp +paraview +cuda cuda_arch=80 # +ascent fails because fides fetch error @@ -269,7 +269,7 @@ spack: # - arborx +cuda cuda_arch=90 ^kokkos +wrapper # - cabana +cuda cuda_arch=90 ^kokkos +wrapper +cuda_lambda +cuda cuda_arch=90 # - caliper +cuda cuda_arch=90 - # - chai ~benchmarks ~tests +cuda cuda_arch=90 ^umpire ~shared + # - chai +cuda cuda_arch=90 ^umpire ~shared # - cusz +cuda cuda_arch=90 # - flecsi +cuda cuda_arch=90 # - ginkgo +cuda cuda_arch=90 @@ -320,7 +320,7 @@ spack: # - arborx +rocm amdgpu_target=gfx908 # - cabana +rocm amdgpu_target=gfx908 # - caliper +rocm amdgpu_target=gfx908 - # - chai ~benchmarks +rocm amdgpu_target=gfx908 + # - chai +rocm amdgpu_target=gfx908 # - ecp-data-vis-sdk +paraview +vtkm +rocm amdgpu_target=gfx908 # - gasnet +rocm amdgpu_target=gfx908 # - ginkgo +rocm amdgpu_target=gfx908 @@ -361,7 +361,7 @@ spack: # - arborx +rocm amdgpu_target=gfx90a # - cabana +rocm amdgpu_target=gfx90a # - caliper +rocm amdgpu_target=gfx90a - # - chai ~benchmarks +rocm amdgpu_target=gfx90a + # - chai +rocm amdgpu_target=gfx90a # - ecp-data-vis-sdk +paraview +vtkm +rocm amdgpu_target=gfx90a # - gasnet +rocm amdgpu_target=gfx90a # - ginkgo +rocm amdgpu_target=gfx90a diff --git a/share/spack/gitlab/cloud_pipelines/stacks/radiuss/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/radiuss/spack.yaml index ca8e1a990519db..d40788b917d7af 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/radiuss/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/radiuss/spack.yaml @@ -18,7 +18,7 @@ spack: - blt - caliper #- care ## ~benchmarks ~examples ~tests - #- chai ## ~benchmarks ~examples ~tests + #- chai ## ~examples - conduit # ^hdf5+shared - flux-core #- flux-sched diff --git a/var/spack/repos/builtin/packages/ascent/package.py b/var/spack/repos/builtin/packages/ascent/package.py index 40e030494ca329..5fb06916f36b9a 100644 --- a/var/spack/repos/builtin/packages/ascent/package.py +++ b/var/spack/repos/builtin/packages/ascent/package.py @@ -185,7 +185,10 @@ class Ascent(CMakePackage, CudaPackage): # RAJA and Umpire ####################### depends_on("raja", when="+raja") + depends_on("raja+openmp", when="+raja +openmp") + depends_on("raja~openmp", when="+raja ~openmp") depends_on("umpire", when="+umpire") + depends_on("umpire@:2023.06.0", when="@:0.9.2 +umpire") ####################### # BabelFlow diff --git a/var/spack/repos/builtin/packages/axom/package.py b/var/spack/repos/builtin/packages/axom/package.py index 08eb175392633f..df30667dde964f 100644 --- a/var/spack/repos/builtin/packages/axom/package.py +++ b/var/spack/repos/builtin/packages/axom/package.py @@ -104,7 +104,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("cmake@3.21:", type="build", when="+rocm") depends_on("blt", type="build") - depends_on("blt@0.5.1:", type="build", when="@0.6.1:") + depends_on("blt@0.5.1:0.5.3", type="build", when="@0.6.1:") depends_on("mpi", when="+mpi") @@ -122,13 +122,13 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("scr~fortran", when="+scr~fortran") with when("+umpire"): - depends_on("umpire@2022.03.0:", when="@0.7.0:") + depends_on("umpire@2022.03.0:2023.06", when="@0.7.0:") 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") with when("+raja"): - depends_on("raja@2022.03.0:", when="@0.7.0:") + depends_on("raja@2022.03.0:2023.06", 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") diff --git a/var/spack/repos/builtin/packages/blt/package.py b/var/spack/repos/builtin/packages/blt/package.py index 6f56a68081ecc6..1e488b5f13f7f3 100644 --- a/var/spack/repos/builtin/packages/blt/package.py +++ b/var/spack/repos/builtin/packages/blt/package.py @@ -3,9 +3,57 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os +import re + from spack.package import * +def spec_uses_toolchain(spec): + gcc_toolchain_regex = re.compile(".*gcc-toolchain.*") + using_toolchain = list(filter(gcc_toolchain_regex.match, spec.compiler_flags["cxxflags"])) + return using_toolchain + + +def spec_uses_gccname(spec): + gcc_name_regex = re.compile(".*gcc-name.*") + using_gcc_name = list(filter(gcc_name_regex.match, spec.compiler_flags["cxxflags"])) + return using_gcc_name + + +def llnl_link_helpers(options, spec, compiler): + # From local package: + if compiler.fc: + fortran_compilers = ["gfortran", "xlf"] + if any(f_comp in compiler.fc for f_comp in fortran_compilers) and ( + "clang" in compiler.cxx + ): + # Pass fortran compiler lib as rpath to find missing libstdc++ + libdir = os.path.join(os.path.dirname(os.path.dirname(compiler.fc)), "lib") + flags = "" + for _libpath in [libdir, libdir + "64"]: + if os.path.exists(_libpath): + flags += " -Wl,-rpath,{0}".format(_libpath) + description = "Adds a missing libstdc++ rpath" + if flags: + options.append(cmake_cache_string("BLT_EXE_LINKER_FLAGS", flags, description)) + + if "cce" in compiler.cxx: + description = "Adds a missing rpath for libraries " "associated with the fortran compiler" + # Here is where to find libs that work for fortran + libdir = "/opt/cray/pe/cce/{0}/cce-clang/x86_64/lib".format(compiler.version) + linker_flags = "${{BLT_EXE_LINKER_FLAGS}} -Wl,-rpath,{0}".format(libdir) + + version = "{0}".format(compiler.version) + + if version == "16.0.0" or version == "16.0.1": + # Here is another directory added by cce@16.0.0 and cce@16.0.1 + libdir = os.path.join(libdir, "x86_64-unknown-linux-gnu") + linker_flags += " -Wl,-rpath,{0}".format(libdir) + + options.append(cmake_cache_string("BLT_EXE_LINKER_FLAGS", linker_flags, description)) + + class Blt(Package): """BLT is a streamlined CMake-based foundation for Building, Linking and Testing large-scale high performance computing (HPC) applications.""" diff --git a/var/spack/repos/builtin/packages/caliper/package.py b/var/spack/repos/builtin/packages/caliper/package.py index b0ed25dfe92689..f67980da126e93 100644 --- a/var/spack/repos/builtin/packages/caliper/package.py +++ b/var/spack/repos/builtin/packages/caliper/package.py @@ -78,7 +78,7 @@ class Caliper(CMakePackage, CudaPackage, ROCmPackage): is_linux = sys.platform.startswith("linux") variant("shared", default=True, description="Build shared libraries") variant("adiak", default=True, description="Enable Adiak support") - variant("mpi", default=True, description="Enable MPI wrappers") + variant("mpi", default=True, description="Enable MPI support") # libunwind has some issues on Mac variant( "libunwind", default=sys.platform != "darwin", description="Enable stack unwind support" @@ -94,6 +94,7 @@ class Caliper(CMakePackage, CudaPackage, ROCmPackage): variant("fortran", default=False, description="Enable Fortran support") variant("variorum", default=False, description="Enable Variorum support") variant("kokkos", default=True, when="@2.3.0:", description="Enable Kokkos profiling support") + variant("tests", default=False, description="Enable tests") depends_on("adiak@0.1:0", when="@2.2: +adiak") diff --git a/var/spack/repos/builtin/packages/camp/package.py b/var/spack/repos/builtin/packages/camp/package.py index c6c262cf91c7c1..1bea45b34c37c2 100644 --- a/var/spack/repos/builtin/packages/camp/package.py +++ b/var/spack/repos/builtin/packages/camp/package.py @@ -3,29 +3,9 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import glob - from spack.package import * -def hip_repair_options(options, spec): - # there is only one dir like this, but the version component is unknown - options.append( - "-DHIP_CLANG_INCLUDE_PATH=" - + glob.glob("{}/lib/clang/*/include".format(spec["llvm-amdgpu"].prefix))[0] - ) - - -def hip_repair_cache(options, spec): - # there is only one dir like this, but the version component is unknown - options.append( - cmake_cache_path( - "HIP_CLANG_INCLUDE_PATH", - glob.glob("{}/lib/clang/*/include".format(spec["llvm-amdgpu"].prefix))[0], - ) - ) - - class Camp(CMakePackage, CudaPackage, ROCmPackage): """ Compiler agnostic metaprogramming library providing concepts, @@ -40,8 +20,21 @@ class Camp(CMakePackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") - version("main", branch="main", submodules="True") + version("main", branch="main", submodules=False) + version( + "2024.02.0", + tag="v2024.02.0", + commit="03c80a6c6ab4f97e76a52639563daec71435a277", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5", + submodules=False, + ) version("2022.10.1", sha256="2d12f1a46f5a6d01880fc075cfbd332e2cf296816a7c1aa12d4ee5644d386f02") + version("2022.10.0", sha256="3561c3ef00bbcb61fe3183c53d49b110e54910f47e7fc689ad9ccce57e55d6b8") version("2022.03.2", sha256="bc4aaeacfe8f2912e28f7a36fc731ab9e481bee15f2c6daf0cb208eed3f201eb") version("2022.03.0", sha256="e9090d5ee191ea3a8e36b47a8fe78f3ac95d51804f1d986d931e85b8f8dad721") version("0.3.0", sha256="129431a049ca5825443038ad5a37a86ba6d09b2618d5fe65d35f83136575afdb") @@ -51,12 +44,13 @@ class Camp(CMakePackage, CudaPackage, ROCmPackage): # TODO: figure out gtest dependency and then set this default True. variant("tests", default=False, description="Build tests") - variant("openmp", default=False, description="Build OpenMP support") + variant("openmp", default=False, description="Build with OpenMP support") depends_on("cub", when="+cuda") depends_on("blt", type="build") - depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:") + depends_on("blt@0.6.1:", type="build", when="@2024.02.0:") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2023.06.0") patch("libstdc++-13-missing-header.patch", when="@:2022.10") @@ -69,11 +63,9 @@ def cmake_args(self): options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix)) - options.append("-DENABLE_OPENMP=" + ("On" if "+openmp" in spec else "Off")) + options.append(self.define_from_variant("ENABLE_CUDA", "cuda")) if "+cuda" in spec: - options.extend( - ["-DENABLE_CUDA=ON", "-DCUDA_TOOLKIT_ROOT_DIR=%s" % (spec["cuda"].prefix)] - ) + options.append("-DCUDA_TOOLKIT_ROOT_DIR={0}".format(spec["cuda"].prefix)) if not spec.satisfies("cuda_arch=none"): cuda_arch = spec.variants["cuda_arch"].value @@ -81,21 +73,17 @@ def cmake_args(self): options.append("-DCUDA_ARCH=sm_{0}".format(cuda_arch[0])) flag = "-arch sm_{0}".format(cuda_arch[0]) options.append("-DCMAKE_CUDA_FLAGS:STRING={0}".format(flag)) - else: - options.append("-DENABLE_CUDA=OFF") + options.append(self.define_from_variant("ENABLE_HIP", "rocm")) if "+rocm" in spec: - options.extend(["-DENABLE_HIP=ON", "-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)]) - - hip_repair_options(options, spec) + options.append("-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)) archs = self.spec.variants["amdgpu_target"].value - if archs != "none": - arch_str = ",".join(archs) - options.append("-DHIP_HIPCC_FLAGS=--amdgpu-target={0}".format(arch_str)) - else: - options.append("-DENABLE_HIP=OFF") + options.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(archs)) + options.append("-DGPU_TARGETS={0}".format(archs)) + options.append("-DAMDGPU_TARGETS={0}".format(archs)) + options.append(self.define_from_variant("ENABLE_OPENMP", "openmp")) options.append(self.define_from_variant("ENABLE_TESTS", "tests")) return options diff --git a/var/spack/repos/builtin/packages/care/package.py b/var/spack/repos/builtin/packages/care/package.py index 01b11ed3ac0e97..1b45dc1ed6db36 100644 --- a/var/spack/repos/builtin/packages/care/package.py +++ b/var/spack/repos/builtin/packages/care/package.py @@ -45,7 +45,7 @@ class Care(CMakePackage, CudaPackage, ROCmPackage): depends_on("camp") depends_on("umpire@develop") depends_on("raja@develop") - depends_on("chai@develop+enable_pick~benchmarks") + depends_on("chai@develop+enable_pick") # WARNING: this package currently only supports an internal cub # package. This will cause a race condition if compiled with another diff --git a/var/spack/repos/builtin/packages/chai/change_mpi_target_name_umpire_patch.patch b/var/spack/repos/builtin/packages/chai/change_mpi_target_name_umpire_patch.patch new file mode 100644 index 00000000000000..ca866408aa54a1 --- /dev/null +++ b/var/spack/repos/builtin/packages/chai/change_mpi_target_name_umpire_patch.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/thirdparty/SetupChaiThirdparty.cmake b/cmake/thirdparty/SetupChaiThirdparty.cmake +index d0be864..a8b33f0 100644 +--- a/cmake/thirdparty/SetupChaiThirdparty.cmake ++++ b/cmake/thirdparty/SetupChaiThirdparty.cmake +@@ -12,7 +12,7 @@ if (NOT TARGET umpire) + find_package(umpire REQUIRED) + + if (ENABLE_MPI) +- set(UMPIRE_DEPENDS mpi) ++ set(UMPIRE_DEPENDS MPI::MPI_CXX) + else() + set(UMPIRE_DEPENDS) + endif() diff --git a/var/spack/repos/builtin/packages/chai/package.py b/var/spack/repos/builtin/packages/chai/package.py index 2c07aee32cd698..724ccf124d5324 100644 --- a/var/spack/repos/builtin/packages/chai/package.py +++ b/var/spack/repos/builtin/packages/chai/package.py @@ -7,6 +7,8 @@ from spack.package import * +from .blt import llnl_link_helpers + class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): """ @@ -22,7 +24,24 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") version("develop", branch="develop", submodules=False) - version("main", branch="main", submodules=False) + version( + "2024.02.0", + tag="v2024.02.0", + commit="31773a2f0d30f3f64c82939f60fc4da32cf33261", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="6fe3470ad020303530af2f3dbbfe18826bd3319b", + submodules=False, + ) + version( + "2022.10.0", + tag="v2022.10.0", + commit="9510efd33b06e4443b15447eebb7dad761822654", + submodules=False, + ) version( "2022.03.0", tag="v2022.03.0", @@ -61,6 +80,10 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): ) version("1.0", tag="v1.0", commit="501a098ad879dc8deb4a74fcfe8c08c283a10627", submodules=True) + # Patching Umpire for dual BLT targets import changed MPI target name in Umpire link interface + # We propagate the patch here. + patch("change_mpi_target_name_umpire_patch.patch", when="@2022.10.0:2023.06.0") + variant("enable_pick", default=False, description="Enable pick method") variant( "separable_compilation", @@ -68,29 +91,43 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): description="Build with CUDA_SEPARABLE_COMPILATION flag on ", ) variant("shared", default=True, description="Build Shared Libs") + variant("mpi", default=False, description="Enable MPI support") variant("raja", default=False, description="Build plugin for RAJA") - variant("benchmarks", default=False, description="Build benchmarks.") variant("examples", default=True, description="Build examples.") variant("openmp", default=False, description="Build using OpenMP") # TODO: figure out gtest dependency and then set this default True # and remove the +tests conflict below. - variant("tests", default=False, description="Build tests") + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) depends_on("cmake@3.8:", type="build") depends_on("cmake@3.9:", type="build", when="+cuda") - depends_on("cmake@3.14:", when="@2022.03.0:") + depends_on("cmake@3.14:", type="build", when="@2022.03.0:") - depends_on("blt@0.5.0:", type="build", when="@2022.03.0:") - depends_on("blt@0.4.1:", type="build", when="@2.4.0:") - depends_on("blt@0.4.0:", type="build", when="@2.3.0") - depends_on("blt@0.3.6:", type="build", when="@:2.2.2") + depends_on("blt") + depends_on("blt@0.6.1:", type="build", when="@2024.02.0:") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0") + depends_on("blt@0.4.1:0.5.3", type="build", when="@2.4.0") + depends_on("blt@0.4.0:0.5.3", type="build", when="@2.3.0") + depends_on("blt@0.3.6:0.5.3", type="build", when="@:2.2.2") conflicts("^blt@:0.3.6", when="+rocm") depends_on("umpire") - depends_on("umpire@2022.03.0:", when="@2022.03.0:") + depends_on("umpire@2024.02.0:", when="@2024.02.0:") + depends_on("umpire@2023.06.0", when="@2023.06.0") + depends_on("umpire@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("umpire@2022.03.0:2023.06.0", when="@2022.03.0") depends_on("umpire@6.0.0", when="@2.4.0") depends_on("umpire@4.1.2", when="@2.2.0:2.3.0") - depends_on("umpire@main", when="@main") + + depends_on("umpire+mpi", when="+mpi") with when("+cuda"): depends_on("umpire+cuda") @@ -107,11 +144,13 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): with when("+raja"): depends_on("raja~openmp", when="~openmp") depends_on("raja+openmp", when="+openmp") - depends_on("raja@0.14.0", when="@2.4.0") - depends_on("raja@0.13.0", when="@2.3.0") + depends_on("raja@2024.02.0:", when="@2024.02.0:") + depends_on("raja@2023.06.0", when="@2023.06.0") + depends_on("raja@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("raja@2022.03.0:2023.06.0", when="@2022.03.0") depends_on("raja@0.12.0", when="@2.2.0:2.2.2") - depends_on("raja@2022.03.0:", when="@2022.03.0:") - depends_on("raja@main", when="@main") + depends_on("raja@0.13.0", when="@2.3.0") + depends_on("raja@0.14.0", when="@2.4.0") with when("+cuda"): depends_on("raja+cuda") @@ -125,7 +164,7 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): when="amdgpu_target={0}".format(arch), ) - conflicts("+benchmarks", when="~tests") + depends_on("mpi", when="+mpi") def _get_sys_type(self, spec): sys_type = spec.architecture @@ -138,25 +177,31 @@ def cache_name(self): hostname = socket.gethostname() if "SYS_TYPE" in env: hostname = hostname.rstrip("1234567890") - return "{0}-{1}-{2}@{3}.cmake".format( + return "{0}-{1}-{2}@{3}-{4}.cmake".format( hostname, self._get_sys_type(self.spec), self.spec.compiler.name, self.spec.compiler.version, + self.spec.dag_hash(8), ) def initconfig_compiler_entries(self): spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: entries = super().initconfig_compiler_entries() - if "+rocm" in spec: - entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + llnl_link_helpers(entries, spec, compiler) + return entries def initconfig_hardware_entries(self): spec = self.spec entries = super().initconfig_hardware_entries() - entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) if "+cuda" in spec: entries.append(cmake_cache_option("ENABLE_CUDA", True)) @@ -164,54 +209,67 @@ def initconfig_hardware_entries(self): entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True)) entries.append(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) - if not spec.satisfies("cuda_arch=none"): - cuda_arch = spec.variants["cuda_arch"].value - entries.append(cmake_cache_string("CUDA_ARCH", "sm_{0}".format(cuda_arch[0]))) - entries.append( - cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(cuda_arch[0])) - ) - flag = "-arch sm_{0}".format(cuda_arch[0]) - entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", "{0}".format(flag))) else: entries.append(cmake_cache_option("ENABLE_CUDA", False)) if "+rocm" in spec: entries.append(cmake_cache_option("ENABLE_HIP", True)) - entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) - archs = self.spec.variants["amdgpu_target"].value - if archs != "none": - arch_str = ",".join(archs) - entries.append( - cmake_cache_string("HIP_HIPCC_FLAGS", "--amdgpu-target={0}".format(arch_str)) - ) else: entries.append(cmake_cache_option("ENABLE_HIP", False)) return entries + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super(Chai, self).initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", "+mpi" in spec)) + + return entries + def initconfig_package_entries(self): spec = self.spec entries = [] option_prefix = "CHAI_" if spec.satisfies("@2022.03.0:") else "" + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) if "+raja" in spec: entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), True)) entries.append(cmake_cache_path("RAJA_DIR", spec["raja"].prefix)) + entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + # Build options + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + + # Generic options that have a prefixed equivalent in CHAI CMake + entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", "+examples" in spec)) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if "tests=benchmarks" in spec: + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_TESTS", "tests=none" not in spec)) + + # Prefixed options that used to be name without one entries.append( cmake_cache_option("{}ENABLE_PICK".format(option_prefix), "+enable_pick" in spec) ) - entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix.share.umpire.cmake)) - entries.append(cmake_cache_option("ENABLE_TESTS", "+tests" in spec)) - entries.append(cmake_cache_option("ENABLE_BENCHMARKS", "+benchmarks" in spec)) - entries.append( - cmake_cache_option("{}ENABLE_EXAMPLES".format(option_prefix), "+examples" in spec) - ) - entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) return entries def cmake_args(self): - options = [] - return options + return [] diff --git a/var/spack/repos/builtin/packages/dray/package.py b/var/spack/repos/builtin/packages/dray/package.py index e7567908be2e63..4986e640263f6c 100644 --- a/var/spack/repos/builtin/packages/dray/package.py +++ b/var/spack/repos/builtin/packages/dray/package.py @@ -81,9 +81,10 @@ class Dray(Package, CudaPackage): depends_on("apcomp~shared", when="~shared") depends_on("apcomp+shared", when="+shared") - depends_on("raja@0.12.0:") + depends_on("raja@0.14.0:0.14", when="@0.1.8:") depends_on("raja@:0.14", when="@0.1.7:") depends_on("raja@:0.13", when="@:0.1.6") + depends_on("raja@0.12.0:") depends_on("raja~cuda", when="~cuda") depends_on("raja+cuda", when="+cuda") propagate_cuda_arch("raja") diff --git a/var/spack/repos/builtin/packages/exago/package.py b/var/spack/repos/builtin/packages/exago/package.py index 796138b4c5e0fd..808e286574c4ac 100644 --- a/var/spack/repos/builtin/packages/exago/package.py +++ b/var/spack/repos/builtin/packages/exago/package.py @@ -156,7 +156,7 @@ class Exago(CMakePackage, CudaPackage, ROCmPackage): # This is duplicated from HiOp # RAJA > 0.14 and Umpire > 6.0 require c++ std 14 # We are working on supporting newer Umpire/RAJA versions - depends_on("raja@0.14.0:0.14", when="@1.1.0:+raja") + depends_on("raja@0.14.0:0.14 +shared", when="@1.1.0:+raja") depends_on("umpire@6.0.0:6", when="@1.1.0:+raja") depends_on("camp@0.2.3:0.2", when="@1.1.0:+raja") # This is no longer a requirement in RAJA > 0.14 diff --git a/var/spack/repos/builtin/packages/fmt/fmt-no-variable-initialize_10.0.0.patch b/var/spack/repos/builtin/packages/fmt/fmt-no-variable-initialize_10.0.0.patch new file mode 100644 index 00000000000000..483f2ff676d16c --- /dev/null +++ b/var/spack/repos/builtin/packages/fmt/fmt-no-variable-initialize_10.0.0.patch @@ -0,0 +1,22 @@ +diff --git a/include/fmt/format.h b/include/fmt/format.h +index 7637c8a0..c9d7b6cc 100644 +--- a/include/fmt/format.h ++++ b/include/fmt/format.h +@@ -1332,7 +1332,7 @@ template format_decimal_result { + // Buffer is large enough to hold all digits (digits10 + 1). +- Char buffer[digits10() + 1] = {}; ++ Char buffer[digits10() + 1]; + auto end = format_decimal(buffer, value, size).end; + return {out, detail::copy_str_noinline(buffer, end, out)}; + } +@@ -1359,7 +1359,7 @@ FMT_CONSTEXPR inline auto format_uint(It out, UInt value, int num_digits, + return out; + } + // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). +- char buffer[num_bits() / BASE_BITS + 1] = {}; ++ char buffer[num_bits() / BASE_BITS + 1]; + format_uint(buffer, value, num_digits, upper); + return detail::copy_str_noinline(buffer, buffer + num_digits, out); + } diff --git a/var/spack/repos/builtin/packages/fmt/package.py b/var/spack/repos/builtin/packages/fmt/package.py index e129d0e84f4473..eadbb0ac5a6f8c 100644 --- a/var/spack/repos/builtin/packages/fmt/package.py +++ b/var/spack/repos/builtin/packages/fmt/package.py @@ -94,6 +94,14 @@ class Fmt(CMakePackage): when="@10.0.0:10.1.1", ) + # Fix 'variable "buffer" may not be initialized' compiler error + patch( + "fmt-no-variable-initialize_10.0.0.patch", when="@10.0.0:10.2.1%clang@12.0.1.ibm.gcc.8.3.1" + ) + patch( + "fmt-no-variable-initialize_10.0.0.patch", when="@10.0.0:10.2.1%clang@14.0.5.ibm.gcc.8.3.1" + ) + def cmake_args(self): spec = self.spec args = [] diff --git a/var/spack/repos/builtin/packages/raja/package.py b/var/spack/repos/builtin/packages/raja/package.py index 07428c50cea7b3..f2cd52bcb6368e 100644 --- a/var/spack/repos/builtin/packages/raja/package.py +++ b/var/spack/repos/builtin/packages/raja/package.py @@ -6,13 +6,23 @@ import socket from spack.package import * -from spack.pkg.builtin.camp import hip_repair_cache + +from .blt import llnl_link_helpers + + +# Starting with 2022.03.0, the only submodule we want to fetch is tpl/desul +# since there is no package for it. Other RAJA submodules are defined as +# dependencies. +def submodules(package): + submodules = [] + submodules.append("tpl/desul") + return submodules class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): """RAJA Parallel Framework.""" - homepage = "https://software.llnl.gov/RAJA/" + homepage = "https://github.com/LLNL/RAJA" git = "https://github.com/LLNL/RAJA.git" tags = ["radiuss", "e4s"] @@ -20,19 +30,43 @@ class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") - version("develop", branch="develop", submodules=False) - version("main", branch="main", submodules=False) + version("develop", branch="develop", submodules=submodules) + version("main", branch="main", submodules=submodules) + version( + "2024.02.0", + tag="v2024.02.0", + commit="82d1b926ada0fbb15a4a6e0adadc30c715cfda7b", + submodules=submodules, + ) + version( + "2023.06.1", + tag="v2023.06.1", + commit="9b5f61edf3aa1e6fdbc9a4b30828c81504639963", + submodules=submodules, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="e330b2560747d5417cd7bd265fab3fb91d32ecbd", + submodules=submodules, + ) + version( + "2022.10.5", + tag="v2022.10.5", + commit="3774f51339459bbbdb77055aa23f82919b6335b6", + submodules=submodules, + ) version( "2022.10.4", tag="v2022.10.4", commit="c2a6b1740759ae3ae7c85b35e20dbffbe235355d", - submodules=False, + submodules=submodules, ) version( "2022.03.0", tag="v2022.03.0", commit="4351fe6a50bd579511a625b017c9e054885e7fd2", - submodules=False, + submodules=submodules, ) version( "0.14.0", @@ -122,8 +156,14 @@ class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): when="^hip@6.0", ) - variant("openmp", default=True, description="Build OpenMP backend") - variant("shared", default=True, description="Build Shared Libs") + variant("openmp", default=False, description="Build OpenMP backend") + variant("shared", default=False, description="Build shared libs") + variant("desul", default=False, description="Build desul atomics backend") + variant("vectorization", default=False, description="Build SIMD/SIMT intrinsics support") + variant( + "omptask", default=False, description="Build OpenMP task variants of internal algorithms" + ) + variant("plugins", default=False, description="Enable runtime plugins") variant("examples", default=True, description="Build examples.") variant("exercises", default=True, description="Build exercises.") @@ -131,24 +171,40 @@ class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): # and remove the +tests conflict below. variant("tests", default=False, description="Build tests") + # we don’t use variants to express the failing test, we only add a variant to + # define whether we want to run all the tests (including those known to fail) + # or only the passing ones. + variant( + "run-all-tests", + default=False, + description="Run all the tests, including those known to fail.", + ) + depends_on("blt", type="build") + depends_on("blt@0.6.1:", type="build", when="@2024.02.0:") + depends_on("blt@0.5.3", type="build", when="@2023.06.0:2023.06.1") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.5") depends_on("blt@0.5.0:0.5.3", type="build", when="@0.14.1:2022.10.4") depends_on("blt@0.4.1", type="build", when="@0.14.0") - depends_on("blt@0.4.0:", type="build", when="@0.13.0") - depends_on("blt@0.3.6:", type="build", when="@:0.12.0") + depends_on("blt@0.4.0:0.4.1", type="build", when="@0.13.0") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:0.12.0") conflicts("^blt@:0.3.6", when="+rocm") + depends_on("camp+openmp", when="+openmp") + depends_on("camp@main", when="@develop") + depends_on("camp@main", when="@main") + depends_on("camp@2024.02.0:", type="build", when="@2024.02.0:") + depends_on("camp@2023.06.0", type="build", when="@2023.06.0:2023.06.1") + depends_on("camp@2022.10.1:2023.06.0", type="build", when="@2022.10.3:2022.10.5") + depends_on("camp@2022.10.0:2023.06.0", type="build", when="@2022.10.0:2022.10.2") + depends_on("camp@2022.03.2", type="build", when="@2022.03.0:2022.03.1") depends_on("camp@0.2.2:0.2.3", when="@0.14.0") depends_on("camp@0.1.0", when="@0.10.0:0.13.0") - depends_on("camp@2022.03.2:2022.03", when="@2022.03.0:2022.03") - depends_on("camp@2022.10:", when="@2022.10:") - depends_on("camp@main", when="@main") - depends_on("camp@main", when="@develop") - depends_on("camp+openmp", when="+openmp") - depends_on("cmake@:3.20", when="@:2022.03+rocm", type="build") - depends_on("cmake@3.23:", when="@2022.10:+rocm", type="build") + depends_on("cmake@3.23:", when="@2022.10.0:+rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:", type="build") depends_on("cmake@3.14:", when="@2022.03.0:", type="build") + depends_on("cmake@:3.20", when="@:2022.03+rocm", type="build") depends_on("llvm-openmp", when="+openmp %apple-clang") @@ -159,7 +215,7 @@ class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on( "camp+rocm amdgpu_target={0}".format(arch), when="amdgpu_target={0}".format(arch) ) - conflicts("+openmp") + conflicts("+openmp", when="@:2022.03") with when("+cuda @0.12.0:"): depends_on("camp+cuda") @@ -182,49 +238,44 @@ def cache_name(self): hostname = socket.gethostname() if "SYS_TYPE" in env: hostname = hostname.rstrip("1234567890") - return "{0}-{1}-{2}@{3}.cmake".format( + return "{0}-{1}-{2}@{3}-{4}.cmake".format( hostname, self._get_sys_type(self.spec), self.spec.compiler.name, self.spec.compiler.version, + self.spec.dag_hash(8), ) def initconfig_compiler_entries(self): spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: entries = super().initconfig_compiler_entries() - if "+rocm" in spec: - entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + llnl_link_helpers(entries, spec, compiler) + return entries def initconfig_hardware_entries(self): spec = self.spec entries = super().initconfig_hardware_entries() + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) if "+cuda" in spec: entries.append(cmake_cache_option("ENABLE_CUDA", True)) - - if not spec.satisfies("cuda_arch=none"): - cuda_arch = spec.variants["cuda_arch"].value - entries.append(cmake_cache_string("CUDA_ARCH", "sm_{0}".format(cuda_arch[0]))) - entries.append( - cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(cuda_arch[0])) - ) else: entries.append(cmake_cache_option("ENABLE_CUDA", False)) if "+rocm" in spec: entries.append(cmake_cache_option("ENABLE_HIP", True)) - entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) - hip_repair_cache(entries, spec) hipcc_flags = [] - if self.spec.satisfies("@0.14.0"): + if self.spec.satisfies("@0.14.0:"): hipcc_flags.append("-std=c++14") - archs = self.spec.variants["amdgpu_target"].value - if archs != "none": - arch_str = ",".join(archs) - hipcc_flags.append("--amdgpu-target={0}".format(arch_str)) entries.append(cmake_cache_string("HIP_HIPCC_FLAGS", " ".join(hipcc_flags))) else: entries.append(cmake_cache_option("ENABLE_HIP", False)) @@ -237,11 +288,39 @@ def initconfig_package_entries(self): option_prefix = "RAJA_" if spec.satisfies("@0.14.0:") else "" + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) if "camp" in self.spec: entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + + entries.append(cmake_cache_option("RAJA_ENABLE_DESUL_ATOMICS", "+desul" in spec)) + + entries.append(cmake_cache_option("RAJA_ENABLE_VECTORIZATION", "+vectorization" in spec)) + + entries.append(cmake_cache_option("RAJA_ENABLE_OPENMP_TASK", "+omptask" in spec)) + + # C++14 + if spec.satisfies("@0.14.0:"): + entries.append(cmake_cache_string("BLT_CXX_STD", "c++14")) + + if "+desul" in spec: + if "+cuda" in spec: + entries.append(cmake_cache_string("CMAKE_CUDA_STANDARD", "14")) + entries.append(cmake_cache_option("RAJA_ENABLE_RUNTIME_PLUGINS", "+plugins" in spec)) + entries.append( cmake_cache_option("{}ENABLE_EXAMPLES".format(option_prefix), "+examples" in spec) ) @@ -254,19 +333,50 @@ def initconfig_package_entries(self): else: entries.append(cmake_cache_option("ENABLE_EXERCISES", "+exercises" in spec)) + # TODO: Treat the workaround when building tests with spack wrapper + # For now, removing it to test CI, which builds tests outside of wrapper. # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which # is used by the spack compiler wrapper. This can go away when BLT # removes -Werror from GTest flags - if self.spec.satisfies("%clang target=ppc64le:") or not self.run_tests: + # + # if self.spec.satisfies("%clang target=ppc64le:") + # or (not self.run_tests and "+tests" not in spec): + if not self.run_tests and "+tests" not in spec: entries.append(cmake_cache_option("ENABLE_TESTS", False)) else: entries.append(cmake_cache_option("ENABLE_TESTS", True)) + if "+run-all-tests" not in spec: + if spec.satisfies("%clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-OpenMP.exe;test-algorithm-stable-sort-OpenMP.exe", + ) + ) + excluded_tests = [ + "test-algorithm-sort-Cuda.exe", + "test-algorithm-stable-sort-Cuda.exe", + "test-algorithm-sort-OpenMP.exe", + "test-algorithm-stable-sort-OpenMP.exe", + ] + if spec.satisfies("+cuda %clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string("CTEST_CUSTOM_TESTS_IGNORE", ";".join(excluded_tests)) + ) + if spec.satisfies("+cuda %xl@16.1.1.12"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-Cuda.exe;test-algorithm-stable-sort-Cuda.exe", + ) + ) + + entries.append(cmake_cache_option("RAJA_HOST_CONFIG_LOADED", True)) return entries def cmake_args(self): - options = [] - return options + return [] @property def build_relpath(self): diff --git a/var/spack/repos/builtin/packages/umpire/dual_blt_import_umpire_2022.10_2023.06.patch b/var/spack/repos/builtin/packages/umpire/dual_blt_import_umpire_2022.10_2023.06.patch new file mode 100644 index 00000000000000..c8edc8012dfcfe --- /dev/null +++ b/var/spack/repos/builtin/packages/umpire/dual_blt_import_umpire_2022.10_2023.06.patch @@ -0,0 +1,106 @@ +diff --git a/cmake/SetupUmpireThirdParty.cmake b/cmake/SetupUmpireThirdParty.cmake +index fc351369..6e82ab6e 100644 +--- a/cmake/SetupUmpireThirdParty.cmake ++++ b/cmake/SetupUmpireThirdParty.cmake +@@ -80,29 +80,40 @@ if (UMPIRE_ENABLE_SQLITE_EXPERIMENTAL) + find_package(SQLite3 REQUIRED) + endif() + +-set(UMPIRE_NEEDS_BLT_TPLS False) +-if (UMPIRE_ENABLE_MPI OR UMPIRE_ENABLE_HIP OR UMPIRE_ENABLE_OPENMP OR UMPIRE_ENABLE_CUDA) +- set(UMPIRE_NEEDS_BLT_TPLS True) +- +- if (NOT BLT_EXPORTED) +- set(BLT_EXPORTED On CACHE BOOL "" FORCE) +- blt_import_library(NAME blt_stub EXPORTABLE On) +- set_target_properties(blt_stub PROPERTIES EXPORT_NAME blt::blt_stub) +- install(TARGETS blt_stub +- EXPORT bltTargets) +- blt_export_tpl_targets(EXPORT bltTargets NAMESPACE blt) +- install(EXPORT bltTargets +- DESTINATION lib/cmake/umpire) +- elseif (UMPIRE_ENABLE_MPI) ++ ++################################################# ++# use bonafide cmake targets for openmp and mpi ++################################################# ++set(umpire_mpi_deps "") ++if (UMPIRE_ENABLE_MPI) ++ if(ENABLE_FIND_MPI) ++ set (umpire_mpi_deps MPI::MPI_CXX) ++ endif() ++endif() ++ ++set(umpire_openmp_deps "") ++if (UMPIRE_ENABLE_OPENMP) ++ set (umpire_openmp_deps OpenMP::OpenMP_CXX) ++endif () ++ ++################################################# ++# export necessary blt targets ++################################################# ++ ++set(UMPIRE_BLT_TPL_DEPS_EXPORTS) ++ ++blt_list_append(TO UMPIRE_BLT_TPL_DEPS_EXPORTS ELEMENTS cuda cuda_runtime IF UMPIRE_ENABLE_CUDA) ++blt_list_append(TO UMPIRE_BLT_TPL_DEPS_EXPORTS ELEMENTS blt_hip blt_hip_runtime IF UMPIRE_ENABLE_HIP) ++ ++foreach(dep ${UMPIRE_BLT_TPL_DEPS_EXPORTS}) + # If the target is EXPORTABLE, add it to the export set +- get_target_property(_is_imported mpi IMPORTED) ++ get_target_property(_is_imported ${dep} IMPORTED) + if(NOT ${_is_imported}) +- install(TARGETS mpi +- EXPORT ${arg_EXPORT}) +- # Namespace target to avoid conflicts +- set_target_properties(mpi PROPERTIES EXPORT_NAME blt::mpi) +- install(EXPORT bltTargets +- DESTINATION lib/cmake/umpire) ++ install(TARGETS ${dep} ++ EXPORT umpire-targets ++ DESTINATION lib/cmake/umpire) ++ # Namespace target to avoid conflicts ++ set_target_properties(${dep} PROPERTIES EXPORT_NAME umpire::blt_tpl_exports_${dep}) + endif() +- endif() +-endif() ++endforeach() ++ +diff --git a/src/umpire/interface/c_fortran/CMakeLists.txt b/src/umpire/interface/c_fortran/CMakeLists.txt +index ab675adf..22e4dc90 100644 +--- a/src/umpire/interface/c_fortran/CMakeLists.txt ++++ b/src/umpire/interface/c_fortran/CMakeLists.txt +@@ -43,7 +43,7 @@ set_source_files_properties( + set(umpire_interface_c_fortran_depends camp umpire_util) + blt_list_append( TO umpire_interface_c_fortran_depends ELEMENTS cuda_runtime IF UMPIRE_ENABLE_CUDA ) +-blt_list_append( TO umpire_interface_c_fortran_depends ELEMENTS blt::hip_runtime IF UMPIRE_ENABLE_HIP ) +-blt_list_append( TO umpire_interface_c_fortran_depends ELEMENTS mpi IF UMPIRE_ENABLE_MPI ) ++blt_list_append( TO umpire_interface_c_fortran_depends ELEMENTS blt_hip_runtime IF UMPIRE_ENABLE_HIP ) ++blt_list_append( TO umpire_interface_c_fortran_depends ELEMENTS ${umpire_mpi_deps} IF UMPIRE_ENABLE_MPI ) + + blt_add_library( + NAME umpire_interface +diff --git a/src/umpire/util/CMakeLists.txt b/src/umpire/util/CMakeLists.txt +index 551f8188..02eb13e4 100644 +--- a/src/umpire/util/CMakeLists.txt ++++ b/src/umpire/util/CMakeLists.txt +@@ -73,14 +73,15 @@ endif() + + if (UMPIRE_ENABLE_MPI) + set (umpire_util_depends +- ${umpire_util_depends} +- mpi) ++ ${umpire_util_depends} ++ ${umpire_mpi_deps} ++ ) + endif () + + if (UMPIRE_ENABLE_OPENMP_TARGET) + set (umpire_util_depends +- ${umpire_util_depends} +- openmp) ++ ${umpire_util_depends} ++ ${umpire_openmp_deps}) + endif () + + if (UMPIRE_ENABLE_HIP) diff --git a/var/spack/repos/builtin/packages/umpire/export_includes.patch b/var/spack/repos/builtin/packages/umpire/export_includes.patch new file mode 100644 index 00000000000000..c5a56518ff502f --- /dev/null +++ b/var/spack/repos/builtin/packages/umpire/export_includes.patch @@ -0,0 +1,130 @@ +diff --git a/src/tpl/CMakeLists.txt b/src/tpl/CMakeLists.txt +index 6803f0a4..60269f88 100644 +--- a/src/tpl/CMakeLists.txt ++++ b/src/tpl/CMakeLists.txt +@@ -50,7 +50,13 @@ target_include_directories( + umpire_tpl_json + INTERFACE + $ +- $ ++ $) ++ ++blt_convert_to_system_includes(TARGET umpire_tpl_json) ++ ++target_include_directories( ++ umpire_tpl_json ++ INTERFACE + $) + + install(FILES +@@ -64,8 +70,6 @@ install(TARGETS + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +-blt_patch_target(NAME umpire_tpl_json +- TREAT_INCLUDES_AS_SYSTEM ON) + + # + # CLI11 Option Parsing Headers +@@ -82,7 +86,13 @@ target_include_directories( + umpire_tpl_CLI11 + INTERFACE + $ +- $ ++ $) ++ ++blt_convert_to_system_includes(TARGET umpire_tpl_CLI11) ++ ++target_include_directories( ++ umpire_tpl_CLI11 ++ INTERFACE + $) + + install(FILES +@@ -96,9 +106,6 @@ install(TARGETS + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +-blt_patch_target(NAME umpire_tpl_CLI11 +- TREAT_INCLUDES_AS_SYSTEM ON) +- + add_subdirectory(umpire/judy) + + if (NOT TARGET camp) +@@ -153,7 +160,14 @@ target_include_directories( + umpire_tpl_fmt + INTERFACE + $ +- $ ++ $) ++ ++# Avoid warnings from fmt (so we can still use -Werror) ++blt_convert_to_system_includes(TARGET umpire_tpl_fmt) ++ ++target_include_directories( ++ umpire_tpl_fmt ++ INTERFACE + $) + + if (C_COMPILER_FAMILY_IS_XL) +@@ -168,21 +182,17 @@ if (C_COMPILER_FAMILY_IS_PGI) + set(_fmt_warning_disable_flag + "--diag_suppress 1625;--diag_suppress 185;--diag_suppress 811;--diag_suppress 186") + +- if (ENABLE_FORTRAN) ++ if (ENABLE_FORTRAN) + target_compile_options(umpire_tpl_fmt + INTERFACE + $<$>:${_fmt_warning_disable_flag}>) +- else () +- target_compile_options(umpire_tpl_fmt +- INTERFACE +- ${_fmt_warning_disable_flag}) +- endif () ++ else () ++ target_compile_options(umpire_tpl_fmt ++ INTERFACE ++ ${_fmt_warning_disable_flag}) ++ endif () + endif () + +-# Avoid warnings from fmt (so we can still use -Werror) +-blt_patch_target(NAME umpire_tpl_fmt +- TREAT_INCLUDES_AS_SYSTEM ON) +- + if (C_COMPILER_FAMILY_IS_GNU) + target_compile_options(umpire_tpl_fmt + INTERFACE +diff --git a/src/umpire/interface/c_fortran/CMakeLists.txt b/src/umpire/interface/c_fortran/CMakeLists.txt +index cf0d6932..ab675adf 100644 +--- a/src/umpire/interface/c_fortran/CMakeLists.txt ++++ b/src/umpire/interface/c_fortran/CMakeLists.txt +@@ -57,15 +57,22 @@ target_include_directories( + PUBLIC + $ + $ +- $:${CMAKE_Fortran_MODULE_DIRECTORY}>> +- $:include/umpire>> # for Fortran module files + $) + + install(FILES + ${umpire_interface_c_fortran_headers} + DESTINATION include/umpire/interface/c_fortran) + +-install(DIRECTORY +- ${CMAKE_Fortran_MODULE_DIRECTORY}/ +- DESTINATION include/umpire +- FILES_MATCHING PATTERN "*.mod") ++if(UMPIRE_ENABLE_FORTRAN) ++ target_include_directories( ++ umpire_interface ++ PUBLIC ++ $ ++ $) ++ ++ install(DIRECTORY ++ ${CMAKE_Fortran_MODULE_DIRECTORY}/ ++ DESTINATION include/umpire ++ FILES_MATCHING PATTERN "*.mod") ++endif() ++ diff --git a/var/spack/repos/builtin/packages/umpire/package.py b/var/spack/repos/builtin/packages/umpire/package.py index 48ee22cf91c113..bd6915623f10b0 100644 --- a/var/spack/repos/builtin/packages/umpire/package.py +++ b/var/spack/repos/builtin/packages/umpire/package.py @@ -9,7 +9,8 @@ import llnl.util.tty as tty from spack.package import * -from spack.pkg.builtin.camp import hip_repair_cache + +from .blt import llnl_link_helpers class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): @@ -25,7 +26,18 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): license("MIT") version("develop", branch="develop", submodules=False) - version("main", branch="main", submodules=False) + version( + "2024.02.0", + tag="v2024.02.0", + commit="1db3fef913a70d8882ca510a4830c77c388873e0", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="1e5ef604de88e81bb3b6fc4a5d914be833529da5", + submodules=False, + ) version( "2022.10.0", tag="v2022.10.0", @@ -126,6 +138,11 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): "0.1.3", tag="v0.1.3", commit="cc347edeb17f5f30f694aa47f395d17369a2e449", submodules=True ) + # Some projects importing both camp and umpire targets end up with conflicts in BLT targets + # import. This is not addressing the root cause, which will be addressed in BLT@5.4.0 and will + # require adapting umpire build system. + patch("dual_blt_import_umpire_2022.10_2023.06.patch", when="@2022.10.0:2023.06.0") + patch("export_includes.patch", when="@2022.10.0") patch("std-filesystem-pr784.patch", when="@2022.03.1 +rocm ^blt@0.5.2:") patch("camp_target_umpire_3.0.0.patch", when="@3.0.0") patch("cmake_version_check.patch", when="@4.1") @@ -161,11 +178,19 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): variant("fortran", default=False, description="Build C/Fortran API") variant("c", default=True, description="Build C API") + variant("mpi", default=False, description="Enable MPI support") + variant("ipc_shmem", default=False, description="Enable POSIX shared memory") + variant( + "sqlite_experimental", + default=False, + description="Enable sqlite integration with umpire events (Experimental)", + ) variant("numa", default=False, description="Enable NUMA support") variant("shared", default=True, description="Enable Shared libs") variant("openmp", default=False, description="Build with OpenMP support") + variant("openmp_target", default=False, description="Build with OpenMP 4.5 support") variant("deviceconst", default=False, description="Enables support for constant device memory") - variant("examples", default=True, description="Build Umpire Examples") + variant("examples", default=False, description="Build Umpire Examples") variant( "tests", default="none", @@ -173,29 +198,48 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): multi=False, description="Tests to run", ) - variant("device_alloc", default=True, description="Build Umpire Device Allocator") - - depends_on("cmake@3.8:", type="build") - depends_on("cmake@3.9:", when="+cuda", type="build") + variant("tools", default=False, description="Enable tools") + variant("backtrace", default=False, description="Enable backtrace tools") + variant("dev_benchmarks", default=False, description="Enable developer benchmarks") + variant("device_alloc", default=False, description="Enable DeviceAllocator") + variant("werror", default=False, description="Enable warnings as errors") + variant("asan", default=False, description="Enable ASAN") + variant("sanitizer_tests", default=False, description="Enable address sanitizer tests") + + depends_on("cmake@3.23:", when="@2022.10.0: +rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:", type="build") + depends_on("cmake@:3.20", when="@2022.03.0:2022.03 +rocm", type="build") depends_on("cmake@3.14:", when="@2022.03.0:", type="build") + depends_on("cmake@3.9:", when="+cuda", type="build") + depends_on("cmake@3.8:", type="build") depends_on("blt", type="build") + depends_on("blt@0.6.1:", type="build", when="@2024.02.0:") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2022.03.1") depends_on("blt@0.4.1", type="build", when="@6.0.0") - depends_on("blt@0.4.0:", type="build", when="@4.1.3:5.0.1") - depends_on("blt@0.3.6:", type="build", when="@:4.1.2") + depends_on("blt@0.4.0:0.4.1", type="build", when="@4.1.3:5.0.1") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:4.1.2") conflicts("^blt@:0.3.6", when="+rocm") - depends_on("camp", when="@5.0.0:") - depends_on("camp@0.2.2:0.2.3", when="@6.0.0") - depends_on("camp@0.1.0", when="@5.0.0:5.0.1") - depends_on("camp@2022.03.2:", when="@2022.03.0:") - depends_on("camp@main", when="@main") - depends_on("camp@main", when="@develop") + depends_on("camp") depends_on("camp+openmp", when="+openmp") depends_on("camp~cuda", when="~cuda") - depends_on("camp~rocm", when="~rocm") + depends_on("camp@main", when="@develop") + depends_on("camp@2024.02.0:", when="@2024.02.0:") + depends_on("camp@2023.06.0", when="@2023.06.0") + depends_on("camp@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("camp@2022.03.2:2023.06.0", when="@2022.03.0:2022.03.1") + depends_on("camp@0.2.2:0.2.3", when="@6.0.0") + depends_on("camp@0.1.0", when="@5.0.0:5.0.1") + + depends_on("sqlite", when="+sqlite_experimental") + depends_on("mpi", when="+mpi") + + depends_on("fmt@9.1:", when="@2024.02.0:") + # For some reason, we need c++ 17 explicitly only with intel + depends_on("fmt@9.1: cxxstd=17", when="@2024.02.0: %intel@19.1") with when("@5.0.0:"): with when("+cuda"): @@ -213,7 +257,26 @@ class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): conflicts("+numa", when="@:0.3.2") conflicts("~c", when="+fortran", msg="Fortran API requires C API") + + # device allocator must be used with more current umpire versions, rocm 5.4.0 and greater, + # and with either rocm or cuda enabled conflicts("+device_alloc", when="@:2022.03.0") + conflicts("+device_alloc", when="^hip@:5.3.99") + conflicts("+device_alloc", when="~rocm~cuda") + + conflicts("+deviceconst", when="~rocm~cuda") + conflicts("~openmp", when="+openmp_target", msg="OpenMP target requires OpenMP") + conflicts("+cuda", when="+rocm") + conflicts("+tools", when="+rocm") + conflicts( + "+rocm", + when="+openmp_target", + msg="Cant support both rocm and openmp device backends at once", + ) + conflicts("+ipc_shmem", when="@:5.0.1") + + conflicts("+sqlite_experimental", when="@:6.0.0") + conflicts("+sanitizer_tests", when="~asan") # device allocator exports device code, which requires static libs # currently only available for cuda. @@ -230,73 +293,78 @@ def cache_name(self): hostname = socket.gethostname() if "SYS_TYPE" in env: hostname = hostname.rstrip("1234567890") - return "{0}-{1}-{2}@{3}.cmake".format( + return "{0}-{1}-{2}@{3}-{4}.cmake".format( hostname, self._get_sys_type(self.spec), self.spec.compiler.name, self.spec.compiler.version, + self.spec.dag_hash(8), ) def initconfig_compiler_entries(self): spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: entries = super().initconfig_compiler_entries() - if "+rocm" in spec: - entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) - option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" - if "+fortran" in spec and self.compiler.fc is not None: + if "+fortran" in spec and compiler.fc is not None: entries.append(cmake_cache_option("ENABLE_FORTRAN", True)) else: entries.append(cmake_cache_option("ENABLE_FORTRAN", False)) entries.append(cmake_cache_option("{}ENABLE_C".format(option_prefix), "+c" in spec)) + llnl_link_helpers(entries, spec, compiler) + return entries def initconfig_hardware_entries(self): spec = self.spec entries = super().initconfig_hardware_entries() + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" if "+cuda" in spec: entries.append(cmake_cache_option("ENABLE_CUDA", True)) - - if not spec.satisfies("cuda_arch=none"): - cuda_arch = spec.variants["cuda_arch"].value - entries.append(cmake_cache_string("CUDA_ARCH", "sm_{0}".format(cuda_arch[0]))) - entries.append( - cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(cuda_arch[0])) - ) - flag = "-arch sm_{0}".format(cuda_arch[0]) - entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", "{0}".format(flag))) - - entries.append( - cmake_cache_option( - "{}ENABLE_DEVICE_CONST".format(option_prefix), spec.satisfies("+deviceconst") - ) - ) + # Umpire used to pick only the first architecture in the list. The shared logic in + # CachedCMakePackage keeps the list of architectures. else: entries.append(cmake_cache_option("ENABLE_CUDA", False)) if "+rocm" in spec: entries.append(cmake_cache_option("ENABLE_HIP", True)) - entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) - hip_repair_cache(entries, spec) - archs = self.spec.variants["amdgpu_target"].value - if archs != "none": - arch_str = ",".join(archs) - entries.append( - cmake_cache_string("HIP_HIPCC_FLAGS", "--amdgpu-target={0}".format(arch_str)) - ) - entries.append( - cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str)) - ) else: entries.append(cmake_cache_option("ENABLE_HIP", False)) + entries.append( + cmake_cache_option( + "{}ENABLE_DEVICE_CONST".format(option_prefix), "+deviceconst" in spec + ) + ) + + entries.append( + cmake_cache_option( + "{}ENABLE_OPENMP_TARGET".format(option_prefix), "+openmp_target" in spec + ) + ) + + if "+openmp_target" in spec and "%xl" in spec: + entries.append(cmake_cache_string("OpenMP_CXX_FLAGS", "-qsmp;-qoffload")) + + return entries + + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super(Umpire, self).initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", "+mpi" in spec)) + return entries def initconfig_package_entries(self): @@ -313,24 +381,73 @@ def initconfig_package_entries(self): entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) if spec.satisfies("@5.0.0:"): entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) - entries.append(cmake_cache_option("{}ENABLE_NUMA".format(option_prefix), "+numa" in spec)) + + if spec.satisfies("@2024.02.0:"): + entries.append(cmake_cache_path("fmt_DIR", spec["fmt"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + entries.append(cmake_cache_option("ENABLE_WARNINGS_AS_ERRORS", "+werror" in spec)) + + # Generic options that have a prefixed equivalent in Umpire CMake entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) - entries.append(cmake_cache_option("ENABLE_BENCHMARKS", "tests=benchmarks" in spec)) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", "+examples" in spec)) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if "tests=benchmarks" in spec or "+dev_benchmarks" in spec: + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", False)) + entries.append(cmake_cache_option("ENABLE_TESTS", "tests=none" not in spec)) + + # Prefixed options that used to be name without one + entries.append(cmake_cache_option("{}ENABLE_NUMA".format(option_prefix), "+numa" in spec)) + entries.append( + cmake_cache_option( + "{}ENABLE_DEVELOPER_BENCHMARKS".format(option_prefix), "+dev_benchmarks" in spec + ) + ) + entries.append( + cmake_cache_option("{}ENABLE_TOOLS".format(option_prefix), "+tools" in spec) + ) entries.append( - cmake_cache_option("{}ENABLE_EXAMPLES".format(option_prefix), "+examples" in spec) + cmake_cache_option("{}ENABLE_BACKTRACE".format(option_prefix), "+backtrace" in spec) ) - entries.append(cmake_cache_option("{}ENABLE_DOCS".format(option_prefix), False)) + entries.append(cmake_cache_option("{}ENABLE_ASAN".format(option_prefix), "+asan" in spec)) + entries.append( + cmake_cache_option( + "{}ENABLE_SANITIZER_TESTS".format(option_prefix), "+sanitizer_tests" in spec + ) + ) + + # Recent options, were never name without prefix entries.append( cmake_cache_option("UMPIRE_ENABLE_DEVICE_ALLOCATOR", "+device_alloc" in spec) ) - entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) - entries.append(cmake_cache_option("ENABLE_TESTS", "tests=none" not in spec)) + entries.append( + cmake_cache_option("UMPIRE_ENABLE_SQLITE_EXPERIMENTAL", "+sqlite_experimental" in spec) + ) + if "+sqlite_experimental" in spec: + entries.append(cmake_cache_path("SQLite3_ROOT", spec["sqlite"].prefix)) + + # This option was renamed later than the others + if spec.satisfies("@2022.10.0:"): + entries.append( + cmake_cache_option("UMPIRE_ENABLE_IPC_SHARED_MEMORY", "+ipc_shmem" in spec) + ) + else: + entries.append(cmake_cache_option("ENABLE_IPC_SHARED_MEMORY", "+ipc_shmem" in spec)) return entries def cmake_args(self): - options = [] - return options + return [] def test(self): """Perform stand-alone checks on the installed package."""