From 88cafacd09a2c9ec7244d00f229771ef5e6a483f Mon Sep 17 00:00:00 2001 From: lpoirel Date: Sun, 24 Jan 2021 19:09:35 +0100 Subject: [PATCH] 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 Co-authored-by: Adam J. Stewart --- var/spack/repos/builtin/packages/petsc/package.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index ebb775db31..27dd497951 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -92,6 +92,8 @@ class Petsc(Package): description='Activates support for SuperluDist (only parallel)') variant('trilinos', default=False, description='Activates support for Trilinos (only parallel)') + variant('mkl-pardiso', default=False, + description='Activates support for MKL Pardiso') variant('int64', default=False, description='Compile with 64bit indices') 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@xsdk-0.2.0+mpi', when='@xsdk-0.2.0+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('suite-sparse', when='+suite-sparse') depends_on('libx11', when='+X') @@ -449,6 +452,11 @@ def install(self, spec, prefix): else: 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) # PETSc has its own way of doing parallel make. @@ -497,6 +505,13 @@ def install(self, spec, prefix): '-pc_type', 'hypre', '-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): # configure fails if these env vars are set outside of Spack env.unset('PETSC_DIR')