[Trilinos] Make MPI optional (#16685)

* Make MPI optional for Trilinos

* Use 'define' and 'define_from_variant' in trilinos package
This commit is contained in:
Seth R. Johnson 2020-05-22 15:40:21 -04:00 committed by GitHub
parent 7449bf8bab
commit 106a121b83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,6 +100,8 @@ class Trilinos(CMakePackage):
description='Compile with Matio') description='Compile with Matio')
variant('metis', default=True, variant('metis', default=True,
description='Compile with METIS and ParMETIS') description='Compile with METIS and ParMETIS')
variant('mpi', default=True,
description='Compile with MPI parallelism')
variant('mumps', default=True, variant('mumps', default=True,
description='Compile with support for MUMPS solvers') description='Compile with support for MUMPS solvers')
variant('netcdf', default=True, variant('netcdf', default=True,
@ -334,11 +336,11 @@ class Trilinos(CMakePackage):
depends_on('zlib', when="+zlib") depends_on('zlib', when="+zlib")
# MPI related dependencies # MPI related dependencies
depends_on('mpi') depends_on('mpi', when='+mpi')
depends_on('netcdf-c+mpi', when="+netcdf~pnetcdf") depends_on('netcdf-c+mpi', when="+netcdf~pnetcdf+mpi")
depends_on('netcdf-c+mpi+parallel-netcdf', when="+netcdf+pnetcdf@master,12.12.1:") depends_on('netcdf-c+mpi+parallel-netcdf', when="+netcdf+pnetcdf@master,12.12.1:")
depends_on('parallel-netcdf', when="+netcdf+pnetcdf@master,12.12.1:") depends_on('parallel-netcdf', when="+netcdf+pnetcdf@master,12.12.1:")
depends_on('parmetis', when='+metis') depends_on('parmetis', when='+metis+mpi')
depends_on('cgns', when='+cgns') depends_on('cgns', when='+cgns')
depends_on('adios2', when='+adios2') depends_on('adios2', when='+adios2')
# Trilinos' Tribits config system is limited which makes it very tricky to # Trilinos' Tribits config system is limited which makes it very tricky to
@ -361,11 +363,16 @@ class Trilinos(CMakePackage):
depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre') depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre')
depends_on('hypre@develop~internal-superlu', when='@develop+hypre') depends_on('hypre@develop~internal-superlu', when='@develop+hypre')
# We need hdf5+hl to match with netcdf during concretization # We need hdf5+hl to match with netcdf during concretization
depends_on('hdf5+hl+mpi', when='+hdf5') depends_on('hdf5+hl+mpi', when='+hdf5+mpi')
depends_on('python', when='+python') depends_on('python', when='+python')
depends_on('py-numpy', when='+python', type=('build', 'run')) depends_on('py-numpy', when='+python', type=('build', 'run'))
depends_on('swig', when='+python') depends_on('swig', when='+python')
# Dependencies/conflicts when MPI is disabled
depends_on('hdf5+hl~mpi', when='+hdf5~mpi')
conflicts('+parmetis', when='~mpi')
conflicts('+pnetcdf', when='~mpi')
patch('umfpack_from_suitesparse.patch', when='@11.14.1:12.8.1') patch('umfpack_from_suitesparse.patch', when='@11.14.1:12.8.1')
patch('xlf_seacas.patch', when='@12.10.1:12.12.1 %xl') patch('xlf_seacas.patch', when='@12.10.1:12.12.1 %xl')
patch('xlf_seacas.patch', when='@12.10.1:12.12.1 %xl_r') patch('xlf_seacas.patch', when='@12.10.1:12.12.1 %xl_r')
@ -381,441 +388,359 @@ def url_for_version(self, version):
def cmake_args(self): def cmake_args(self):
spec = self.spec spec = self.spec
define = CMakePackage.define
def define_trilinos_enable(cmake_var, spec_var=None):
if spec_var is None:
spec_var = cmake_var.lower()
return self.define_from_variant(
'Trilinos_ENABLE_' + cmake_var, spec_var)
def define_tpl_enable(cmake_var, spec_var=None):
if spec_var is None:
spec_var = cmake_var.lower()
return self.define_from_variant('TPL_ENABLE_' + cmake_var,
spec_var)
cxx_flags = [] cxx_flags = []
options = [] options = []
# #################### Base Settings ####################### # #################### Base Settings #######################
mpi_bin = spec['mpi'].prefix.bin
options.extend([ options.extend([
'-DTrilinos_VERBOSE_CONFIGURE:BOOL=OFF', define('Trilinos_VERBOSE_CONFIGURE', False),
'-DTrilinos_ENABLE_TESTS:BOOL=OFF', define('Trilinos_ENABLE_TESTS', False),
'-DTrilinos_ENABLE_EXAMPLES:BOOL=OFF', define('Trilinos_ENABLE_EXAMPLES', False),
'-DTrilinos_ENABLE_CXX11:BOOL=ON', define('Trilinos_ENABLE_CXX11', True),
'-DBUILD_SHARED_LIBS:BOOL=%s' % ( self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
'ON' if '+shared' in spec else 'OFF'), define_trilinos_enable('DEBUG', 'debug'),
'-DTrilinos_ENABLE_DEBUG:BOOL=%s' % (
'ON' if '+debug' in spec else 'OFF'),
# The following can cause problems on systems that don't have # The following can cause problems on systems that don't have
# static libraries available for things like dl and pthreads # static libraries available for things like dl and pthreads
# for example when trying to build static libs # for example when trying to build static libs
# '-DTPL_FIND_SHARED_LIBS:BOOL=%s' % ( # define('TPL_FIND_SHARED_LIBS', (
# 'ON' if '+shared' in spec else 'OFF'), # 'ON' if '+shared' in spec else 'OFF'))
# '-DTrilinos_LINK_SEARCH_START_STATIC:BOOL=%s' % ( # define('Trilinos_LINK_SEARCH_START_STATIC', (
# 'OFF' if '+shared' in spec else 'ON'), # 'OFF' if '+shared' in spec else 'ON'))
])
# MPI settings
options.append(define_tpl_enable('MPI'))
if '+mpi' in spec:
# Force Trilinos to use the MPI wrappers instead of raw compilers # Force Trilinos to use the MPI wrappers instead of raw compilers
# this is needed on Apple systems that require full resolution of # this is needed on Apple systems that require full resolution of
# all symbols when linking shared libraries # all symbols when linking shared libraries
'-DTPL_ENABLE_MPI:BOOL=ON', mpi_bin = spec['mpi'].prefix.bin
'-DCMAKE_C_COMPILER=%s' % spec['mpi'].mpicc, options.extend([
'-DCMAKE_CXX_COMPILER=%s' % spec['mpi'].mpicxx, define('CMAKE_C_COMPILER', spec['mpi'].mpicc),
'-DCMAKE_Fortran_COMPILER=%s' % spec['mpi'].mpifc, define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx),
'-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix define('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc),
define('MPI_BASE_DIR', spec['mpi'].prefix),
]) ])
# ################## Trilinos Packages ##################### # ################## Trilinos Packages #####################
options.extend([ options.extend([
'-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=%s' % ( define_trilinos_enable('ALL_OPTIONAL_PACKAGES', 'alloptpkgs'),
'ON' if '+alloptpkgs' in spec else 'OFF'), define_trilinos_enable('Amesos'),
'-DTrilinos_ENABLE_Amesos:BOOL=%s' % ( define_trilinos_enable('Amesos2'),
'ON' if '+amesos' in spec else 'OFF'), define_trilinos_enable('Anasazi'),
'-DTrilinos_ENABLE_Amesos2:BOOL=%s' % ( define_trilinos_enable('AztecOO', 'aztec'),
'ON' if '+amesos2' in spec else 'OFF'), define_trilinos_enable('Belos'),
'-DTrilinos_ENABLE_Anasazi:BOOL=%s' % ( define_trilinos_enable('Epetra'),
'ON' if '+anasazi' in spec else 'OFF'), define_trilinos_enable('EpetraExt'),
'-DTrilinos_ENABLE_AztecOO:BOOL=%s' % ( define_trilinos_enable('Ifpack'),
'ON' if '+aztec' in spec else 'OFF'), define_trilinos_enable('Ifpack2'),
'-DTrilinos_ENABLE_Belos:BOOL=%s' % ( define_trilinos_enable('Intrepid'),
'ON' if '+belos' in spec else 'OFF'), define_trilinos_enable('Intrepid2'),
'-DTrilinos_ENABLE_Epetra:BOOL=%s' % ( define_trilinos_enable('Isorropia'),
'ON' if '+epetra' in spec else 'OFF'), define_trilinos_enable('Kokkos'),
'-DTrilinos_ENABLE_EpetraExt:BOOL=%s' % ( define_trilinos_enable('MiniTensor'),
'ON' if '+epetraext' in spec else 'OFF'), define_trilinos_enable('Mesquite'),
'-DTrilinos_ENABLE_Ifpack:BOOL=%s' % ( define_trilinos_enable('ML'),
'ON' if '+ifpack' in spec else 'OFF'), define_trilinos_enable('MueLu'),
'-DTrilinos_ENABLE_Ifpack2:BOOL=%s' % ( define_trilinos_enable('NOX'),
'ON' if '+ifpack2' in spec else 'OFF'), define_trilinos_enable('Piro'),
'-DTrilinos_ENABLE_Intrepid=%s' % ( define_trilinos_enable('Phalanx'),
'ON' if '+intrepid' in spec else 'OFF'), define_trilinos_enable('PyTrilinos', 'python'),
'-DTrilinos_ENABLE_Intrepid2=%s' % ( define_trilinos_enable('ROL'),
'ON' if '+intrepid2' in spec else 'OFF'), define_trilinos_enable('Rythmos'),
'-DTrilinos_ENABLE_Isorropia=%s' % ( define_trilinos_enable('Sacado'),
'ON' if '+isorropia' in spec else 'OFF'), define_trilinos_enable('Shards'),
'-DTrilinos_ENABLE_Kokkos:BOOL=%s' % ( define_trilinos_enable('ShyLU'),
'ON' if '+kokkos' in spec else 'OFF'), define_trilinos_enable('STK'),
'-DTrilinos_ENABLE_MiniTensor=%s' % ( define_trilinos_enable('Teko'),
'ON' if '+minitensor' in spec else 'OFF'), define_trilinos_enable('Tempus'),
'-DTrilinos_ENABLE_Mesquite:BOOL=%s' % ( define_trilinos_enable('Teuchos'),
'ON' if '+mesquite' in spec else 'OFF'), define_trilinos_enable('Tpetra'),
'-DTrilinos_ENABLE_ML:BOOL=%s' % ( define_trilinos_enable('Zoltan'),
'ON' if '+ml' in spec else 'OFF'), define_trilinos_enable('Zoltan2'),
'-DTrilinos_ENABLE_MueLu:BOOL=%s' % (
'ON' if '+muelu' in spec else 'OFF'),
'-DTrilinos_ENABLE_NOX:BOOL=%s' % (
'ON' if '+nox' in spec else 'OFF'),
'-DTrilinos_ENABLE_Piro:BOOL=%s' % (
'ON' if '+piro' in spec else 'OFF'),
'-DTrilinos_ENABLE_Phalanx=%s' % (
'ON' if '+phalanx' in spec else 'OFF'),
'-DTrilinos_ENABLE_PyTrilinos:BOOL=%s' % (
'ON' if '+python' in spec else 'OFF'),
'-DTrilinos_ENABLE_ROL:BOOL=%s' % (
'ON' if '+rol' in spec else 'OFF'),
'-DTrilinos_ENABLE_Rythmos=%s' % (
'ON' if '+rythmos' in spec else 'OFF'),
'-DTrilinos_ENABLE_Sacado:BOOL=%s' % (
'ON' if '+sacado' in spec else 'OFF'),
'-DTrilinos_ENABLE_Shards=%s' % (
'ON' if '+shards' in spec else 'OFF'),
'-DTrilinos_ENABLE_ShyLU=%s' % (
'ON' if '+shylu' in spec else 'OFF'),
'-DTrilinos_ENABLE_Teko=%s' % (
'ON' if '+teko' in spec else 'OFF'),
'-DTrilinos_ENABLE_Tempus=%s' % (
'ON' if '+tempus' in spec else 'OFF'),
'-DTrilinos_ENABLE_Teuchos:BOOL=%s' % (
'ON' if '+teuchos' in spec else 'OFF'),
'-DTrilinos_ENABLE_Tpetra:BOOL=%s' % (
'ON' if '+tpetra' in spec else 'OFF'),
'-DTrilinos_ENABLE_Zoltan:BOOL=%s' % (
'ON' if '+zoltan' in spec else 'OFF'),
'-DTrilinos_ENABLE_Zoltan2:BOOL=%s' % (
'ON' if '+zoltan2' in spec else 'OFF'),
]) ])
if '+xsdkflags' in spec: options.append(self.define_from_variant('USE_XSDK_DEFAULTS',
options.extend(['-DUSE_XSDK_DEFAULTS=YES']) 'xsdkflags'))
if '+stk' in spec:
options.extend([
'-DTrilinos_ENABLE_STK:BOOL=ON'
])
else:
options.extend([
'-DTrilinos_ENABLE_STK:BOOL=OFF'
])
if '+dtk' in spec: if '+dtk' in spec:
options.extend([ options.extend([
'-DTrilinos_EXTRA_REPOSITORIES:STRING=DataTransferKit', define('Trilinos_EXTRA_REPOSITORIES', 'DataTransferKit'),
'-DTrilinos_ENABLE_DataTransferKit:BOOL=ON' define('Trilinos_ENABLE_DataTransferKit', True),
]) ])
if '+exodus' in spec: if '+exodus' in spec:
options.extend([ options.extend([
'-DTrilinos_ENABLE_SEACAS:BOOL=ON', define('Trilinos_ENABLE_SEACAS', True),
'-DTrilinos_ENABLE_SEACASExodus:BOOL=ON', define('Trilinos_ENABLE_SEACASExodus', True),
'-DTrilinos_ENABLE_SEACASIoss:BOOL=ON', define('Trilinos_ENABLE_SEACASIoss', True),
'-DTrilinos_ENABLE_SEACASEpu:BOOL=ON', define('Trilinos_ENABLE_SEACASEpu', True),
'-DTrilinos_ENABLE_SEACASExodiff:BOOL=ON', define('Trilinos_ENABLE_SEACASExodiff', True),
'-DTrilinos_ENABLE_SEACASNemspread:BOOL=ON', define('Trilinos_ENABLE_SEACASNemspread', True),
'-DTrilinos_ENABLE_SEACASNemslice:BOOL=ON' define('Trilinos_ENABLE_SEACASNemslice', True),
]) ])
else: else:
options.extend([ options.extend([
'-DTrilinos_ENABLE_SEACASExodus:BOOL=OFF', define('Trilinos_ENABLE_SEACASExodus', False),
'-DTrilinos_ENABLE_SEACASIoss:BOOL=OFF' define('Trilinos_ENABLE_SEACASIoss', False),
]) ])
if '+chaco' in spec: if '+chaco' in spec:
options.extend([ options.extend([
'-DTrilinos_ENABLE_SEACAS:BOOL=ON' define('Trilinos_ENABLE_SEACAS', True),
'-DTrilinos_ENABLE_SEACASChaco:BOOL=ON' define('Trilinos_ENABLE_SEACASChaco', True),
]) ])
else: else:
# don't disable SEACAS, could be needed elsewhere # don't disable SEACAS, could be needed elsewhere
options.extend([ options.extend([
'-DTrilinos_ENABLE_SEACASChaco:BOOL=OFF', define('Trilinos_ENABLE_SEACASChaco', False),
'-DTrilinos_ENABLE_SEACASNemslice=OFF' define('Trilinos_ENABLE_SEACASNemslice', False)
]) ])
# ######################### TPLs ############################# # ######################### TPLs #############################
blas = spec['blas'].libs blas = spec['blas'].libs
lapack = spec['lapack'].libs lapack = spec['lapack'].libs
# Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names
options.extend([ options.extend([
'-DTPL_ENABLE_BLAS=ON', define('TPL_ENABLE_BLAS', True),
'-DBLAS_LIBRARY_NAMES=%s' % ';'.join(blas.names), define('BLAS_LIBRARY_NAMES', blas.names),
'-DBLAS_LIBRARY_DIRS=%s' % ';'.join(blas.directories), define('BLAS_LIBRARY_DIRS', blas.directories),
'-DTPL_ENABLE_LAPACK=ON', define('TPL_ENABLE_LAPACK', True),
'-DLAPACK_LIBRARY_NAMES=%s' % ';'.join(lapack.names), define('LAPACK_LIBRARY_NAMES', lapack.names),
'-DLAPACK_LIBRARY_DIRS=%s' % ';'.join(lapack.directories), define('LAPACK_LIBRARY_DIRS', lapack.directories),
'-DTPL_ENABLE_GLM:BOOL=%s' % ('ON' if '+glm' in spec else 'OFF'), define_tpl_enable('GLM'),
'-DTPL_ENABLE_Matio:BOOL=%s' % ( define_tpl_enable('Matio'),
'ON' if '+matio' in spec else 'OFF'), define_tpl_enable('X11'),
'-DTPL_ENABLE_X11:BOOL=%s' % ( define_trilinos_enable('Gtest', 'gtest'),
'ON' if '+x11' in spec else 'OFF'),
'-DTrilinos_ENABLE_Gtest:BOOL=%s' % (
'ON' if '+gtest' in spec else 'OFF'),
]) ])
options.append(define_tpl_enable('Netcdf'))
if '+netcdf' in spec: if '+netcdf' in spec:
options.extend([ options.append(define('NetCDF_ROOT', spec['netcdf-c'].prefix))
'-DTPL_ENABLE_Netcdf:BOOL=ON',
'-DNetCDF_ROOT:PATH=%s' % spec['netcdf-c'].prefix
])
else:
options.extend(['-DTPL_ENABLE_Netcdf:BOOL=OFF'])
options.append(define_tpl_enable('HYPRE'))
if '+hypre' in spec: if '+hypre' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_HYPRE:BOOL=ON', define('HYPRE_INCLUDE_DIRS', spec['hypre'].prefix.include),
'-DHYPRE_INCLUDE_DIRS:PATH=%s' % spec['hypre'].prefix.include, define('HYPRE_LIBRARY_DIRS', spec['hypre'].prefix.lib),
'-DHYPRE_LIBRARY_DIRS:PATH=%s' % spec['hypre'].prefix.lib
]) ])
options.append(define_tpl_enable('Boost'))
if '+boost' in spec: if '+boost' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_Boost:BOOL=ON', define('Boost_INCLUDE_DIRS', spec['boost'].prefix.include),
'-DBoost_INCLUDE_DIRS:PATH=%s' % spec['boost'].prefix.include, define('Boost_LIBRARY_DIRS', spec['boost'].prefix.lib),
'-DBoost_LIBRARY_DIRS:PATH=%s' % spec['boost'].prefix.lib
]) ])
else:
options.extend(['-DTPL_ENABLE_Boost:BOOL=OFF'])
options.append(define_tpl_enable('HDF5'))
if '+hdf5' in spec: if '+hdf5' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_HDF5:BOOL=ON', define('HDF5_INCLUDE_DIRS', spec['hdf5'].prefix.include),
'-DHDF5_INCLUDE_DIRS:PATH=%s' % spec['hdf5'].prefix.include, define('HDF5_LIBRARY_DIRS', spec['hdf5'].prefix.lib),
'-DHDF5_LIBRARY_DIRS:PATH=%s' % spec['hdf5'].prefix.lib
]) ])
else:
options.extend(['-DTPL_ENABLE_HDF5:BOOL=OFF'])
if '+suite-sparse' in spec: if '+suite-sparse' in spec:
options.extend([ options.extend([
# FIXME: Trilinos seems to be looking for static libs only, # FIXME: Trilinos seems to be looking for static libs only,
# patch CMake TPL file? # patch CMake TPL file?
'-DTPL_ENABLE_Cholmod:BOOL=OFF', define('TPL_ENABLE_Cholmod', False),
# '-DTPL_ENABLE_Cholmod:BOOL=ON', # define('TPL_ENABLE_Cholmod', True),
# '-DCholmod_LIBRARY_DIRS:PATH=%s' % ( # define('Cholmod_LIBRARY_DIRS', (
# spec['suite-sparse'].prefix.lib, # spec['suite-sparse'].prefix.lib)
# '-DCholmod_INCLUDE_DIRS:PATH=%s' % ( # define('Cholmod_INCLUDE_DIRS', (
# spec['suite-sparse'].prefix.include, # spec['suite-sparse'].prefix.include)
'-DTPL_ENABLE_UMFPACK:BOOL=ON', define('TPL_ENABLE_UMFPACK', True),
'-DUMFPACK_LIBRARY_DIRS:PATH=%s' % ( define('UMFPACK_LIBRARY_DIRS',
spec['suite-sparse'].prefix.lib), spec['suite-sparse'].prefix.lib),
'-DUMFPACK_INCLUDE_DIRS:PATH=%s' % ( define('UMFPACK_INCLUDE_DIRS',
spec['suite-sparse'].prefix.include), spec['suite-sparse'].prefix.include),
'-DUMFPACK_LIBRARY_NAMES=umfpack;amd;colamd;cholmod;' + define('UMFPACK_LIBRARY_NAMES', [
'suitesparseconfig' 'umfpack', 'amd', 'colamd', 'cholmod', 'suitesparseconfig'
]),
]) ])
else: else:
options.extend([ options.extend([
'-DTPL_ENABLE_Cholmod:BOOL=OFF', define('TPL_ENABLE_Cholmod', False),
'-DTPL_ENABLE_UMFPACK:BOOL=OFF', define('TPL_ENABLE_UMFPACK', False),
]) ])
options.append(define_tpl_enable('METIS'))
options.append(define_tpl_enable('ParMETIS', 'metis'))
if '+metis' in spec: if '+metis' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_METIS:BOOL=ON', define('METIS_LIBRARY_DIRS', spec['metis'].prefix.lib),
'-DMETIS_LIBRARY_DIRS=%s' % spec['metis'].prefix.lib, define('METIS_LIBRARY_NAMES', 'metis'),
'-DMETIS_LIBRARY_NAMES=metis', define('TPL_METIS_INCLUDE_DIRS', spec['metis'].prefix.include),
'-DTPL_METIS_INCLUDE_DIRS=%s' % spec['metis'].prefix.include, define('TPL_ENABLE_ParMETIS', True),
'-DTPL_ENABLE_ParMETIS:BOOL=ON', define('ParMETIS_LIBRARY_DIRS', [
'-DParMETIS_LIBRARY_DIRS=%s;%s' % ( spec['parmetis'].prefix.lib, spec['metis'].prefix.lib
spec['parmetis'].prefix.lib, spec['metis'].prefix.lib), ]),
'-DParMETIS_LIBRARY_NAMES=parmetis;metis', define('ParMETIS_LIBRARY_NAMES', ['parmetis', 'metis']),
'-DTPL_ParMETIS_INCLUDE_DIRS=%s;%s' % ( define('TPL_ParMETIS_INCLUDE_DIRS', [
spec['parmetis'].prefix.include, spec['parmetis'].prefix.include,
spec['metis'].prefix.include) spec['metis'].prefix.include
]) ]),
else:
options.extend([
'-DTPL_ENABLE_METIS:BOOL=OFF',
'-DTPL_ENABLE_ParMETIS:BOOL=OFF',
]) ])
options.append(define_tpl_enable('MUMPS'))
options.append(define_tpl_enable('SCALAPACK', 'mumps'))
if '+mumps' in spec: if '+mumps' in spec:
scalapack = spec['scalapack'].libs scalapack = spec['scalapack'].libs
options.extend([ options.extend([
'-DTPL_ENABLE_MUMPS:BOOL=ON', define('MUMPS_LIBRARY_DIRS', spec['mumps'].prefix.lib),
'-DMUMPS_LIBRARY_DIRS=%s' % spec['mumps'].prefix.lib,
# order is important! # order is important!
'-DMUMPS_LIBRARY_NAMES=dmumps;mumps_common;pord', define('MUMPS_LIBRARY_NAMES', [
'-DTPL_ENABLE_SCALAPACK:BOOL=ON', 'dmumps', 'mumps_common', 'pord'
'-DSCALAPACK_LIBRARY_NAMES=%s' % ';'.join(scalapack.names), ]),
'-DSCALAPACK_LIBRARY_DIRS=%s' % ';'.join(scalapack.directories) define('SCALAPACK_LIBRARY_NAMES', scalapack.names),
define('SCALAPACK_LIBRARY_DIRS', scalapack.directories),
]) ])
# see # see
# https://github.com/trilinos/Trilinos/blob/master/packages/amesos/README-MUMPS # https://github.com/trilinos/Trilinos/blob/master/packages/amesos/README-MUMPS
cxx_flags.extend([ cxx_flags.extend([
'-DMUMPS_5_0' '-DMUMPS_5_0'
]) ])
else:
options.extend([
'-DTPL_ENABLE_MUMPS:BOOL=OFF',
'-DTPL_ENABLE_SCALAPACK:BOOL=OFF',
])
options.append(define_tpl_enable('SuperLUDist', 'superlu-dist'))
if '+superlu-dist' in spec: if '+superlu-dist' in spec:
options.extend([ options.extend([
'-DKokkosTSQR_ENABLE_Complex:BOOL=OFF' define('KokkosTSQR_ENABLE_Complex', False),
]) define('TPL_ENABLE_SuperLUDist', True),
options.extend([ define('SuperLUDist_LIBRARY_DIRS',
'-DTPL_ENABLE_SuperLUDist:BOOL=ON', spec['superlu-dist'].prefix.lib),
'-DSuperLUDist_LIBRARY_DIRS=%s' % define('SuperLUDist_INCLUDE_DIRS',
spec['superlu-dist'].prefix.lib, spec['superlu-dist'].prefix.include),
'-DSuperLUDist_INCLUDE_DIRS=%s' %
spec['superlu-dist'].prefix.include
]) ])
if spec.satisfies('^superlu-dist@4.0:'): if spec.satisfies('^superlu-dist@4.0:'):
options.extend([ options.extend([
'-DHAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG:BOOL=ON' define('HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG', True),
])
else:
options.extend([
'-DTPL_ENABLE_SuperLUDist:BOOL=OFF',
]) ])
options.append(define_tpl_enable('SuperLU'))
if '+superlu' in spec: if '+superlu' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_SuperLU:BOOL=ON', define('SuperLU_LIBRARY_DIRS', spec['superlu'].prefix.lib),
'-DSuperLU_LIBRARY_DIRS=%s' % define('SuperLU_INCLUDE_DIRS', spec['superlu'].prefix.include),
spec['superlu'].prefix.lib,
'-DSuperLU_INCLUDE_DIRS=%s' %
spec['superlu'].prefix.include
])
else:
options.extend([
'-DTPL_ENABLE_SuperLU:BOOL=OFF',
]) ])
options.append(define_tpl_enable('Pnetcdf'))
if '+pnetcdf' in spec: if '+pnetcdf' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_Pnetcdf:BOOL=ON', define('TPL_Netcdf_Enables_Netcdf4', True),
'-DTPL_Netcdf_Enables_Netcdf4:BOOL=ON', define('TPL_Netcdf_PARALLEL', True),
'-DTPL_Netcdf_PARALLEL:BOOL=ON', define('PNetCDF_ROOT', spec['parallel-netcdf'].prefix),
'-DPNetCDF_ROOT:PATH=%s' % spec['parallel-netcdf'].prefix
])
else:
options.extend([
'-DTPL_ENABLE_Pnetcdf:BOOL=OFF'
]) ])
options.append(define_tpl_enable('Zlib'))
if '+zlib' in spec: if '+zlib' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_Zlib:BOOL=ON', define('TPL_ENABLE_Zlib', True),
'-DZlib_ROOT:PATH=%s' % spec['zlib'].prefix, define('Zlib_ROOT', spec['zlib'].prefix),
])
else:
options.extend([
'-DTPL_ENABLE_Zlib:BOOL=OFF'
]) ])
options.append(define_tpl_enable('CGNS'))
if '+cgns' in spec: if '+cgns' in spec:
options.extend([ options.extend([
'-DTPL_ENABLE_CGNS:BOOL=ON', define('TPL_ENABLE_CGNS', True),
'-DCGNS_INCLUDE_DIRS:PATH=%s' % spec['cgns'].prefix.include, define('CGNS_INCLUDE_DIRS', spec['cgns'].prefix.include),
'-DCGNS_LIBRARY_DIRS:PATH=%s' % spec['cgns'].prefix.lib define('CGNS_LIBRARY_DIRS', spec['cgns'].prefix.lib),
])
else:
options.extend([
'-DTPL_ENABLE_CGNS:BOOL=OFF'
]) ])
options.append('-DTPL_ENABLE_ADIOS2:BOOL=' + str('+adios2' in spec)) options.append(self.define_from_variant('TPL_ENABLE_ADIOS2', 'adios2'))
# ################# Miscellaneous Stuff ###################### # ################# Miscellaneous Stuff ######################
# OpenMP # OpenMP
options.append(define_trilinos_enable('OpenMP'))
if '+openmp' in spec: if '+openmp' in spec:
options.extend([ options.append(define('Kokkos_ENABLE_OpenMP', True))
'-DTrilinos_ENABLE_OpenMP:BOOL=ON',
'-DKokkos_ENABLE_OpenMP:BOOL=ON'
])
if '+tpetra' in spec: if '+tpetra' in spec:
options.extend([ options.append(define('Tpetra_INST_OPENMP', True))
'-DTpetra_INST_OPENMP:BOOL=ON'
])
# Fortran lib # Fortran lib (assumes clang is built with gfortran!)
if '+fortran' in spec: if '+fortran' in spec and (
if spec.satisfies('%gcc') or spec.satisfies('%clang'): spec.satisfies('%gcc') or spec.satisfies('%clang')):
options.append(define('Trilinos_ENABLE_Fortran', True))
if '+mpi' in spec:
libgfortran = os.path.dirname(os.popen( libgfortran = os.path.dirname(os.popen(
'%s --print-file-name libgfortran.a' % '%s --print-file-name libgfortran.a' %
join_path(mpi_bin, 'mpif90')).read()) join_path(mpi_bin, 'mpif90')).read())
options.extend([ options.append(define(
'-DTrilinos_EXTRA_LINK_FLAGS:STRING=-L%s/ -lgfortran' % ( 'Trilinos_EXTRA_LINK_FLAGS',
libgfortran), '-L%s/ -lgfortran' % (libgfortran),
'-DTrilinos_ENABLE_Fortran=ON' ))
])
float_s = 'ON' if '+float' in spec else 'OFF' float_s = '+float' in spec
complex_s = 'ON' if '+complex' in spec else 'OFF' complex_s = '+complex' in spec
complex_float_s = 'ON' if ('+complex' in spec and
'+float' in spec) else 'OFF'
if '+teuchos' in spec: if '+teuchos' in spec:
options.extend([ options.extend([
'-DTeuchos_ENABLE_COMPLEX=%s' % complex_s, define('Teuchos_ENABLE_COMPLEX', complex_s),
'-DTeuchos_ENABLE_FLOAT=%s' % float_s define('Teuchos_ENABLE_FLOAT', float_s),
]) ])
# Explicit Template Instantiation (ETI) in Tpetra # Explicit Template Instantiation (ETI) in Tpetra
# NOTE: Trilinos will soon move to fixed std::uint64_t for GO and # NOTE: Trilinos will soon move to fixed std::uint64_t for GO and
# std::int32_t or std::int64_t for local. # std::int32_t or std::int64_t for local.
options.append( options.append(self.define_from_variant(
'-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=%s' % ( 'Trilinos_ENABLE_EXPLICIT_INSTANTIATION',
'ON' if '+explicit_template_instantiation' in spec else 'OFF' 'explicit_template_instantiation'))
)
)
if '+explicit_template_instantiation' in spec and '+tpetra' in spec: if '+explicit_template_instantiation' in spec and '+tpetra' in spec:
gotype = spec.variants['gotype'].value gotype = spec.variants['gotype'].value
options.extend([ options.extend([
'-DTpetra_INST_DOUBLE:BOOL=ON', define('Tpetra_INST_DOUBLE', True),
'-DTpetra_INST_INT_INT:BOOL=%s' % ( define('Tpetra_INST_INT_INT', gotype == 'int'),
'ON' if gotype == 'int' else 'OFF'), define('Tpetra_INST_INT_LONG', gotype == 'long'),
'-DTpetra_INST_INT_LONG:BOOL=%s' % ( define('Tpetra_INST_INT_LONG_LONG', gotype == 'long_long'),
'ON' if gotype == 'long' else 'OFF'), define('Tpetra_INST_COMPLEX_DOUBLE', complex_s),
'-DTpetra_INST_INT_LONG_LONG:BOOL=%s' % ( define('Tpetra_INST_COMPLEX_FLOAT', float_s and complex_s),
'ON' if gotype == 'long_long' else 'OFF'), define('Tpetra_INST_FLOAT', float_s),
'-DTpetra_INST_COMPLEX_DOUBLE=%s' % complex_s, define('Tpetra_INST_SERIAL', True),
'-DTpetra_INST_COMPLEX_FLOAT=%s' % complex_float_s,
'-DTpetra_INST_FLOAT=%s' % float_s,
'-DTpetra_INST_SERIAL=ON'
]) ])
# disable due to compiler / config errors: # disable due to compiler / config errors:
if spec.satisfies('%xl') or spec.satisfies('%xl_r'): if spec.satisfies('%xl') or spec.satisfies('%xl_r'):
options.extend([ options.extend([
'-DTrilinos_ENABLE_Pamgen:BOOL=OFF', define('Trilinos_ENABLE_Pamgen', False),
'-DTrilinos_ENABLE_Stokhos:BOOL=OFF' define('Trilinos_ENABLE_Stokhos', False),
]) ])
if sys.platform == 'darwin': if sys.platform == 'darwin':
options.extend([ options.append(define('Trilinos_ENABLE_FEI', False))
'-DTrilinos_ENABLE_FEI=OFF'
])
if sys.platform == 'darwin' and macos_version() >= Version('10.12'): if sys.platform == 'darwin' and macos_version() >= Version('10.12'):
# use @rpath on Sierra due to limit of dynamic loader # use @rpath on Sierra due to limit of dynamic loader
options.append('-DCMAKE_MACOSX_RPATH=ON') options.append(define('CMAKE_MACOSX_RPATH', True))
else: else:
options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s' % options.append(define('CMAKE_INSTALL_NAME_DIR', self.prefix.lib))
self.prefix.lib)
if spec.satisfies('%intel') and spec.satisfies('@12.6.2'): if spec.satisfies('%intel') and spec.satisfies('@12.6.2'):
# Panzer uses some std:chrono that is not recognized by Intel # Panzer uses some std:chrono that is not recognized by Intel
# Don't know which (maybe all) Trilinos versions this applies to # Don't know which (maybe all) Trilinos versions this applies to
# Don't know which (maybe all) Intel versions this applies to # Don't know which (maybe all) Intel versions this applies to
options.extend([ options.append(define('Trilinos_ENABLE_Panzer', False))
'-DTrilinos_ENABLE_Panzer:BOOL=OFF'
])
# collect CXX flags: # collect CXX flags:
options.extend([ options.append(define('CMAKE_CXX_FLAGS', (' '.join(cxx_flags))))
'-DCMAKE_CXX_FLAGS:STRING=%s' % (' '.join(cxx_flags)),
])
# disable due to compiler / config errors: # disable due to compiler / config errors:
options.extend([ options.append(define('Trilinos_ENABLE_Pike', False))
'-DTrilinos_ENABLE_Pike=OFF'
])
return options return options