summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrian Van Essen <vanessen1@llnl.gov>2023-11-09 10:08:37 -0800
committerGitHub <noreply@github.com>2023-11-09 19:08:37 +0100
commit7a4df732e1a6b6eaf6d6a9675c5857e7e53d5445 (patch)
tree2b4547657ddb898bcd702d8456b9e27fb9e030f1 /lib
parent7e6aaf9458bfc5d42b0c7da1f500a17eef16907c (diff)
downloadspack-7a4df732e1a6b6eaf6d6a9675c5857e7e53d5445.tar.gz
spack-7a4df732e1a6b6eaf6d6a9675c5857e7e53d5445.tar.bz2
spack-7a4df732e1a6b6eaf6d6a9675c5857e7e53d5445.tar.xz
spack-7a4df732e1a6b6eaf6d6a9675c5857e7e53d5445.zip
DiHydrogen, Hydrogen, and Aluminum CachedCMakePackage (#39714)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cached_cmake.py16
-rw-r--r--lib/spack/spack/package.py1
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/spack/spack/build_systems/cached_cmake.py b/lib/spack/spack/build_systems/cached_cmake.py
index d85c2b7e19..74304f1dc6 100644
--- a/lib/spack/spack/build_systems/cached_cmake.py
+++ b/lib/spack/spack/build_systems/cached_cmake.py
@@ -34,6 +34,11 @@ def cmake_cache_option(name, boolean_value, comment="", force=False):
return 'set({0} {1} CACHE BOOL "{2}"{3})\n'.format(name, value, comment, force_str)
+def cmake_cache_filepath(name, value, comment=""):
+ """Generate a string for a cmake cache variable of type FILEPATH"""
+ return 'set({0} "{1}" CACHE FILEPATH "{2}")\n'.format(name, value, comment)
+
+
class CachedCMakeBuilder(CMakeBuilder):
#: Phases of a Cached CMake package
#: Note: the initconfig phase is used for developer builds as a final phase to stop on
@@ -257,6 +262,15 @@ class CachedCMakeBuilder(CMakeBuilder):
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 /<path>/rocm-<ver>/ and
+ # others point to /<path>/rocm-<ver>/llvm
+ if os.path.basename(os.path.normpath(llvm_prefix)) != "llvm":
+ llvm_bin = os.path.join(llvm_prefix, "llvm/bin/")
+ entries.append(
+ cmake_cache_filepath("CMAKE_HIP_COMPILER", os.path.join(llvm_bin, "clang++"))
+ )
archs = self.spec.variants["amdgpu_target"].value
if archs[0] != "none":
arch_str = ";".join(archs)
@@ -277,7 +291,7 @@ class CachedCMakeBuilder(CMakeBuilder):
"#------------------{0}".format("-" * 60),
"# CMake executable path: {0}".format(self.pkg.spec["cmake"].command.path),
"#------------------{0}\n".format("-" * 60),
- cmake_cache_path("CMAKE_PREFIX_PATH", cmake_prefix_path),
+ cmake_cache_string("CMAKE_PREFIX_PATH", cmake_prefix_path),
self.define_cmake_cache_from_variant("CMAKE_BUILD_TYPE", "build_type"),
]
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index c537a7103a..ee6fb0ed8c 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -32,6 +32,7 @@ from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.bundle import BundlePackage
from spack.build_systems.cached_cmake import (
CachedCMakePackage,
+ cmake_cache_filepath,
cmake_cache_option,
cmake_cache_path,
cmake_cache_string,