summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGeoff Womeldorff <womeld@lanl.gov>2018-05-24 09:53:58 -0600
committerAdam J. Stewart <ajstewart426@gmail.com>2018-05-24 10:53:58 -0500
commitfdb2d6f493ccc67c7b21cfdfffd8655e0cdb0540 (patch)
tree7f7af795cc7afc23d8e3ad517a241ec93d41194f /var
parent4c4e2866d8c47e8ed795717965d3ed9de11ac8e0 (diff)
downloadspack-fdb2d6f493ccc67c7b21cfdfffd8655e0cdb0540.tar.gz
spack-fdb2d6f493ccc67c7b21cfdfffd8655e0cdb0540.tar.bz2
spack-fdb2d6f493ccc67c7b21cfdfffd8655e0cdb0540.tar.xz
spack-fdb2d6f493ccc67c7b21cfdfffd8655e0cdb0540.zip
kokkos: update kokkos spackage to add current host/gpu architectures. (#8226)
* kokkos: update kokkos spackage to add current host/gpu architectures. * kokkos: simplify host/gpu architecture selection and make intent of arg population logic more clear. * kokkos: mollify flake8. * Make strings and logic more pythonic. Add error for GPU arch without CUDA. * kokkos: simplify conflicts behaviour. make args population more pythonic. * kokkos: move gpu values to list for use in variant and conflicts checking. * kokkos: How fortunate the man with None. * kokkos: fix gpu_arch conflict loop error. add conflict to guard against +cuda and 2.5.00:develop versions, until kokkos issue #1296 is resolved. * kokkos: mollify flake8. * kokkos: add descriptive message to version conflict with +cuda.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/kokkos/package.py50
1 files changed, 49 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/kokkos/package.py b/var/spack/repos/builtin/packages/kokkos/package.py
index 7f61270327..51d90ffc06 100644
--- a/var/spack/repos/builtin/packages/kokkos/package.py
+++ b/var/spack/repos/builtin/packages/kokkos/package.py
@@ -46,7 +46,43 @@ class Kokkos(Package):
variant('qthreads', default=False, description="enable Qthreads backend")
variant('cuda', default=False, description="enable Cuda backend")
- variant('openmp', default=True, description="enable OpenMP backend")
+ variant('openmp', default=False, description="enable OpenMP backend")
+
+ gpu_values = ('Kepler30', 'Kepler32', 'Kepler35', 'Kepler37',
+ 'Maxwell50', 'Maxwell52', 'Maxwell53',
+ 'Pascal60', 'Pascal61')
+
+ # Host architecture variant
+ variant(
+ 'host_arch',
+ default=None,
+ values=('AMDAVX', 'ARMv80', 'ARMv81', 'ARMv8-ThunderX',
+ 'Power7', 'Power8', 'Power9',
+ 'WSM', 'SNB', 'HSW', 'BDW', 'SKX', 'KNC', 'KNL'),
+ description='Set the host architecture to use'
+ )
+
+ # GPU architecture variant
+ variant(
+ 'gpu_arch',
+ default=None,
+ values=gpu_values,
+ description='Set the GPU architecture to use'
+ )
+
+ # Check that we haven't specified a gpu architecture
+ # without specifying CUDA
+ for p in gpu_values:
+ conflicts('gpu_arch={0}'.format(p), when='~cuda',
+ msg='Must specify CUDA backend to use a GPU architecture.')
+
+ # conflicts on kokkos version and cuda enabled
+ # see kokkos issue #1296
+ # https://github.com/kokkos/kokkos/issues/1296
+ conflicts('+cuda', when='@2.5.00:develop',
+ msg='Kokkos build system has issue when CUDA enabled'
+ ' in version 2.5.00, and develop until '
+ 'issue #1296 is resolved.')
# Specify that v1.x is required as v2.x has API changes
depends_on('hwloc@:1')
@@ -62,12 +98,24 @@ class Kokkos(Package):
'--with-hwloc=%s' % spec['hwloc'].prefix,
'--with-serial'
]
+ arch_args = []
+ # Backends
if '+openmp' in spec:
g_args.append('--with-openmp')
if 'qthreads' in spec:
g_args.append('--with-qthreads=%s' % spec['qthreads'].prefix)
if 'cuda' in spec:
g_args.append('--with-cuda=%s' % spec['cuda'].prefix)
+ # Host architectures
+ host_arch = spec.variants['host_arch'].value
+ # GPU architectures
+ gpu_arch = spec.variants['gpu_arch'].value
+ if host_arch:
+ arch_args.append(host_arch)
+ if gpu_arch:
+ arch_args.append(gpu_arch)
+ if arch_args:
+ g_args.append('--arch={0}'.format(','.join(arch_args)))
generate(*g_args)
make()