From 62977662e93bd8b29f34d5baa1a0d851147085a6 Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Wed, 12 Sep 2018 20:18:41 +0200 Subject: [PATCH] petsc: fix compilation with intel (#9198) * mpiifort doesn't automatically link all run-time libraries * scalapack was being picked up accidentaly if intel-mkl was in the spec --- var/spack/repos/builtin/packages/petsc/package.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index a376303e04..07dfb09745 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -186,8 +186,12 @@ def mpi_dependent_options(self): compiler_opts = [ '--with-cc=%s' % self.spec['mpi'].mpicc, '--with-cxx=%s' % self.spec['mpi'].mpicxx, - '--with-fc=%s' % self.spec['mpi'].mpifc + '--with-fc=%s' % self.spec['mpi'].mpifc, ] + if self.spec.satisfies('%intel'): + # mpiifort needs some help to automatically link + # all necessary run-time libraries + compiler_opts.append('--FC_LINKER_FLAGS=-lintlc') return compiler_opts def install(self, spec, prefix): @@ -226,8 +230,9 @@ def install(self, spec, prefix): else: options.append('--with-clanguage=C') - # Help PETSc pick up Scalapack from MKL: - if 'scalapack' in spec: + # PETSc depends on scalapack when '+mumps+mpi~int64' (see depends()) + # help PETSc pick up Scalapack from MKL + if spec.satisfies('+mumps+mpi~int64'): scalapack = spec['scalapack'].libs options.extend([ '--with-scalapack-lib=%s' % scalapack.joined(),