2021-04-23 13:23:09 +08:00
|
|
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
2021-04-07 19:48:46 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
|
|
|
from spack import *
|
|
|
|
|
|
|
|
|
|
|
|
class Exago(CMakePackage, CudaPackage):
|
|
|
|
"""ExaGO is a package for solving large-scale power grid optimization
|
|
|
|
problems on parallel and distributed architectures, particularly targeted
|
|
|
|
for exascale machines."""
|
|
|
|
|
|
|
|
homepage = 'https://gitlab.pnnl.gov/exasgd/frameworks/exago'
|
|
|
|
git = 'https://gitlab.pnnl.gov/exasgd/frameworks/exago.git'
|
2021-11-09 18:35:10 +08:00
|
|
|
maintainers = ['ashermancinelli', 'CameronRutherford']
|
2021-04-07 19:48:46 +08:00
|
|
|
|
2021-12-16 10:23:36 +08:00
|
|
|
version('1.2.0', commit='255a214e', submodules=True)
|
2021-12-04 05:59:16 +08:00
|
|
|
version('1.1.2', commit='db3bb16e', submodules=True)
|
|
|
|
version('1.1.1', commit='0e0a3f27', submodules=True)
|
|
|
|
version('1.1.0', commit='dc8dd855', submodules=True)
|
|
|
|
version('1.0.0', commit='230d7df2')
|
|
|
|
version('0.99.2', commit='56961641')
|
|
|
|
version('0.99.1', commit='0ae426c7')
|
2021-04-07 19:48:46 +08:00
|
|
|
version('master', branch='master')
|
2021-04-08 02:48:35 +08:00
|
|
|
version('develop', branch='develop')
|
2021-04-07 19:48:46 +08:00
|
|
|
|
|
|
|
# Progrmming model options
|
|
|
|
variant('mpi', default=True, description='Enable/Disable MPI')
|
|
|
|
variant('raja', default=False, description='Enable/Disable RAJA')
|
|
|
|
|
|
|
|
# Solver options
|
|
|
|
variant('hiop', default=False, description='Enable/Disable HiOp')
|
|
|
|
variant('ipopt', default=False, description='Enable/Disable IPOPT')
|
|
|
|
|
|
|
|
# Dependencides
|
|
|
|
depends_on('mpi', when='+mpi')
|
|
|
|
depends_on('blas')
|
|
|
|
depends_on('cuda', when='+cuda')
|
2021-12-04 05:59:16 +08:00
|
|
|
|
2021-04-07 19:48:46 +08:00
|
|
|
depends_on('raja', when='+raja')
|
|
|
|
depends_on('raja+cuda', when='+raja+cuda')
|
2021-12-04 05:59:16 +08:00
|
|
|
depends_on('raja@0.14.0:', when='@1.1.0: +raja')
|
|
|
|
|
2021-04-07 19:48:46 +08:00
|
|
|
depends_on('umpire', when='+raja')
|
2021-12-04 05:59:16 +08:00
|
|
|
depends_on('umpire@6.0.0:', when='@1.1.0: +raja')
|
2021-04-07 19:48:46 +08:00
|
|
|
|
|
|
|
# Some allocator code in Umpire only works with static libs
|
|
|
|
depends_on('umpire+cuda~shared', when='+raja+cuda')
|
|
|
|
|
|
|
|
# For some versions of RAJA package, camp cuda variant does not get set
|
|
|
|
# correctly, so we must explicitly depend on it even though we don't use
|
|
|
|
# camp
|
2021-12-16 10:23:36 +08:00
|
|
|
depends_on('camp+cuda', when='+raja+cuda')
|
2021-04-07 19:48:46 +08:00
|
|
|
|
|
|
|
depends_on('cmake@3.18:', type='build')
|
|
|
|
|
|
|
|
# HiOp dependency logic
|
|
|
|
depends_on('hiop+raja', when='+hiop+raja')
|
|
|
|
depends_on('hiop@0.3.99:', when='@0.99:+hiop')
|
2021-12-04 05:59:16 +08:00
|
|
|
depends_on('hiop@0.5.1:', when='@1.1.0:+hiop')
|
2021-04-07 19:48:46 +08:00
|
|
|
depends_on('hiop+cuda', when='+hiop+cuda')
|
|
|
|
depends_on('hiop~mpi', when='+hiop~mpi')
|
|
|
|
depends_on('hiop+mpi', when='+hiop+mpi')
|
|
|
|
|
2021-05-21 15:20:58 +08:00
|
|
|
# Require PETSc < 3.15 per ExaGO issue #199
|
2021-12-16 10:23:36 +08:00
|
|
|
depends_on('petsc@3.13:3.14')
|
|
|
|
depends_on('petsc~mpi', when='~mpi')
|
|
|
|
|
2021-04-07 19:48:46 +08:00
|
|
|
depends_on('ipopt', when='+ipopt')
|
|
|
|
|
|
|
|
flag_handler = build_system_flags
|
|
|
|
|
|
|
|
def cmake_args(self):
|
|
|
|
args = []
|
|
|
|
spec = self.spec
|
|
|
|
|
|
|
|
args.append("-DEXAGO_RUN_TESTS=ON")
|
|
|
|
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_MPI', 'mpi'))
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_RAJA', 'raja'))
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_HIOP', 'hiop'))
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_IPOPT', 'ipopt'))
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_GPU', 'cuda'))
|
|
|
|
args.append(self.define_from_variant('EXAGO_ENABLE_CUDA', 'cuda'))
|
2021-12-16 10:23:36 +08:00
|
|
|
args.append("-DPETSC_DIR='{0}'".format(spec['petsc'].prefix))
|
2021-04-07 19:48:46 +08:00
|
|
|
|
|
|
|
if '+cuda' in spec:
|
|
|
|
cuda_arch_list = spec.variants['cuda_arch'].value
|
|
|
|
cuda_arch = cuda_arch_list[0]
|
|
|
|
if cuda_arch != 'none':
|
|
|
|
args.append(
|
|
|
|
"-DCMAKE_CUDA_ARCHITECTURES={0}".format(cuda_arch))
|
|
|
|
|
|
|
|
return args
|