From 9d3d49221442e102b59c3b273aecd8c95d6d0edf Mon Sep 17 00:00:00 2001
From: Barry Smith <bsmith@mcs.anl.gov>
Date: Sat, 22 Oct 2016 17:57:44 -0500
Subject: [PATCH] =?UTF-8?q?mumps:=20Add=20support=20for=20Intel=20compiler?=
 =?UTF-8?q?=20and=20insure=20both=20lapack=20and=20blas=E2=80=A6=20(#2076)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* mumps: Add support for Intel compiler and insure both lapack and blas libraries are passed to the examples

Likely it was not discoverged before that the examples require both lapack and blas libraries because it
was tested with Openblas which is one large library containing everything.
Funded-by: IDEAS
Project: IDEAS/xSDK
Time: .3 hours

* flake8 fix.
---
 var/spack/repos/builtin/packages/mumps/package.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
index 7bc113472b..fcb6549d29 100644
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -64,6 +64,7 @@ class Mumps(Package):
     depends_on('metis@5:', when='+metis')
     depends_on('parmetis', when="+parmetis")
     depends_on('blas')
+    depends_on('lapack')
     depends_on('scalapack', when='+mpi')
     depends_on('mpi', when='+mpi')
 
@@ -78,8 +79,9 @@ def write_makefile_inc(self):
             raise RuntimeError(
                 'You cannot use the variants parmetis or ptscotch without mpi')
 
-        blas = self.spec['blas'].blas_libs
-        makefile_conf = ["LIBBLAS = %s" % blas.ld_flags]
+        lapack_blas = (self.spec['lapack'].lapack_libs +
+                       self.spec['blas'].blas_libs)
+        makefile_conf = ["LIBBLAS = %s" % lapack_blas.joined()]
 
         orderings = ['-Dpord']
 
@@ -154,7 +156,13 @@ def write_makefile_inc(self):
 
         # TODO: change the value to the correct one according to the
         # compiler possible values are -DAdd_, -DAdd__ and/or -DUPPER
-        makefile_conf.append("CDEFS   = -DAdd_")
+        if self.compiler.name == 'intel':
+            # Intel Fortran compiler provides the main() function so
+            # C examples linked with the Fortran compiler require a
+            # hack defined by _DMAIN_COMP (see examples/c_example.c)
+            makefile_conf.append("CDEFS   = -DAdd_ -DMAIN_COMP")
+        else:
+            makefile_conf.append("CDEFS   = -DAdd_")
 
         if '+shared' in self.spec:
             if sys.platform == 'darwin':
-- 
GitLab