From ec5bf382456deeedc79d972b496ac47eb1c86c65 Mon Sep 17 00:00:00 2001
From: "Nichols A. Romero" <naromero77@users.noreply.github.com>
Date: Wed, 13 Mar 2019 16:03:28 -0500
Subject: [PATCH] QMCPACK More CUDA Fixes (#10864)

* Throw InstallError if more than one GPU architecture is passed to cuda_arch. Previous cuda_arch test was not actually working because comparison with none string was on the cuda_arch list instead of the first entry of the list.

* Removing redundant cuda_arch statement.
---
 var/spack/repos/builtin/packages/qmcpack/package.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/qmcpack/package.py b/var/spack/repos/builtin/packages/qmcpack/package.py
index ec6f1e0f16..f25a289a0f 100644
--- a/var/spack/repos/builtin/packages/qmcpack/package.py
+++ b/var/spack/repos/builtin/packages/qmcpack/package.py
@@ -215,9 +215,15 @@ def cmake_args(self):
 
         if '+cuda' in spec:
             args.append('-DQMC_CUDA=1')
-            cuda_arch = spec.variants['cuda_arch'].value
+            cuda_arch_list = spec.variants['cuda_arch'].value
+            cuda_arch = cuda_arch_list[0]
+            if len(cuda_arch_list) > 1:
+                raise InstallError(
+                    'QMCPACK only supports compilation for a single '
+                    'GPU architecture at a time'
+                )
             if cuda_arch != 'none':
-                args.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
+                args.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch))
             else:
                 # This is the default value set in QMCPACK's CMake
                 # Not possible to set default value for cuda_arch,
-- 
GitLab