Plumed: Add a new ArrayFire variant. (#20624)

This commit is contained in:
Rémi Lacroix 2021-01-21 16:29:11 +01:00 committed by GitHub
parent 6f166283ca
commit afa536fc1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,6 +58,9 @@ class Plumed(AutotoolsPackage):
variant('shared', default=True, description='Builds shared libraries') variant('shared', default=True, description='Builds shared libraries')
variant('mpi', default=True, description='Activates MPI support') variant('mpi', default=True, description='Activates MPI support')
variant('gsl', default=True, description='Activates GSL support') variant('gsl', default=True, description='Activates GSL support')
variant('arrayfire', default='none',
values=('none', 'cpu', 'cuda', 'opencl'),
description='Activates FireArray support')
# Dependencies. LAPACK and BLAS are recommended but not essential. # Dependencies. LAPACK and BLAS are recommended but not essential.
depends_on('zlib') depends_on('zlib')
@ -66,6 +69,9 @@ class Plumed(AutotoolsPackage):
# For libmatheval support through the 'function' module # For libmatheval support through the 'function' module
# which is enabled by default (or when optional_modules=all) # which is enabled by default (or when optional_modules=all)
depends_on('libmatheval', when='@:2.4.99') depends_on('libmatheval', when='@:2.4.99')
depends_on('arrayfire', when='arrayfire=cpu')
depends_on('arrayfire+cuda', when='arrayfire=cuda')
depends_on('arrayfire+opencl', when='arrayfire=opencl')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
depends_on('gsl', when='+gsl') depends_on('gsl', when='+gsl')
@ -168,18 +174,31 @@ def configure_args(self):
'STATIC_LIBS=-mt_mpi' 'STATIC_LIBS=-mt_mpi'
]) ])
extra_libs = []
# Set flags to help find gsl # Set flags to help find gsl
if '+gsl' in self.spec: if '+gsl' in spec:
gsl_libs = self.spec['gsl'].libs gsl_libs = spec['gsl'].libs
blas_libs = self.spec['blas'].libs blas_libs = spec['blas'].libs
configure_opts.append('LDFLAGS={0}'.format( extra_libs.append(
(gsl_libs + blas_libs).ld_flags (gsl_libs + blas_libs).ld_flags
)
# Set flags to help with ArrayFire
if 'arrayfire=none' not in spec:
libaf = 'arrayfire:{0}'.format(spec.variants['arrayfire'].value)
extra_libs.append(spec[libaf].libs.search_flags)
if extra_libs:
configure_opts.append('LDFLAGS={0}'.format(
' '.join(extra_libs)
)) ))
# Additional arguments # Additional arguments
configure_opts.extend([ configure_opts.extend([
'--enable-shared={0}'.format('yes' if '+shared' in spec else 'no'), '--enable-shared={0}'.format('yes' if '+shared' in spec else 'no'),
'--enable-gsl={0}'.format('yes' if '+gsl' in spec else 'no') '--enable-gsl={0}'.format('yes' if '+gsl' in spec else 'no'),
'--enable-af_cpu={0}'.format('yes' if 'arrayfire=cpu' in spec else 'no'),
'--enable-af_cuda={0}'.format('yes' if 'arrayfire=cuda' in spec else 'no'),
'--enable-af_ocl={0}'.format('yes' if 'arrayfire=ocl' in spec else 'no')
]) ])
# Construct list of optional modules # Construct list of optional modules