PETSc: add fortran variant to allow builds without fortran (#29800)
This commit is contained in:
parent
1e437bbc66
commit
fc00119e52
@ -113,11 +113,11 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
|||||||
# which is not portable to all HPC systems
|
# which is not portable to all HPC systems
|
||||||
variant('mumps', default=False,
|
variant('mumps', default=False,
|
||||||
description='Activates support for MUMPS (only parallel)')
|
description='Activates support for MUMPS (only parallel)')
|
||||||
variant('superlu-dist', default=True,
|
variant('superlu-dist', default=True, when='+fortran',
|
||||||
description='Activates support for SuperluDist (only parallel)')
|
description='Activates support for superlu-dist (only parallel)')
|
||||||
variant('strumpack', default=False,
|
variant('strumpack', default=False,
|
||||||
description='Activates support for Strumpack')
|
description='Activates support for Strumpack')
|
||||||
variant('scalapack', default=False,
|
variant('scalapack', default=False, when='+fortran',
|
||||||
description='Activates support for Scalapack')
|
description='Activates support for Scalapack')
|
||||||
variant('trilinos', default=False,
|
variant('trilinos', default=False,
|
||||||
description='Activates support for Trilinos (only parallel)')
|
description='Activates support for Trilinos (only parallel)')
|
||||||
@ -170,6 +170,8 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
|||||||
description='Activates support for hwloc')
|
description='Activates support for hwloc')
|
||||||
variant('kokkos', default=False,
|
variant('kokkos', default=False,
|
||||||
description='Activates support for kokkos and kokkos-kernels')
|
description='Activates support for kokkos and kokkos-kernels')
|
||||||
|
variant('fortran', default=True,
|
||||||
|
description='Activates fortran support')
|
||||||
|
|
||||||
# 3.8.0 has a build issue with MKL - so list this conflict explicitly
|
# 3.8.0 has a build issue with MKL - so list this conflict explicitly
|
||||||
conflicts('^intel-mkl', when='@3.8.0')
|
conflicts('^intel-mkl', when='@3.8.0')
|
||||||
@ -199,6 +201,12 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
|||||||
'petscvariables', relative_root='lib/petsc/conf'
|
'petscvariables', relative_root='lib/petsc/conf'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@run_before('configure')
|
||||||
|
def check_fortran_compiler(self):
|
||||||
|
# Raise error if +fortran and there isn't a fortran compiler!
|
||||||
|
if '+fortran' in self.spec and self.compiler.fc is None:
|
||||||
|
raise InstallError("+fortran requires a fortran compiler!")
|
||||||
|
|
||||||
# temporary workaround Clang 8.1.0 with XCode 8.3 on macOS, see
|
# temporary workaround Clang 8.1.0 with XCode 8.3 on macOS, see
|
||||||
# https://bitbucket.org/petsc/petsc/commits/4f290403fdd060d09d5cb07345cbfd52670e3cbc
|
# https://bitbucket.org/petsc/petsc/commits/4f290403fdd060d09d5cb07345cbfd52670e3cbc
|
||||||
# the patch is an adaptation of the original commit to 3.7.5
|
# the patch is an adaptation of the original commit to 3.7.5
|
||||||
@ -261,6 +269,9 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
|||||||
depends_on('mmg', when='+mmg')
|
depends_on('mmg', when='+mmg')
|
||||||
depends_on('parmmg', when='+parmmg')
|
depends_on('parmmg', when='+parmmg')
|
||||||
depends_on('tetgen+pic', when='+tetgen')
|
depends_on('tetgen+pic', when='+tetgen')
|
||||||
|
# hypre+/~fortran based on wheter fortran is enabled/disabled
|
||||||
|
depends_on('hypre+fortran', when='+hypre+fortran')
|
||||||
|
depends_on('hypre~fortran', when='+hypre~fortran')
|
||||||
# Hypre does not support complex numbers.
|
# Hypre does not support complex numbers.
|
||||||
# Also PETSc prefer to build it without internal superlu, likely due to
|
# Also PETSc prefer to build it without internal superlu, likely due to
|
||||||
# conflict in headers see
|
# conflict in headers see
|
||||||
@ -344,16 +355,21 @@ def mpi_dependent_options(self):
|
|||||||
'--with-cc=%s' % os.environ['CC'],
|
'--with-cc=%s' % os.environ['CC'],
|
||||||
'--with-cxx=%s' % (os.environ['CXX']
|
'--with-cxx=%s' % (os.environ['CXX']
|
||||||
if self.compiler.cxx is not None else '0'),
|
if self.compiler.cxx is not None else '0'),
|
||||||
'--with-fc=%s' % (os.environ['FC']
|
|
||||||
if self.compiler.fc is not None else '0'),
|
|
||||||
'--with-mpi=0'
|
'--with-mpi=0'
|
||||||
]
|
]
|
||||||
|
if '+fortran' in self.spec:
|
||||||
|
compiler_opts.append('--with-fc=%s' % os.environ['FC'])
|
||||||
|
else:
|
||||||
|
compiler_opts.append('--with-fc=0')
|
||||||
else:
|
else:
|
||||||
compiler_opts = [
|
compiler_opts = [
|
||||||
'--with-cc=%s' % self.spec['mpi'].mpicc,
|
'--with-cc=%s' % self.spec['mpi'].mpicc,
|
||||||
'--with-cxx=%s' % self.spec['mpi'].mpicxx,
|
'--with-cxx=%s' % self.spec['mpi'].mpicxx,
|
||||||
'--with-fc=%s' % self.spec['mpi'].mpifc,
|
|
||||||
]
|
]
|
||||||
|
if '+fortran' in self.spec:
|
||||||
|
compiler_opts.append('--with-fc=%s' % self.spec['mpi'].mpifc)
|
||||||
|
else:
|
||||||
|
compiler_opts.append('--with-fc=0')
|
||||||
if self.spec.satisfies('%intel'):
|
if self.spec.satisfies('%intel'):
|
||||||
# mpiifort needs some help to automatically link
|
# mpiifort needs some help to automatically link
|
||||||
# all necessary run-time libraries
|
# all necessary run-time libraries
|
||||||
@ -415,6 +431,12 @@ def configure_options(self):
|
|||||||
jpeg_sp = spec['jpeg'].name if 'jpeg' in spec else 'jpeg'
|
jpeg_sp = spec['jpeg'].name if 'jpeg' in spec else 'jpeg'
|
||||||
scalapack_sp = spec['scalapack'].name if 'scalapack' in spec else 'scalapack'
|
scalapack_sp = spec['scalapack'].name if 'scalapack' in spec else 'scalapack'
|
||||||
|
|
||||||
|
# to be used in the list of libraries below
|
||||||
|
if '+fortran' in spec:
|
||||||
|
hdf5libs = ':hl,fortran'
|
||||||
|
else:
|
||||||
|
hdf5libs = ':hl'
|
||||||
|
|
||||||
# tuple format (spacklibname, petsclibname, useinc, uselib)
|
# tuple format (spacklibname, petsclibname, useinc, uselib)
|
||||||
# default: 'gmp', => ('gmp', 'gmp', True, True)
|
# default: 'gmp', => ('gmp', 'gmp', True, True)
|
||||||
# any other combination needs a full tuple
|
# any other combination needs a full tuple
|
||||||
@ -432,7 +454,7 @@ def configure_options(self):
|
|||||||
('scotch', 'ptscotch', True, True),
|
('scotch', 'ptscotch', True, True),
|
||||||
('suite-sparse:umfpack,klu,cholmod,btf,ccolamd,colamd,camd,amd, \
|
('suite-sparse:umfpack,klu,cholmod,btf,ccolamd,colamd,camd,amd, \
|
||||||
suitesparseconfig,spqr', 'suitesparse', True, True),
|
suitesparseconfig,spqr', 'suitesparse', True, True),
|
||||||
('hdf5:hl,fortran', 'hdf5', True, True),
|
('hdf5' + hdf5libs, 'hdf5', True, True),
|
||||||
'zlib',
|
'zlib',
|
||||||
'mumps',
|
'mumps',
|
||||||
('trilinos', 'trilinos', False, False),
|
('trilinos', 'trilinos', False, False),
|
||||||
|
Loading…
Reference in New Issue
Block a user