SCR CMake package (#3916)

* SCR CMake package

* Fix dtcmp variant description and set pdsh deptypes to build/run

* added variants for system config file location

* add variants for several scr cmake options

* Added more variants for compile time options

* Added libyogrt and made corrosponding changes to scr package.

* Cleanup yogrt package now that Ive verified it works

* Added description for libyogrt

* upper case async api names

* Make use of mv variants

* fix pdsh package for scr

* added IBM BBAPI as async option

* update pdsh and scr to use static pdsh modules
This commit is contained in:
Elsa Gonsiorowski
2017-08-03 16:52:52 -07:00
committed by becker33
parent 8a7678cae0
commit bb4692fdb6
3 changed files with 162 additions and 13 deletions

View File

@@ -24,24 +24,123 @@
##############################################################################
from spack import *
import os
import shutil
class Scr(Package):
class Scr(CMakePackage):
"""SCR caches checkpoint data in storage on the compute nodes of a
Linux cluster to provide a fast, scalable checkpoint/restart
capability for MPI codes"""
homepage = "https://computation.llnl.gov/project/scr/"
homepage = "http://computation.llnl.gov/projects/scalable-checkpoint-restart-for-mpi"
depends_on("mpi")
# depends_on("dtcmp")
# NOTE: scr-v1.1.8 is built with autotools and is not properly build here.
# scr-v1.1.8 will be deprecated with the upcoming release of v1.2.0
# url = "https://github.com/LLNL/scr/releases/download/v1.1.8/scr-1.1.8.tar.gz"
# version('1.1.8', '6a0f11ad18e27fcfc00a271ff587b06e')
version('1.1-7', 'a5930e9ab27d1b7049447c2fd7734ebd',
url='http://downloads.sourceforge.net/project/scalablecr/releases/scr-1.1-7.tar.gz')
version('1.1.8', '6a0f11ad18e27fcfc00a271ff587b06e',
url='https://github.com/hpc/scr/releases/download/v1.1.8/scr-1.1.8.tar.gz')
version('master', git='https://github.com/llnl/scr.git', branch='master')
def install(self, spec, prefix):
configure("--prefix=" + prefix,
"--with-scr-config-file=" + prefix + "/etc/scr.conf")
make()
make("install")
depends_on('pdsh+static_modules', type=('build', 'run'))
depends_on('zlib')
depends_on('mpi')
variant('dtcmp', default=True,
description="Build with DTCMP. "
"Necessary to enable user directory naming at runtime")
depends_on('dtcmp', when="+dtcmp")
variant('libyogrt', default=True,
description="Build SCR with libyogrt for get_time_remaining.")
depends_on('libyogrt', when="+libyogrt")
# MySQL not yet in spack
# variant('mysql', default=True, decription="MySQL database for logging")
# depends_on('mysql', when="+mysql")
variant('scr_config', default='scr.conf',
description='Location for SCR to find its system config file. '
'May be either absolute or relative to the install prefix')
variant('copy_config', default=None,
description='Location from which to copy SCR system config file. '
'Must be an absolute path.')
variant('fortran', default=True,
description="Build SCR with fortran bindings")
variant('resource_manager', default='SLURM',
values=('SLURM', 'APRUN', 'PMIX', 'LSF', 'NONE'),
multi=False,
description="Resource manager for which to configure SCR.")
variant('async_api', default='NONE',
values=('NONE', 'CRAY_DW', 'IBM_BBAPI', 'INTEL_CPPR'),
multi=False,
description="Asynchronous data transfer API to use with SCR.")
variant('file_lock', default='FLOCK',
values=('FLOCK', 'FNCTL', 'NONE'),
multi=False,
description='File locking style for SCR.')
variant('cache_base', default='/tmp',
description='Compile time default location for checkpoint cache.')
variant('cntl_base', default='/tmp',
description='Compile time default location for control directory.')
def get_abs_path_rel_prefix(self, path):
# Return path if absolute, otherwise prepend prefix
if os.path.isabs(path):
return path
else:
return join_path(self.spec.prefix, path)
def cmake_args(self):
spec = self.spec
args = []
args.append('-DENABLE_FORTRAN={0}'.format('+fortran' in spec))
conf_path = self.get_abs_path_rel_prefix(
self.spec.variants['scr_config'].value)
args.append('-DCMAKE_SCR_CONFIG_FILE={0}'.format(conf_path))
# We uppercase the values for these to avoid unnecessary user error.
args.append('-DSCR_RESOURCE_MANAGER={0}'.format(
spec.variants['resource_manager'].value.upper()))
args.append('-DSCR_ASYNC_API={0}'.format(
spec.variants['async_api'].value.upper()))
args.append('-DSCR_FILE_LOCK={0}'.format(
spec.variants['file_lock'].value.upper()))
args.append('-DSCR_CACHE_BASE={0}'.format(
spec.variants['cache_base'].value))
args.append('-DSCR_CNTL_BASE={0}'.format(
spec.variants['cntl_base'].value))
args.append('-DWITH_PDSH_PREFIX={0}'.format(spec['pdsh'].prefix))
if "+dtcmp" in spec:
args.append('-DWITH_DTCMP_PREFIX={0}'.format(spec['dtcmp'].prefix))
if "+libyogrt" in spec:
args.append('-DWITH_YOGRT_PREFIX={0}'.format(
spec['libyogrt'].prefix))
# if "+mysql" in spec:
# args.append('-DWITH_MYSQL_PREFIX={0}'.format(
# spec['mysql'].prefix))
return args
@run_after('install')
def copy_config(self):
spec = self.spec
if spec.variants['copy_config'].value:
dest_path = self.get_abs_path_rel_prefix(
spec.variants['scr_config'].value)
shutil.copyfile(spec.variants['copy_config'].value, dest_path)