qthreads: add additional configuration options (#15833)

* Add new config options for qthreads

* Fix syntax error and add option for specifying stack size

* Fix flake8 issues

* Add input validation for the stack size variant and add explicit enable for spawn cache

* Fix flake8 issues with input validation code
This commit is contained in:
Carson Woods 2020-08-22 16:58:41 -04:00 committed by GitHub
parent e26e532eb3
commit c743d219aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,15 @@
from spack import *
def is_integer(x):
"""Any integer value"""
try:
return float(x).is_integer()
except ValueError:
return False
class Qthreads(AutotoolsPackage):
"""The qthreads API is designed to make using large numbers of
threads convenient and easy, and to allow portable access to
@ -33,6 +42,19 @@ class Qthreads(AutotoolsPackage):
default=True,
description='hwloc support'
)
variant('spawn_cache',
default=False,
description='enables worker specific cache of spawns')
variant('scheduler', default='nemesis',
values=('nemesis', 'lifo', 'mutexfifo', 'mtsfifo',
'sherwood', 'distrib', 'nottingham'),
multi=False,
description='Specify which scheduler policy to use')
variant('static', default=True, description='Build static library')
variant('stack_size',
default=4096,
description='Specify number of bytes to use in a stack',
values=is_integer)
depends_on("hwloc@1.0:1.99", when="+hwloc")
@ -45,4 +67,21 @@ def configure_args(self):
"--with-hwloc=%s" % spec["hwloc"].prefix]
else:
args = ["--with-topology=no"]
if '+spawn_cache' in self.spec:
args.append('--enable-spawn-cache')
else:
args.append('--disable-spawn-cache')
if '+static' in self.spec:
args.append('--enable-static=yes')
else:
args.append('--enable-static=no')
args.append('--with-default-stack-size=%s'
% self.spec.variants['stack_size'].value)
args.append('--with-scheduler=%s'
% self.spec.variants['scheduler'].value)
return args