diff options
author | Robert Brunner <rbrunner@illinois.edu> | 2021-01-19 03:01:48 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 10:01:48 +0100 |
commit | 91f65b977244496af89e5f039dd337b90dd32cfc (patch) | |
tree | 3197645f89e5795fc8fb4d63cbe47e646d4f6de4 | |
parent | 86e9d938591dee399ecca2e0ceba39f1f3934b04 (diff) | |
download | spack-91f65b977244496af89e5f039dd337b90dd32cfc.tar.gz spack-91f65b977244496af89e5f039dd337b90dd32cfc.tar.bz2 spack-91f65b977244496af89e5f039dd337b90dd32cfc.tar.xz spack-91f65b977244496af89e5f039dd337b90dd32cfc.zip |
libyogrt: add lsf scheduler support, create yogrt.conf file (#19960)
Tell the libyogrt installer to create a yogrt.conf file, specifying whatever
scheduler was specified in the scheduler=XXX parameter.
-rw-r--r-- | var/spack/repos/builtin/packages/libyogrt/package.py | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/libyogrt/package.py b/var/spack/repos/builtin/packages/libyogrt/package.py index 7d7c2c74ca..38138aee3a 100644 --- a/var/spack/repos/builtin/packages/libyogrt/package.py +++ b/var/spack/repos/builtin/packages/libyogrt/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * +import os class Libyogrt(AutotoolsPackage): @@ -33,12 +34,15 @@ class Libyogrt(AutotoolsPackage): variant('scheduler', default='system', description="Select scheduler integration", - values=['system', 'slurm'], multi=False) + values=['system', 'slurm', 'lsf'], multi=False) + depends_on('slurm', when='scheduler=slurm') + depends_on('lsf', when='scheduler=lsf') + + conflicts('scheduler=lsf', when='@:1.22') + variant('static', default='False', description="build static library") - depends_on('slurm', when='scheduler=slurm') - def url_for_version(self, version): if version < Version(1.21): return "https://github.com/LLNL/libyogrt/archive/%s.tar.gz" % version @@ -49,10 +53,37 @@ class Libyogrt(AutotoolsPackage): args = [] sched = self.spec.variants['scheduler'].value - if sched != "system": + if sched == "lsf": + # The LSF library depends on a couple of other libraries, + # and running the build inside of spack does not find + # them, and the user has to add them when they want + # to use -lyogrt. If we explicitly tell it what libraries + # to use, the user does not need to specify them + args.append('--with-lsf') + args.append('LIBS=-llsf -lrt -lnsl') + elif sched != "system": args.append('--with-%s=%s' % (sched, self.spec[sched].prefix)) if '+static' in self.spec: args.append('--enable-static=yes') return args + + @run_after('install') + def create_yogrt_conf(self): + etcpath = os.path.join(prefix, "etc") + + # create subdirectory to hold yogrt.conf file + if not os.path.isdir(etcpath): + mode = 0o755 + os.mkdir(etcpath, mode) + + # if no scheduler is specified, create yogrt conf file + # with backend=none + sched = self.spec.variants['scheduler'].value + if sched == "system": + sched = "none" + + # create conf file to inform libyogrt about job scheduler + with open(os.path.join(etcpath, "yogrt.conf"), "w+") as f: + f.write("backend=%s\n" % sched) |