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.
This commit is contained in:
Geoff Womeldorff 2018-05-24 09:53:58 -06:00 committed by Adam J. Stewart
parent 4c4e2866d8
commit fdb2d6f493

View file

@ -46,7 +46,43 @@ class Kokkos(Package):
variant('qthreads', default=False, description="enable Qthreads backend") variant('qthreads', default=False, description="enable Qthreads backend")
variant('cuda', default=False, description="enable Cuda 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 # Specify that v1.x is required as v2.x has API changes
depends_on('hwloc@:1') depends_on('hwloc@:1')
@ -62,12 +98,24 @@ def install(self, spec, prefix):
'--with-hwloc=%s' % spec['hwloc'].prefix, '--with-hwloc=%s' % spec['hwloc'].prefix,
'--with-serial' '--with-serial'
] ]
arch_args = []
# Backends
if '+openmp' in spec: if '+openmp' in spec:
g_args.append('--with-openmp') g_args.append('--with-openmp')
if 'qthreads' in spec: if 'qthreads' in spec:
g_args.append('--with-qthreads=%s' % spec['qthreads'].prefix) g_args.append('--with-qthreads=%s' % spec['qthreads'].prefix)
if 'cuda' in spec: if 'cuda' in spec:
g_args.append('--with-cuda=%s' % spec['cuda'].prefix) 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) generate(*g_args)
make() make()