hiop: update constraints and add new version (#26905)

* Update hiop package dependencies

* Use single quotes to shrink diff

* add hiop 0.5.1

* apply flake8

* Apply formatting suggestions
This commit is contained in:
Asher Mancinelli 2021-10-26 09:43:03 -06:00 committed by GitHub
parent fb1f3b1a1c
commit 94a9733822
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,15 +9,16 @@
class Hiop(CMakePackage, CudaPackage): class Hiop(CMakePackage, CudaPackage):
"""HiOp is an optimization solver for solving certain mathematical """HiOp is an optimization solver for solving certain mathematical
optimization problems expressed as nonlinear programming problems. optimization problems expressed as nonlinear programming problems.
HiOp is a lightweight HPC solver that leverages application's existing HiOp is a lightweight HPC solver that leverages application"s existing
data parallelism to parallelize the optimization iterations by using data parallelism to parallelize the optimization iterations by using
specialized linear algebra kernels.""" specialized linear algebra kernels."""
homepage = "https://github.com/LLNL/hiop" homepage = 'https://github.com/LLNL/hiop'
git = "https://github.com/LLNL/hiop.git" git = 'https://github.com/LLNL/hiop.git'
maintainers = ['ashermancinelli', 'CameronRutherford'] maintainers = ['ashermancinelli', 'CameronRutherford']
# Most recent tagged snapshot is the preferred version when profiling. # Most recent tagged snapshot is the preferred version when profiling.
version('0.5.1', commit='6789bbb55824e68e428c2df1009d647af81f9cf1')
version('0.5.0', commit='a39da8025037c7c8ae2eb31234eb80cc73bec2af') version('0.5.0', commit='a39da8025037c7c8ae2eb31234eb80cc73bec2af')
version('0.4.6', commit='b72d163d52c9225c3196ceb2baebdc7cf09a69de') version('0.4.6', commit='b72d163d52c9225c3196ceb2baebdc7cf09a69de')
version('0.4.5', commit='c353580456c4776c50811b97cf8ff802dc27b90c') version('0.4.5', commit='c353580456c4776c50811b97cf8ff802dc27b90c')
@ -39,23 +40,19 @@ class Hiop(CMakePackage, CudaPackage):
version('develop', branch='develop') version('develop', branch='develop')
variant( variant(
'jsrun', 'jsrun', default=False, description='Enable/Disable jsrun command for testing'
default=False, )
description='Enable/Disable jsrun command for testing') variant('shared', default=False, description='Enable/Disable shared libraries')
variant(
'shared',
default=False,
description='Enable/Disable shared libraries')
variant('mpi', default=True, description='Enable/Disable MPI') variant('mpi', default=True, description='Enable/Disable MPI')
variant('raja', default=False, description='Enable/Disable RAJA') variant('raja', default=False, description='Enable/Disable RAJA')
variant('kron', default=False, description='Enable/Disable Kron reduction') variant('kron', default=False, description='Enable/Disable Kron reduction')
variant('sparse', default=False, description='Enable/Disable Sparse linear algebra')
variant( variant(
'sparse', 'deepchecking',
default=False, default=False,
description='Enable/Disable Sparse linear algebra')
variant('deepchecking', default=False,
description='Ultra safety checks - ' description='Ultra safety checks - '
'used for increased robustness and self-diagnostics') 'used for increased robustness and self-diagnostics',
)
depends_on('lapack') depends_on('lapack')
depends_on('blas') depends_on('blas')
@ -68,71 +65,75 @@ class Hiop(CMakePackage, CudaPackage):
depends_on('magma@2.6.1:', when='@0.4.6:+cuda') depends_on('magma@2.6.1:', when='@0.4.6:+cuda')
depends_on('raja+openmp', when='+raja') depends_on('raja+openmp', when='+raja')
depends_on('raja@0.14.0:', when='@0.5.0:+raja')
depends_on('raja+cuda', when='+raja+cuda') depends_on('raja+cuda', when='+raja+cuda')
depends_on('umpire+cuda', when='+raja+cuda') depends_on('umpire', when='+raja')
depends_on('umpire+cuda~shared', when='+raja+cuda')
depends_on('suite-sparse', when='+kron') depends_on('suite-sparse', when='+kron')
depends_on('coinhsl+blas', when='+sparse') depends_on('coinhsl+blas', when='+sparse')
depends_on('metis', when='+sparse') depends_on('metis', when='+sparse')
conflicts(
'+shared',
when='+cuda+raja',
msg='umpire+cuda exports device code and requires static libs',
)
flag_handler = build_system_flags flag_handler = build_system_flags
def cmake_args(self): def cmake_args(self):
args = [] args = []
spec = self.spec spec = self.spec
lapack_blas_libs = (
spec['lapack'].libs + spec['blas'].libs).joined(';')
args.extend([ args.extend([
'-DLAPACK_FOUND=TRUE', self.define('HIOP_BUILD_STATIC', True),
'-DLAPACK_LIBRARIES={0}'.format(lapack_blas_libs) self.define('LAPACK_FOUND', True),
self.define('LAPACK_LIBRARIES', spec['lapack'].libs + spec['blas'].libs),
self.define('HIOP_USE_HIP', False),
self.define_from_variant('HIOP_BUILD_SHARED', 'shared'),
self.define_from_variant('HIOP_USE_MPI', 'mpi'),
self.define_from_variant('HIOP_DEEPCHECKS', 'deepchecking'),
self.define_from_variant('HIOP_USE_GPU', 'cuda'),
self.define_from_variant('HIOP_USE_CUDA', 'cuda'),
self.define_from_variant('HIOP_USE_MAGMA', 'cuda'),
self.define_from_variant('HIOP_USE_RAJA', 'raja'),
self.define_from_variant('HIOP_USE_UMPIRE', 'raja'),
self.define_from_variant('HIOP_WITH_KRON_REDUCTION', 'kron'),
self.define_from_variant('HIOP_SPARSE', 'sparse'),
self.define_from_variant('HIOP_USE_COINHSL', 'sparse'),
self.define_from_variant('HIOP_TEST_WITH_BSUB', 'jsrun'),
]) ])
args.append(self.define_from_variant('HIOP_BUILD_SHARED', 'shared'))
args.append(self.define_from_variant('HIOP_USE_MPI', 'mpi'))
args.append(self.define_from_variant('HIOP_DEEPCHECKS', 'deepchecking'))
args.append(self.define_from_variant('HIOP_USE_GPU', 'cuda'))
args.append(self.define_from_variant('HIOP_USE_CUDA', 'cuda'))
args.append(self.define_from_variant('HIOP_USE_MAGMA', 'cuda'))
args.append(self.define_from_variant('HIOP_USE_RAJA', 'raja'))
args.append(self.define_from_variant('HIOP_USE_UMPIRE', 'raja'))
args.append(self.define_from_variant('HIOP_WITH_KRON_REDUCTION', 'kron'))
args.append(self.define_from_variant('HIOP_SPARSE', 'sparse'))
args.append(self.define_from_variant('HIOP_USE_COINHSL', 'sparse'))
args.append(self.define_from_variant('HIOP_TEST_WITH_BSUB', 'jsrun'))
if '+mpi' in spec: if '+mpi' in spec:
args.append('-DMPI_HOME={0}'.format(spec['mpi'].prefix)) args.extend([
args.append('-DMPI_C_COMPILER={0}'.format(spec['mpi'].mpicc)) self.define('MPI_HOME', spec['mpi'].prefix),
args.append('-DMPI_CXX_COMPILER={0}'.format(spec['mpi'].mpicxx)) self.define('MPI_C_COMPILER', spec['mpi'].mpicc),
args.append('-DMPI_Fortran_COMPILER={0}'.format(spec['mpi'].mpifc)) self.define('MPI_CXX_COMPILER', spec['mpi'].mpicxx),
self.define('MPI_Fortran_COMPILER', spec['mpi'].mpifc),
# HIP flags are a part of the buildsystem, but full support is not ])
# yet ready for public release
args.append("-DHIOP_USE_HIP=OFF")
if '+cuda' in spec: if '+cuda' in spec:
cuda_arch_list = spec.variants['cuda_arch'].value cuda_arch_list = spec.variants['cuda_arch'].value
cuda_arch = cuda_arch_list[0] cuda_arch = cuda_arch_list[0]
if cuda_arch != 'none': if cuda_arch != 'none':
args.append("-DHIOP_NVCC_ARCH=sm_{0}".format(cuda_arch)) args.extend([
args.append("-DCMAKE_CUDA_ARCHITECTURES={0}".format(cuda_arch)) self.define('HIOP_NVCC_ARCH', 'sm_{0}'.format(cuda_arch)),
self.define('CMAKE_CUDA_ARCHITECTURES', cuda_arch),
])
if '+magma' in spec: if '+magma' in spec:
args.append( args.append(self.define('HIOP_MAGMA_DIR', spec['magma'].prefix))
"-DHIOP_MAGMA_DIR={0}".format(spec['magma'].prefix))
if '+kron' in spec: if '+kron' in spec:
args.append( args.append(self.define('HIOP_UMFPACK_DIR', spec['suite-sparse'].prefix))
"-DHIOP_UMFPACK_DIR={0}".format(spec['suite-sparse'].prefix))
# Unconditionally disable strumpack, even when +sparse. This may be # Unconditionally disable strumpack, even when +sparse. This may be
# used in place of COINHSL for sparse interface, however this is not # used in place of COINHSL for sparse interface, however this is not
# fully supported in spack at the moment. # fully supported in spack at the moment.
args.append("-DHIOP_USE_STRUMPACK=OFF") args.append(self.define('HIOP_USE_STRUMPACK', False))
if '+sparse' in spec: if '+sparse' in spec:
args.append( args.append(self.define('HIOP_COINHSL_DIR', spec['coinhsl'].prefix))
"-DHIOP_COINHSL_DIR={0}".format(spec['coinhsl'].prefix))
return args return args