From c752af098d6f70005b5bf178bb49d5cb1f709f85 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Thu, 9 May 2019 20:54:05 -0500
Subject: [PATCH] Intel packages: multiple installs and optional scalapack libs
 (#11384)

Add fixes to support multiple installs and dependents using a subset
of IntelPackage functionality.

* Update IntelPackage to only return scalapack libraries if the root
  spec depends on MPI: scalapack requires MPI to be mentioned as a
  dependency in the DAG. Package builds using intel-mkl for its
  blas/lapack implementations but not for scalapack were failing to
  build.

  Ideally it would be possible to ask if any of the packages in the
  DAG are actually requesting the scalapack functionality provided by
  the IntelPackage and only return scalapack libs in that case, but
  that is not easily done at this time.

  Fixes #11314
  Fixes #11289

* set HOME when the intel silent installer is run. This prevents the
  installer from using the ~/intel directory (which can cause
  conflicts for multiple installs of the same IntelPackage)

  Fixes #9713
---
 lib/spack/spack/build_systems/intel.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/spack/spack/build_systems/intel.py b/lib/spack/spack/build_systems/intel.py
index 152e5eec16..36e0b966d1 100644
--- a/lib/spack/spack/build_systems/intel.py
+++ b/lib/spack/spack/build_systems/intel.py
@@ -964,7 +964,8 @@ def libs(self):
                 root=self.component_lib_dir('mpi'),
                 shared=True, recursive=True) + result
 
-        if '+mkl' in self.spec or self.provides('scalapack'):
+        if '^mpi' in self.spec.root and ('+mkl' in self.spec or
+                                         self.provides('scalapack')):
             result = self.scalapack_libs + result
 
         debug_print(result)
@@ -1199,6 +1200,9 @@ def install(self, spec, prefix):
         install_script = Executable('./install.sh')
         install_script.add_default_env('TMPDIR', tmpdir)
 
+        # Need to set HOME to avoid using ~/intel
+        install_script.add_default_env('HOME', prefix)
+
         # perform
         install_script('--silent', 'silent.cfg')
 
-- 
GitLab