Change how CUDA variants are handled for libbeagle (#18984)

- Override the cuda_arch variant setup, with multi=False to ensure one
  value is selected
- Use a conflicts statement rather than InstallError
This commit is contained in:
Glenn Johnson 2020-10-12 07:06:26 -05:00 committed by GitHub
parent bd8c73ef18
commit 9915ce0315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,19 +26,22 @@ class Libbeagle(AutotoolsPackage, CudaPackage):
depends_on('pkgconfig', type='build') depends_on('pkgconfig', type='build')
depends_on('java', type='build') depends_on('java', type='build')
cuda_arch_values = CudaPackage.cuda_arch_values
variant(
'cuda_arch',
description='CUDA architecture',
default='none',
values=cuda_arch_values,
multi=False
)
conflicts('cuda_arch=none', when='+cuda',
msg='must select a CUDA architecture')
def patch(self): def patch(self):
# update cuda architecture if necessary # update cuda architecture if necessary
if '+cuda' in self.spec: if '+cuda' in self.spec:
cuda_arch = self.spec.variants['cuda_arch'].value cuda_arch = self.spec.variants['cuda_arch'].value
archflag = '' archflag = '-arch=compute_{0}'.format(cuda_arch)
if cuda_arch != 'none':
if len(cuda_arch) > 1:
raise InstallError(
'libbeagle only supports compilation for a single GPU'
'type.'
)
archflag = '-arch compute_{0}'.format(cuda_arch[0])
filter_file('-arch compute_13', '', filter_file('-arch compute_13', '',
'libhmsbeagle/GPU/kernels/Makefile.am', 'libhmsbeagle/GPU/kernels/Makefile.am',