diff options
author | Carson Woods <carsonwoods@users.noreply.github.com> | 2020-08-22 16:58:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 15:58:41 -0500 |
commit | c743d219aa07ca0b7458cbd3e699a5ce3d46817d (patch) | |
tree | 8f92b694120370ac665b1785358975dc803293f0 | |
parent | e26e532eb3de5b14982848f4630f12cec5259572 (diff) | |
download | spack-c743d219aa07ca0b7458cbd3e699a5ce3d46817d.tar.gz spack-c743d219aa07ca0b7458cbd3e699a5ce3d46817d.tar.bz2 spack-c743d219aa07ca0b7458cbd3e699a5ce3d46817d.tar.xz spack-c743d219aa07ca0b7458cbd3e699a5ce3d46817d.zip |
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
-rw-r--r-- | var/spack/repos/builtin/packages/qthreads/package.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/qthreads/package.py b/var/spack/repos/builtin/packages/qthreads/package.py index dbf2bee790..a50acdee81 100644 --- a/var/spack/repos/builtin/packages/qthreads/package.py +++ b/var/spack/repos/builtin/packages/qthreads/package.py @@ -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 @@ class Qthreads(AutotoolsPackage): "--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 |