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).
This commit is contained in:
parent
e759e6c410
commit
fa9fb60df3
1 changed files with 2 additions and 2 deletions
|
@ -252,7 +252,7 @@ def initconfig_hardware_entries(self):
|
||||||
entries.append(cmake_cache_path("CUDA_TOOLKIT_ROOT_DIR", cudatoolkitdir))
|
entries.append(cmake_cache_path("CUDA_TOOLKIT_ROOT_DIR", cudatoolkitdir))
|
||||||
|
|
||||||
archs = spec.variants["cuda_arch"].value
|
archs = spec.variants["cuda_arch"].value
|
||||||
if archs != "none":
|
if archs[0] != "none":
|
||||||
arch_str = ";".join(archs)
|
arch_str = ";".join(archs)
|
||||||
entries.append(
|
entries.append(
|
||||||
cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(arch_str))
|
cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(arch_str))
|
||||||
|
@ -269,7 +269,7 @@ def initconfig_hardware_entries(self):
|
||||||
cmake_cache_path("HIP_CXX_COMPILER", "{0}".format(self.spec["hip"].hipcc))
|
cmake_cache_path("HIP_CXX_COMPILER", "{0}".format(self.spec["hip"].hipcc))
|
||||||
)
|
)
|
||||||
archs = self.spec.variants["amdgpu_target"].value
|
archs = self.spec.variants["amdgpu_target"].value
|
||||||
if archs != "none":
|
if archs[0] != "none":
|
||||||
arch_str = ";".join(archs)
|
arch_str = ";".join(archs)
|
||||||
entries.append(
|
entries.append(
|
||||||
cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str))
|
cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str))
|
||||||
|
|
Loading…
Reference in a new issue