From 751503c434bd249ed9f76b6ad353d2adcdcc3997 Mon Sep 17 00:00:00 2001
From: Gregory Becker <becker33@llnl.gov>
Date: Tue, 5 Jan 2016 14:47:14 -0800
Subject: fixed haswell targeting bug

---
 lib/spack/spack/architectures/cray.py | 17 ++++++++++++-----
 lib/spack/spack/compilers/__init__.py |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

(limited to 'lib')

diff --git a/lib/spack/spack/architectures/cray.py b/lib/spack/spack/architectures/cray.py
index 47ede30145..dac3943fb7 100644
--- a/lib/spack/spack/architectures/cray.py
+++ b/lib/spack/spack/architectures/cray.py
@@ -17,15 +17,22 @@ class Cray(Architecture):
 
         # Handle the default here so we can check for a key error
         if 'CRAY_CPU_TARGET' in os.environ:
-            default = os.environ['CRAY_CPU_TARGET']
+            self.default = os.environ['CRAY_CPU_TARGET']
+
+        # Change the defaults to haswell if we're on an XC40
+        if self.default == 'haswell':
+            self.front_end = self.default
+            self.back_end = self.default
 
-        # Back End compiler needs the proper target module loaded.
-        self.add_target(self.back_end, Target(self.front_end,'craype-'+ self.back_end))
-        self.add_target(self.default, Target(self.default,'craype-' + self.default))
         # Could switch to use modules and fe targets for front end
         # Currently using compilers by path for front end.
         self.add_target(self.front_end, Target(self.front_end))
-
+        # Back End compiler needs the proper target module loaded.
+        self.add_target(self.back_end, Target(self.front_end,'craype-'+ self.back_end))
+        self.add_target(self.default, Target(self.default,'craype-' + self.default))
+        # This is kludgy and the order matters when the targets are all haswell
+        # This is because the last one overwrites the others when they have the
+        # same name.
 
     @classmethod
     def detect(self):
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 87106282cf..21a41f38ea 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -206,6 +206,7 @@ def compilers_for_spec(compiler_spec):
         return cls(cspec, compiler_paths, mods)
 
     matches = find(compiler_spec)
+    print matches, 'matches'
     return [get_compiler(cspec) for cspec in matches]
 
 
-- 
cgit v1.2.3-70-g09d2