diff options
author | Mikael Simberg <mikael.simberg@iki.fi> | 2023-06-06 23:41:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 14:41:02 -0700 |
commit | fa9fb60df332a430ed10ce007d3a07ec90aefcb5 (patch) | |
tree | 19485321fe6f0cd30f9054d6f382ba512137d53c /lib | |
parent | e759e6c4107bcbe82b76c487970b56b35eca1ee4 (diff) | |
download | spack-fa9fb60df332a430ed10ce007d3a07ec90aefcb5.tar.gz spack-fa9fb60df332a430ed10ce007d3a07ec90aefcb5.tar.bz2 spack-fa9fb60df332a430ed10ce007d3a07ec90aefcb5.tar.xz spack-fa9fb60df332a430ed10ce007d3a07ec90aefcb5.zip |
CachedCMakePackage: fix bug where CMAKE_CUDA_ARCHITECTURES=none is set (#38169)
#37592 updated cached cmake packages to set CMAKE_CUDA_ARCHITECTURES.
The condition `if archs != "none"` lead to `CMAKE_CUDA_ARCHITECTURES=none`
when cuda_arch=none (incorrect check on the value of a multi-valued
variant), i.e. CMAKE_CUDA_ARCHITECTURES is always set. This PR udpates
the condition to if archs[0] != "none" to ensure CMAKE_CUDA_ARCHITECTURES
is only set if cuda_arch is not none (which seems to be the pattern used
in other packages).
This does the same for HIP (although in general ROCmPackage disallows
amdgpu_target=none when +rocm).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/cached_cmake.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/build_systems/cached_cmake.py b/lib/spack/spack/build_systems/cached_cmake.py index cabe8d52d8..f1a466597c 100644 --- a/lib/spack/spack/build_systems/cached_cmake.py +++ b/lib/spack/spack/build_systems/cached_cmake.py @@ -252,7 +252,7 @@ class CachedCMakeBuilder(CMakeBuilder): entries.append(cmake_cache_path("CUDA_TOOLKIT_ROOT_DIR", cudatoolkitdir)) archs = spec.variants["cuda_arch"].value - if archs != "none": + if archs[0] != "none": arch_str = ";".join(archs) entries.append( cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(arch_str)) @@ -269,7 +269,7 @@ class CachedCMakeBuilder(CMakeBuilder): cmake_cache_path("HIP_CXX_COMPILER", "{0}".format(self.spec["hip"].hipcc)) ) archs = self.spec.variants["amdgpu_target"].value - if archs != "none": + if archs[0] != "none": arch_str = ";".join(archs) entries.append( cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str)) |