kokkos: avoid setting multiple cuda_arch
(#38723)
The kokkos package does not support building with cuda with multiple `cuda_arch`. An error is raised if multiple `cuda_arch` are specified.
This commit is contained in:
parent
3866ff0096
commit
cb855d5ffd
@ -139,6 +139,17 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
cuda_arches = spack_cuda_arch_map.values()
|
cuda_arches = spack_cuda_arch_map.values()
|
||||||
conflicts("+cuda", when="cuda_arch=none")
|
conflicts("+cuda", when="cuda_arch=none")
|
||||||
|
|
||||||
|
# Kokkos support only one cuda_arch at a time
|
||||||
|
variant(
|
||||||
|
"cuda_arch",
|
||||||
|
description="CUDA architecture",
|
||||||
|
values=("none",) + CudaPackage.cuda_arch_values,
|
||||||
|
default="none",
|
||||||
|
multi=False,
|
||||||
|
sticky=True,
|
||||||
|
when="+cuda",
|
||||||
|
)
|
||||||
|
|
||||||
amdgpu_arch_map = {
|
amdgpu_arch_map = {
|
||||||
"gfx900": "vega900",
|
"gfx900": "vega900",
|
||||||
"gfx906": "vega906",
|
"gfx906": "vega906",
|
||||||
@ -282,9 +293,14 @@ def cmake_args(self):
|
|||||||
|
|
||||||
spack_microarches = []
|
spack_microarches = []
|
||||||
if "+cuda" in spec:
|
if "+cuda" in spec:
|
||||||
# this is a list
|
if isinstance(spec.variants["cuda_arch"].value, str):
|
||||||
for cuda_arch in spec.variants["cuda_arch"].value:
|
cuda_arch = spec.variants["cuda_arch"].value
|
||||||
if not cuda_arch == "none":
|
else:
|
||||||
|
if len(spec.variants["cuda_arch"].value) > 1:
|
||||||
|
msg = "Kokkos supports only one cuda_arch at a time."
|
||||||
|
raise InstallError(msg)
|
||||||
|
cuda_arch = spec.variants["cuda_arch"].value[0]
|
||||||
|
if cuda_arch != "none":
|
||||||
kokkos_arch_name = self.spack_cuda_arch_map[cuda_arch]
|
kokkos_arch_name = self.spack_cuda_arch_map[cuda_arch]
|
||||||
spack_microarches.append(kokkos_arch_name)
|
spack_microarches.append(kokkos_arch_name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user