summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorLoris Ercole <30901257+lorisercole@users.noreply.github.com>2023-08-28 20:13:05 +0200
committerGitHub <noreply@github.com>2023-08-28 14:13:05 -0400
commitcb855d5ffd3ed22583b35c650e056d04718351fa (patch)
treed130a5a9c1a802444694bbc0bab158a281be6854 /var
parent3866ff00967a21ae12853dee5e1eee62ea227cc0 (diff)
downloadspack-cb855d5ffd3ed22583b35c650e056d04718351fa.tar.gz
spack-cb855d5ffd3ed22583b35c650e056d04718351fa.tar.bz2
spack-cb855d5ffd3ed22583b35c650e056d04718351fa.tar.xz
spack-cb855d5ffd3ed22583b35c650e056d04718351fa.zip
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.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/kokkos/package.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/var/spack/repos/builtin/packages/kokkos/package.py b/var/spack/repos/builtin/packages/kokkos/package.py
index 92daad8bd0..5eb7ce5cca 100644
--- a/var/spack/repos/builtin/packages/kokkos/package.py
+++ b/var/spack/repos/builtin/packages/kokkos/package.py
@@ -139,6 +139,17 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
cuda_arches = spack_cuda_arch_map.values()
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 = {
"gfx900": "vega900",
"gfx906": "vega906",
@@ -282,11 +293,16 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
spack_microarches = []
if "+cuda" in spec:
- # this is a list
- for cuda_arch in spec.variants["cuda_arch"].value:
- if not cuda_arch == "none":
- kokkos_arch_name = self.spack_cuda_arch_map[cuda_arch]
- spack_microarches.append(kokkos_arch_name)
+ if isinstance(spec.variants["cuda_arch"].value, str):
+ cuda_arch = spec.variants["cuda_arch"].value
+ 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]
+ spack_microarches.append(kokkos_arch_name)
kokkos_microarch_name = self.get_microarch(spec.target)
if kokkos_microarch_name: