petsc: add a +mkl-pardiso variant (#21219)

* petsc: add a +mkl-pardiso variant

mkl_pardiso solver is distributed with intel-mkl

* petsc: depend on mkl instead of intel-mkl

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
lpoirel 2021-01-24 19:09:35 +01:00 committed by GitHub
parent 8f45b27836
commit 88cafacd09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,8 @@ class Petsc(Package):
description='Activates support for SuperluDist (only parallel)') description='Activates support for SuperluDist (only parallel)')
variant('trilinos', default=False, variant('trilinos', default=False,
description='Activates support for Trilinos (only parallel)') description='Activates support for Trilinos (only parallel)')
variant('mkl-pardiso', default=False,
description='Activates support for MKL Pardiso')
variant('int64', default=False, variant('int64', default=False,
description='Compile with 64bit indices') description='Compile with 64bit indices')
variant('clanguage', default='C', values=('C', 'C++'), variant('clanguage', default='C', values=('C', 'C++'),
@ -243,6 +245,7 @@ class Petsc(Package):
depends_on('trilinos@12.6.2:+mpi', when='@3.7.0:+trilinos+mpi') depends_on('trilinos@12.6.2:+mpi', when='@3.7.0:+trilinos+mpi')
depends_on('trilinos@xsdk-0.2.0+mpi', when='@xsdk-0.2.0+trilinos+mpi') depends_on('trilinos@xsdk-0.2.0+mpi', when='@xsdk-0.2.0+trilinos+mpi')
depends_on('trilinos@develop+mpi', when='@xdevelop+trilinos+mpi') depends_on('trilinos@develop+mpi', when='@xdevelop+trilinos+mpi')
depends_on('mkl', when='+mkl-pardiso')
depends_on('fftw+mpi', when='+fftw+mpi') depends_on('fftw+mpi', when='+fftw+mpi')
depends_on('suite-sparse', when='+suite-sparse') depends_on('suite-sparse', when='+suite-sparse')
depends_on('libx11', when='+X') depends_on('libx11', when='+X')
@ -449,6 +452,11 @@ def install(self, spec, prefix):
else: else:
options.append('--with-zlib=0') options.append('--with-zlib=0')
if '+mkl-pardiso' in spec:
options.append(
'--with-mkl_pardiso-dir=%s' % spec['mkl'].prefix
)
python('configure', '--prefix=%s' % prefix, *options) python('configure', '--prefix=%s' % prefix, *options)
# PETSc has its own way of doing parallel make. # PETSc has its own way of doing parallel make.
@ -497,6 +505,13 @@ def install(self, spec, prefix):
'-pc_type', 'hypre', '-pc_type', 'hypre',
'-pc_hypre_type', 'boomeramg') '-pc_hypre_type', 'boomeramg')
if 'mkl-pardiso' in spec:
run('ex50',
'-da_grid_x', '4',
'-da_grid_y', '4',
'-pc_type', 'lu',
'-pc_factor_mat_solver_package', 'mkl_pardiso')
def setup_build_environment(self, env): def setup_build_environment(self, env):
# configure fails if these env vars are set outside of Spack # configure fails if these env vars are set outside of Spack
env.unset('PETSC_DIR') env.unset('PETSC_DIR')