From 0f82fa51517b70270c14309fbed86cf779477963 Mon Sep 17 00:00:00 2001 From: Peter Lindstrom Date: Fri, 29 Jan 2021 08:51:30 -0800 Subject: [PATCH] zfp: several package improvements (#21244) - add variants for build targets, language bindings, backends - ensure selected variants are compatible with zfp version - point to GitHub (not LLNL) tar balls - add dependencies - update link to homepage - add maintainers Co-authored-by: Massimiliano Culpo --- .../repos/builtin/packages/zfp/package.py | 103 ++++++++++++------ 1 file changed, 69 insertions(+), 34 deletions(-) diff --git a/var/spack/repos/builtin/packages/zfp/package.py b/var/spack/repos/builtin/packages/zfp/package.py index b6589d50f3..a065af9281 100644 --- a/var/spack/repos/builtin/packages/zfp/package.py +++ b/var/spack/repos/builtin/packages/zfp/package.py @@ -6,28 +6,48 @@ from spack import * -class Zfp(CMakePackage): - """zfp is an open source C/C++ library for high-fidelity, high-throughput - lossy compression of floating-point and integer multi-dimensional +class Zfp(CMakePackage, CudaPackage): + """zfp is a compressed number format for multidimensional floating-point + and integer arrays. + + zfp provides compressed-array classes that support high throughput + read and write random access to individual array elements. zfp also + supports serial and parallel (OpenMP and CUDA) compression of whole arrays. """ - homepage = 'http://computing.llnl.gov/projects/floating-point-compression' - url = 'http://computing.llnl.gov/projects/floating-point-compression/download/zfp-0.5.2.tar.gz' - git = "https://github.com/LLNL/zfp.git" + # Package info + homepage = 'https://zfp.llnl.gov' + url = 'https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz' + git = 'https://github.com/LLNL/zfp.git' + maintainers = ['lindstro', 'GarrettDMorrison'] + # Versions version('develop', branch='develop') version('0.5.5', sha256='fdf7b948bab1f4e5dccfe2c2048fd98c24e417ad8fb8a51ed3463d04147393c5') - version('0.5.4', sha256='768a05ed9bf10e54ac306f90b81dd17b0e7b13782f01823d7da4394fd2da8adb') - version('0.5.2', sha256='89e718edb966422b5898b5c37b1b0a781d4effacb511520558469e3ff7f65d7c') - version('0.5.1', sha256='867c04cf965f1c70d9725b396c6e1b5d29db55b0d69b8e87a995aaebd221b830') + version('0.5.4', sha256='746e17aaa401c67dcffd273d6e6f95c76adfbbd5cf523dcad56d09e9d3b71196') + version('0.5.3', sha256='a5d2f8e5b47a7c92e2a5775b82cbfb3a76c87d0ac83d25abb4ac10ea75a2856e') + version('0.5.2', sha256='9c738ec525cc76b4bb80b2b3f7c9f07507eeda3a341470e5942cda97efbe9a4f', url='https://github.com/LLNL/zfp/archive/0.5.2/zfp-0.5.2.tar.gz') + version('0.5.1', sha256='f255dd1708c9ae4dc6a56dd2614e8b47a10d833c87fd349cbd47545a19c2b779', url='https://github.com/LLNL/zfp/archive/0.5.1/zfp-0.5.1.tar.gz') - variant('bsws', - default='64', - values=('8', '16', '32', '64'), - multi=False, - description='Bit stream word size: use smaller for finer ' - 'rate granularity. Use 8 for H5Z-ZFP filter.') + # Build targets + # TODO: variant('utilities', default=True, description='Build utilities') + variant('shared', default=True, description='Build shared libraries') + + # Language bindings + variant('c', default=False, description='Enable C bindings') + variant('python', default=False, description='Enable Python bindings') + variant('fortran', default=False, description='Enable Fortran bindings') + + # Execution policies + variant('openmp', default=False, description='Enable OpenMP execution') + variant('cuda', default=False, description='Enable CUDA execution') + + # Advanced options + variant('bsws', default='64', values=('8', '16', '32', '64'), multi=False, + description='Bit stream word size: ' + 'use smaller for finer rate granularity. ' + 'Use 8 for H5Z-ZFP filter.') variant('strided', default=False, description='Enable strided access for progressive zfp streams') variant('aligned', default=False, @@ -38,32 +58,47 @@ class Zfp(CMakePackage): description='Use a faster but more collision prone hash function') variant('profile', default=False, description='Count cache misses') - variant('shared', default=True, - description='Build shared versions of the library') + # Conflicts + conflicts('+c', when='@:0.5.3', + msg='+c requires zfp 0.5.4 or later') + conflicts('+python', when='@:0.5.4', + msg='+python requires zfp 0.5.5 or later') + conflicts('+fortran', when='@:0.5.4', + msg='+fortran requires zfp 0.5.5 or later') + conflicts('+openmp', when='@:0.5.2', + msg='+openmp requires zfp 0.5.3 or later') + conflicts('+cuda', when='@:0.5.3', + msg='+cuda requires zfp 0.5.4 or later') + conflicts('+fasthash', when='@:0.5.1', + msg='+fasthash requires zfp 0.5.2 or later') + conflicts('+profile', when='@:0.5.1', + msg='+profile requires zfp 0.5.2 or later') + + # Dependencies depends_on('cmake@3.4.0:', type='build') + depends_on('cuda@7:', type=('build', 'test', 'run'), when='+cuda') + depends_on('py-numpy', type=('build', 'test', 'run'), when='+python') + depends_on('py-cython', type='build', when='+python') def cmake_args(self): spec = self.spec + # CMake options args = [ - '-DZFP_BIT_STREAM_WORD_SIZE:STRING={0}'.format( - spec.variants['bsws'].value), - '-DZFP_WITH_BIT_STREAM_STRIDED:BOOL={0}'.format( - 'ON' if '+strided' in spec else 'OFF'), - '-DZFP_WITH_ALIGNED_ALLOC:BOOL={0}'.format( - 'ON' if '+aligned' in spec else 'OFF'), - '-DZFP_WITH_CACHE_TWOWAY:BOOL={0}'.format( - 'ON' if '+twoway' in spec else 'OFF'), - '-DBUILD_SHARED_LIBS:BOOL={0}'.format( - 'ON' if '+shared' in spec else 'OFF'), - '-DBUILD_TESTING:BOOL={0}'.format( - 'ON' if self.run_tests else 'OFF') + # TODO: self.define_from_variant('BUILD_UTILITIES', 'utilities'), + self.define('BUILD_TESTING', self.run_tests), + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define_from_variant('BUILD_CFP', 'c'), + self.define_from_variant('BUILD_ZFPY', 'python'), + self.define_from_variant('BUILD_ZFORP', 'fortran'), + self.define('ZFP_BIT_STREAM_WORD_SIZE', + spec.variants['bsws'].value), + self.define_from_variant('ZFP_WITH_BIT_STREAM_STRIDED', 'strided'), + self.define_from_variant('ZFP_WITH_ALIGNED_ALLOC', 'aligned'), + self.define_from_variant('ZFP_WITH_CACHE_TWOWAY', 'twoway'), + self.define_from_variant('ZFP_WITH_CACHE_FAST_HASH', 'fasthash'), + self.define_from_variant('ZFP_WITH_CACHE_PROFILE', 'profile') ] - if spec.version >= Version('0.5.2'): - args.append('-DZFP_WITH_CACHE_FAST_HASH:BOOL={0}'.format( - 'ON' if '+fasthash' in spec else 'OFF')) - args.append('-DZFP_WITH_CACHE_PROFILE:BOOL={0}'.format( - 'ON' if '+profile' in spec else 'OFF')) return args