From 3b24db92b5ea64814b1294fc6c9c982bbaa9b3c6 Mon Sep 17 00:00:00 2001
From: Erik Schnetter <schnetter@gmail.com>
Date: Thu, 17 Mar 2016 13:43:40 -0400
Subject: Update PAPI to 5.4.3

---
 var/spack/repos/builtin/packages/papi/package.py | 1 +
 1 file changed, 1 insertion(+)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py
index 910e0aa9f9..53d69e28d9 100644
--- a/var/spack/repos/builtin/packages/papi/package.py
+++ b/var/spack/repos/builtin/packages/papi/package.py
@@ -13,6 +13,7 @@ class Papi(Package):
     homepage = "http://icl.cs.utk.edu/papi/index.html"
 
     url      = "http://icl.cs.utk.edu/projects/papi/downloads/papi-5.4.1.tar.gz"
+    version('5.4.3', '3211b5a5bb389fe692370f5cf4cc2412')
     version('5.4.1', '9134a99219c79767a11463a76b0b01a2')
     version('5.3.0', '367961dd0ab426e5ae367c2713924ffb')
 
-- 
cgit v1.2.3-70-g09d2


From ed0b5e649dd6bc480e3faa6ffcca121eb9e264b8 Mon Sep 17 00:00:00 2001
From: "Kelly (KT) Thompson" <kgt@lanl.gov>
Date: Fri, 18 Mar 2016 15:54:26 -0600
Subject: + Provide fpic variant for netlib-lapack.

---
 var/spack/repos/builtin/packages/netlib-lapack/package.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py
index 741f4af421..78c5a053fe 100644
--- a/var/spack/repos/builtin/packages/netlib-lapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py
@@ -20,13 +20,13 @@ class NetlibLapack(Package):
     version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
 
     variant('shared', default=False, description="Build shared library version")
+    variant('fpic', default=False, description="Build with -fpic compiler option")
 
     # virtual dependency
     provides('lapack')
 
     # blas is a virtual dependency.
     depends_on('blas')
-
     depends_on('cmake')
 
     # Doesn't always build correctly in parallel
@@ -37,24 +37,23 @@ class NetlibLapack(Package):
         blas = self.spec['netlib-blas']
         return [join_path(blas.prefix.lib, 'blas.a')]
 
-
     @when('^atlas')
     def get_blas_libs(self):
         blas = self.spec['atlas']
         return [join_path(blas.prefix.lib, l)
                 for l in ('libf77blas.a', 'libatlas.a')]
 
-
     def install(self, spec, prefix):
         blas_libs = ";".join(self.get_blas_libs())
         cmake_args = [".", '-DBLAS_LIBRARIES=' + blas_libs]
 
         if '+shared' in spec:
             cmake_args.append('-DBUILD_SHARED_LIBS=ON')
+        if '+fpic' in spec:
+            cmake_args.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')
 
         cmake_args += std_cmake_args
 
         cmake(*cmake_args)
         make()
         make("install")
-
-- 
cgit v1.2.3-70-g09d2


From db61a09cf14cc791d7692aac0329e8958b228fb6 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Fri, 18 Mar 2016 16:28:36 +0100
Subject: fix mumps: when installed with parmetis has to be linked with metis

---
 var/spack/repos/builtin/packages/mumps/package.py | 28 +++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
index 44a37903cc..5c120c37df 100644
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -20,10 +20,10 @@ class Mumps(Package):
     variant('complex', default=True, description='Activate the compilation of cmumps and/or zmumps')
     variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
 
-    
+
     depends_on('scotch + esmumps', when='~ptscotch+scotch')
     depends_on('scotch + esmumps + mpi', when='+ptscotch')
-    depends_on('metis', when='~parmetis+metis')
+    depends_on('metis', when='+metis')
     depends_on('parmetis', when="+parmetis")
     depends_on('blas')
     depends_on('lapack')
@@ -38,11 +38,11 @@ class Mumps(Package):
     def write_makefile_inc(self):
         if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
             raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
-        
+
         makefile_conf = ["LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib]
 
         orderings = ['-Dpord']
-        
+
         if '+ptscotch' in self.spec or '+scotch' in self.spec:
             join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
             makefile_conf.extend(
@@ -54,15 +54,19 @@ class Mumps(Package):
             if '+ptscotch' in self.spec:
                 orderings.append('-Dptscotch')
 
-        if '+parmetis' in self.spec or '+metis' in self.spec:
+        if '+parmetis' in self.spec and '+metis' in self.spec:
             libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
             makefile_conf.extend(
-                ["IMETIS = -I%s" % self.spec[libname].prefix.include,
-                 "LMETIS = -L%s -l%s" % (self.spec[libname].prefix.lib, libname)])
+                ["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
+                 "LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
+
+            orderings.append('-Dparmetis')
+        elif '+metis' in self.spec:
+            makefile_conf.extend(
+                ["IMETIS = -I%s" % self.spec['metis'].prefix.include,
+                 "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
 
             orderings.append('-Dmetis')
-            if '+parmetis' in self.spec:
-                orderings.append('-Dparmetis')
 
         makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
 
@@ -101,12 +105,12 @@ class Mumps(Package):
         # compiler possible values are -DAdd_, -DAdd__ and/or -DUPPER
         makefile_conf.append("CDEFS   = -DAdd_")
 
-        
+
         makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
                                           'Makefile.inc')
         with open(makefile_inc_template, "r") as fh:
             makefile_conf.extend(fh.read().split('\n'))
-        
+
         with working_dir('.'):
             with open("Makefile.inc", "w") as fh:
                 makefile_inc = '\n'.join(makefile_conf)
@@ -130,7 +134,7 @@ class Mumps(Package):
                 make_libs.append('zexamples')
 
         self.write_makefile_inc()
-                
+
         make(*make_libs)
 
         install_tree('lib', prefix.lib)
-- 
cgit v1.2.3-70-g09d2


From 7b283bfaffa5509915d91392878203bba8a8d2cb Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Mon, 21 Mar 2016 07:48:17 +0100
Subject: fix petsc on osx

---
 var/spack/repos/builtin/packages/petsc/package.py | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index efe172fc08..7239baaf7f 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -61,14 +61,24 @@ class Petsc(Package):
                 errors = ['incompatible variants given'] + errors
                 raise RuntimeError('\n'.join(errors))
         else:
-            compiler_opts = [
-                '--with-mpi=1',
-                '--with-mpi-dir=%s' % self.spec['mpi'].prefix,
-            ]
+            if self.compiler.name == "clang":
+                compiler_opts = [
+                    '--with-mpi=1',
+                    '--with-cc=%s  -Qunused-arguments' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # Avoid confusing PETSc config by clang: warning: argument unused during compilation
+                    '--with-cxx=%s -Qunused-arguments' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
+                    '--with-fc=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
+                    '--with-f77=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif77'),
+                ]
+            else:
+                compiler_opts = [
+                    '--with-mpi=1',
+                    '--with-mpi-dir=%s' % self.spec['mpi'].prefix,
+                ]
         return compiler_opts
 
     def install(self, spec, prefix):
-        options = []
+        options = ['--with-debugging=0',
+                   '--with-ssl=0']
         options.extend(self.mpi_dependent_options())
         options.extend([
             '--with-precision=%s' % ('double' if '+double' in spec else 'single'),
-- 
cgit v1.2.3-70-g09d2


From b926d8a0cdcf47de029e372cf15e281266930378 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Mon, 21 Mar 2016 14:33:00 +0100
Subject: build parmetis against external metis

---
 .../packages/parmetis/enable_external_metis.patch  | 13 ++++++++++++
 .../repos/builtin/packages/parmetis/package.py     | 24 ++++------------------
 2 files changed, 17 insertions(+), 20 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/parmetis/enable_external_metis.patch

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/parmetis/enable_external_metis.patch b/var/spack/repos/builtin/packages/parmetis/enable_external_metis.patch
new file mode 100644
index 0000000000..514781b8b8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/parmetis/enable_external_metis.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ca945dd..1bf94e9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -33,7 +33,7 @@ include_directories(${GKLIB_PATH})
+ include_directories(${METIS_PATH}/include)
+
+ # List of directories that cmake will look for CMakeLists.txt
+-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
++#add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
+ add_subdirectory(include)
+ add_subdirectory(libparmetis)
+ add_subdirectory(programs)
diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py
index c897dec7e4..3f18dd76b8 100644
--- a/var/spack/repos/builtin/packages/parmetis/package.py
+++ b/var/spack/repos/builtin/packages/parmetis/package.py
@@ -25,9 +25,6 @@
 
 from spack import *
 
-# FIXME : lot of code is duplicated from packages/metis/package.py . Inheriting from there may reduce
-# FIXME : the installation rules to just a few lines
-
 
 class Parmetis(Package):
     """
@@ -43,13 +40,11 @@ class Parmetis(Package):
     variant('debug', default=False, description='Builds the library in debug mode')
     variant('gdb', default=False, description='Enables gdb support')
 
-    variant('idx64', default=False, description='Use int64_t as default index type')
-    variant('double', default=False, description='Use double precision floating point types')
-
     depends_on('cmake @2.8:')  # build dependency
     depends_on('mpi')
 
-    # FIXME : this should conflict with metis as it builds its own version internally
+    patch('enable_external_metis.patch')
+    depends_on('metis')
 
     depends_on('gdb', when='+gdb')
 
@@ -63,8 +58,8 @@ class Parmetis(Package):
 
         # FIXME : Once a contract is defined, MPI compilers should be retrieved indirectly via spec['mpi'] in case
         # FIXME : they use a non-standard name
-        options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source),
-                        '-DMETIS_PATH:PATH={metis_source}'.format(metis_source=metis_source),
+        options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source), # still need headers from METIS source, and they are not installed with METIS. shame...
+                        '-DMETIS_PATH:PATH={metis_source}'.format(metis_source=spec['metis'].prefix),
                         '-DCMAKE_C_COMPILER:STRING=mpicc',
                         '-DCMAKE_CXX_COMPILER:STRING=mpicxx'])
 
@@ -78,18 +73,7 @@ class Parmetis(Package):
         if '+gdb' in spec:
             options.append('-DGDB:BOOL=ON')
 
-        metis_header = join_path(metis_source, 'include', 'metis.h')
-
-        if '+idx64' in spec:
-            filter_file('IDXTYPEWIDTH 32', 'IDXTYPEWIDTH 64', metis_header)
-
-        if '+double' in spec:
-            filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header)
-
         with working_dir(build_directory, create=True):
             cmake(source_directory, *options)
             make()
             make("install")
-            # Parmetis build system doesn't allow for an external metis to be used, but doesn't copy the required
-            # metis header either
-            install(metis_header, self.prefix.include)
-- 
cgit v1.2.3-70-g09d2


From 3fcaf5b9031c3d55b152844b97cd432078340f4b Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Mon, 21 Mar 2016 14:47:05 +0100
Subject: llvm : update to 3.8.0

---
 var/spack/repos/builtin/packages/llvm/package.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index 280e400f69..5c38b5b88c 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -132,6 +132,21 @@ class Llvm(Package):
                         'llvm-libunwind' : 'http://llvm.org/svn/llvm-project/libunwind/trunk',
                         }
                   },
+                  {
+                    'version' : '3.8.0',
+                    'md5':'07a7a74f3c6bd65de4702bf941b511a0',
+                    'resources' : {
+                        'compiler-rt' : 'd6fcbe14352ffb708e4d1ac2e48bb025',
+                        'openmp' : '8fd7cc35d48051613cf1e750e9f22e40',
+                        'polly' : '1b3b20f52d34a4024e21a4ea7112caa7',
+                        'libcxx' : 'd6e0bdbbee39f7907ad74fd56d03b88a',
+                        'libcxxabi' : 'bbe6b4d72c7c5978550d370af529bcf7',
+                        'clang' : 'cc99e7019bb74e6459e80863606250c5',
+                        'clang-tools-extra' : 'c2344f50e0eea0b402f0092a80ddc036',
+                        'lldb' : 'a5da35ed9cc8c8817ee854e3dbfba00e',
+                        'llvm-libunwind' : '162ade468607f153cca12be90b5194fa',
+                        }
+                  },
                   {
                     'version' : '3.7.1',
                     'md5':'bf8b3a2c79e61212c5409041dfdbd319',
-- 
cgit v1.2.3-70-g09d2


From 3a3443dff63167fc0331672871af4c0cc1fe5903 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Mon, 21 Mar 2016 15:14:48 +0100
Subject: parmetis patches by PETSc developers

---
 .../repos/builtin/packages/parmetis/package.py     |  6 ++
 ...-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch | 77 ++++++++++++++++++++++
 ...-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch | 35 ++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 var/spack/repos/builtin/packages/parmetis/pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch
 create mode 100644 var/spack/repos/builtin/packages/parmetis/pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py
index 3f18dd76b8..c691cf4191 100644
--- a/var/spack/repos/builtin/packages/parmetis/package.py
+++ b/var/spack/repos/builtin/packages/parmetis/package.py
@@ -46,6 +46,12 @@ class Parmetis(Package):
     patch('enable_external_metis.patch')
     depends_on('metis')
 
+    # bug fixes from PETSc developers
+    # https://bitbucket.org/petsc/pkg-parmetis/commits/1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b/raw/
+    patch('pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch')
+    # https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/
+    patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch')
+
     depends_on('gdb', when='+gdb')
 
     def install(self, spec, prefix):
diff --git a/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch b/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch
new file mode 100644
index 0000000000..e6b8056c21
--- /dev/null
+++ b/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch
@@ -0,0 +1,77 @@
+From 1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b Mon Sep 17 00:00:00 2001
+From: Jed Brown <jed@59A2.org>
+Date: Fri, 12 Oct 2012 15:45:10 -0500
+Subject: [PATCH] ParMetis bug fixes reported by John Fettig [petsc-maint
+ #133631]
+
+'''
+I have also reported to to Karypis but have received zero
+response and he hasn't released any updates to the original release
+either.  At least he approved my forum posting so that other people
+can see the bug and the fix.
+http://glaros.dtc.umn.edu/gkhome/node/837
+'''
+
+Hg-commit: 1c2b9fe39201d404b493885093b5992028b9b8d4
+---
+ libparmetis/xyzpart.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
+index 3a2c289..63abfcb 100644
+--- a/libparmetis/xyzpart.c
++++ b/libparmetis/xyzpart.c
+@@ -104,7 +104,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+ 
+     for (i=0; i<nbins; i++)
+       emarkers[i] = gmin + (gmax-gmin)*i/nbins;
+-    emarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
++    emarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
+ 
+     /* get into a iterative backet boundary refinement */
+     for (l=0; l<5; l++) {
+@@ -152,7 +152,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+         }
+       }
+       nemarkers[0]     = gmin;
+-      nemarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
++      nemarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
+       rcopy(nbins+1, nemarkers, emarkers);
+     }
+ 
+@@ -218,7 +218,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+ 
+     emarkers[0] = gmin;
+     emarkers[1] = gsum/gnvtxs;
+-    emarkers[2] = gmax*(1.0+2.0*REAL_EPSILON);
++    emarkers[2] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
+     cnbins = 2;
+ 
+     /* get into a iterative backet boundary refinement */
+@@ -227,7 +227,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+       iset(cnbins, 0, lcounts);
+       rset(cnbins, 0, lsums);
+       for (j=0, i=0; i<nvtxs;) {
+-        if (cand[i].key < emarkers[j+1]) {
++        if (cand[i].key <= emarkers[j+1]) {
+           lcounts[j]++;
+           lsums[j] += cand[i].key;
+           i++;
+@@ -272,12 +272,12 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+       
+       rsorti(cnbins, nemarkers);
+       rcopy(cnbins, nemarkers, emarkers);
+-      emarkers[cnbins] = gmax*(1.0+2.0*REAL_EPSILON);
++      emarkers[cnbins] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
+     }
+ 
+     /* assign the coordinate to the appropriate bin */
+     for (j=0, i=0; i<nvtxs;) {
+-      if (cand[i].key < emarkers[j+1]) {
++      if (cand[i].key <= emarkers[j+1]) {
+         bxyz[cand[i].val*ndims+k] = j;
+         i++;
+       }
+-- 
+2.1.1.1.g1fb337f
+
diff --git a/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch b/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch
new file mode 100644
index 0000000000..9651d55347
--- /dev/null
+++ b/var/spack/repos/builtin/packages/parmetis/pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch
@@ -0,0 +1,35 @@
+From 82409d68aa1d6cbc70740d0f35024aae17f7d5cb Mon Sep 17 00:00:00 2001
+From: Sean Farley <sean@mcs.anl.gov>
+Date: Tue, 20 Mar 2012 11:59:44 -0500
+Subject: [PATCH] parmetis: fix bug reported by jfettig; '<' to '<=' in xyzpart
+
+Hg-commit: 2dd2eae596acaabbc80e0ef875182616f868dbc2
+---
+ libparmetis/xyzpart.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
+index 307aed9..3a2c289 100644
+--- a/libparmetis/xyzpart.c
++++ b/libparmetis/xyzpart.c
+@@ -111,7 +111,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+       /* determine bucket counts */
+       iset(nbins, 0, lcounts);
+       for (j=0, i=0; i<nvtxs;) {
+-        if (cand[i].key < emarkers[j+1]) {
++        if (cand[i].key <= emarkers[j+1]) {
+           lcounts[j]++;
+           i++;
+         }
+@@ -158,7 +158,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
+ 
+     /* assign the coordinate to the appropriate bin */
+     for (j=0, i=0; i<nvtxs;) {
+-      if (cand[i].key < emarkers[j+1]) {
++      if (cand[i].key <= emarkers[j+1]) {
+         bxyz[cand[i].val*ndims+k] = j;
+         i++;
+       }
+-- 
+2.1.1.1.g1fb337f
+
-- 
cgit v1.2.3-70-g09d2


From 7569204a53076f763cc713123b5e92551f647d7f Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Mon, 21 Mar 2016 16:18:02 +0100
Subject: llvm : does not support python 3

---
 var/spack/repos/builtin/packages/llvm/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index 5c38b5b88c..1d25d59e50 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -52,7 +52,7 @@ class Llvm(Package):
     depends_on('cmake @2.8.12.2:')
 
     # Universal dependency
-    depends_on('python@2.7:')
+    depends_on('python@2.7:2.8')  # Seems not to support python 3.X.Y
 
     # lldb dependencies
     depends_on('ncurses', when='+lldb')
-- 
cgit v1.2.3-70-g09d2


From 23bf70296e4a02f49c301b1b744055802b1e8dc1 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Tue, 22 Mar 2016 09:22:42 +0100
Subject: arpack: add a patch for 3.3

---
 var/spack/repos/builtin/packages/arpack-ng/package.py     |  4 ++++
 .../repos/builtin/packages/arpack-ng/pdlamch10.patch      | 15 +++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index 0b49d14202..614071cf53 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -35,6 +35,10 @@ class ArpackNg(Package):
     variant('shared', default=True, description='Enables the build of shared libraries')
     variant('mpi', default=False, description='Activates MPI support')
 
+    # The function pdlamch10 does not set the return variable. This is fixed upstream
+    # see https://github.com/opencollab/arpack-ng/issues/34
+    patch('pdlamch10.patch', when='@3.3:')
+
     depends_on('blas')
     depends_on('lapack')
     depends_on('mpi', when='+mpi')
diff --git a/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch b/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
new file mode 100644
index 0000000000..922828909f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
@@ -0,0 +1,15 @@
+diff --git a/PARPACK/SRC/MPI/pdlamch10.f b/PARPACK/SRC/MPI/pdlamch10.f
+index 6571da9..2882c2e 100644
+--- a/PARPACK/SRC/MPI/pdlamch10.f
++++ b/PARPACK/SRC/MPI/pdlamch10.f
+@@ -86,8 +86,8 @@
+           TEMP = TEMP1
+       END IF
+ *
+-      PDLAMCH = TEMP
++      PDLAMCH10 = TEMP
+ *
+-*     End of PDLAMCH
++*     End of PDLAMCH10
+ *
+       END
-- 
cgit v1.2.3-70-g09d2


From aca8b5c89de7058ab58f2eb3392e8b023b16fe8a Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Tue, 22 Mar 2016 09:27:00 +0100
Subject: move suite sparse to a proper folder

---
 .../repos/builtin/packages/SuiteSparse/package.py  | 27 ----------------------
 .../repos/builtin/packages/suite-sparse/package.py | 27 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 27 deletions(-)
 delete mode 100644 var/spack/repos/builtin/packages/SuiteSparse/package.py
 create mode 100644 var/spack/repos/builtin/packages/suite-sparse/package.py

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/SuiteSparse/package.py b/var/spack/repos/builtin/packages/SuiteSparse/package.py
deleted file mode 100644
index 6e130d118f..0000000000
--- a/var/spack/repos/builtin/packages/SuiteSparse/package.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from spack import *
-
-
-class Suitesparse(Package):
-    """
-    SuiteSparse is a suite of sparse matrix algorithms
-    """
-    homepage = 'http://faculty.cse.tamu.edu/davis/suitesparse.html'
-    url = 'http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.1.tar.gz'
-
-    version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319')
-
-    depends_on('blas')
-    depends_on('lapack')
-
-    depends_on('metis@5.1.0', when='@4.5.1')
-
-    def install(self, spec, prefix):
-        # The build system of SuiteSparse is quite old-fashioned
-        # It's basically a plain Makefile which include an header (SuiteSparse_config/SuiteSparse_config.mk)
-        # with a lot of convoluted logic in it.
-        # Any kind of customization will need to go through filtering of that file
-
-        # FIXME : this actually uses the current workaround
-        # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
-        make('install', 'INSTALL=%s' % prefix, 'BLAS=-lblas', 'LAPACK=-llapack')
-
diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
new file mode 100644
index 0000000000..6e130d118f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -0,0 +1,27 @@
+from spack import *
+
+
+class Suitesparse(Package):
+    """
+    SuiteSparse is a suite of sparse matrix algorithms
+    """
+    homepage = 'http://faculty.cse.tamu.edu/davis/suitesparse.html'
+    url = 'http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.1.tar.gz'
+
+    version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319')
+
+    depends_on('blas')
+    depends_on('lapack')
+
+    depends_on('metis@5.1.0', when='@4.5.1')
+
+    def install(self, spec, prefix):
+        # The build system of SuiteSparse is quite old-fashioned
+        # It's basically a plain Makefile which include an header (SuiteSparse_config/SuiteSparse_config.mk)
+        # with a lot of convoluted logic in it.
+        # Any kind of customization will need to go through filtering of that file
+
+        # FIXME : this actually uses the current workaround
+        # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
+        make('install', 'INSTALL=%s' % prefix, 'BLAS=-lblas', 'LAPACK=-llapack')
+
-- 
cgit v1.2.3-70-g09d2


From 3c5a1605d5e3cba881b743bf561f0966b1a3ad8b Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Tue, 22 Mar 2016 09:27:39 +0100
Subject: adjust the class name for suite sparse

---
 var/spack/repos/builtin/packages/suite-sparse/package.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index 6e130d118f..b57f9967c3 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -1,7 +1,7 @@
 from spack import *
 
 
-class Suitesparse(Package):
+class SuiteSparse(Package):
     """
     SuiteSparse is a suite of sparse matrix algorithms
     """
@@ -24,4 +24,3 @@ class Suitesparse(Package):
         # FIXME : this actually uses the current workaround
         # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
         make('install', 'INSTALL=%s' % prefix, 'BLAS=-lblas', 'LAPACK=-llapack')
-
-- 
cgit v1.2.3-70-g09d2


From cb97e8dd9301e5bbc6752caed2f4861a2a06f494 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Tue, 22 Mar 2016 09:43:10 +0100
Subject: adjust eigen and octave to use new names of suite sparse

---
 var/spack/repos/builtin/packages/eigen/package.py  | 2 +-
 var/spack/repos/builtin/packages/octave/package.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/eigen/package.py b/var/spack/repos/builtin/packages/eigen/package.py
index e40046b452..8d6e672f86 100644
--- a/var/spack/repos/builtin/packages/eigen/package.py
+++ b/var/spack/repos/builtin/packages/eigen/package.py
@@ -48,7 +48,7 @@ class Eigen(Package):
     depends_on('metis', when='+metis')
     depends_on('scotch', when='+scotch')
     depends_on('fftw', when='+fftw')
-    depends_on('SuiteSparse', when='+suitesparse')
+    depends_on('suite-sparse', when='+suitesparse')
     depends_on('mpfr@2.3.0:')  # Eigen 3.2.7 requires at least 2.3.0
     depends_on('gmp')
 
diff --git a/var/spack/repos/builtin/packages/octave/package.py b/var/spack/repos/builtin/packages/octave/package.py
index 38b355159d..6e99c23652 100644
--- a/var/spack/repos/builtin/packages/octave/package.py
+++ b/var/spack/repos/builtin/packages/octave/package.py
@@ -62,7 +62,7 @@ class Octave(Package):
     depends_on('qrupdate',    when='+qrupdate')
     #depends_on('qscintilla',  when='+qscintilla) # TODO: add package
     depends_on('qt',          when='+qt')
-    depends_on('SuiteSparse', when='+suitesparse')
+    depends_on('suite-sparse',when='+suitesparse')
     depends_on('zlib',        when='+zlib')
 
 
-- 
cgit v1.2.3-70-g09d2


From a26992ef55fed958c15b45b989fc0a4d57f02251 Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Tue, 22 Mar 2016 01:56:16 -0700
Subject: Change from PR #552: rename setup_dependent_python_module ->
 setup_dependent_package

- Fixed in package.py
- Fixed wrong prototypes in packages that use it.
- Fixed build_environment to set module variables properly
  - added hacky fix to ensure spec/package consistency in build processes.
  - Need to think about defensive spec copy done by `Repo.get`.  May be
    time to think about an immutable spec implementation.
---
 lib/spack/spack/build_environment.py               | 52 ++++++++++++++++------
 lib/spack/spack/package.py                         |  2 +-
 var/spack/repos/builtin/packages/mpich/package.py  |  2 +-
 .../builtin/packages/netlib-scalapack/package.py   | 22 ++++-----
 4 files changed, 52 insertions(+), 26 deletions(-)

(limited to 'var')

diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index fc5b7d6207..119a255a34 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -225,7 +225,7 @@ def set_module_variables_for_package(pkg, module):
     m.spack_cc  = join_path(link_dir, pkg.compiler.link_paths['cc'])
     m.spack_cxx = join_path(link_dir, pkg.compiler.link_paths['cxx'])
     m.spack_f77 = join_path(link_dir, pkg.compiler.link_paths['f77'])
-    m.spack_f90 = join_path(link_dir, pkg.compiler.link_paths['fc'])
+    m.spack_fc  = join_path(link_dir, pkg.compiler.link_paths['fc'])
 
     # Emulate some shell commands for convenience
     m.pwd          = os.getcwd
@@ -270,32 +270,56 @@ def parent_class_modules(cls):
     return result
 
 
+def setup_module_variables_for_dag(pkg):
+    """Set module-scope variables for all packages in the DAG."""
+    for spec in pkg.spec.traverse(order='post'):
+        # If a user makes their own package repo, e.g.
+        # spack.repos.mystuff.libelf.Libelf, and they inherit from
+        # an existing class like spack.repos.original.libelf.Libelf,
+        # then set the module variables for both classes so the
+        # parent class can still use them if it gets called.
+        spkg = spec.package
+        modules = parent_class_modules(spkg.__class__)
+        for mod in modules:
+            set_module_variables_for_package(spkg, mod)
+        set_module_variables_for_package(spkg, spkg.module)
+
+
 def setup_package(pkg):
     """Execute all environment setup routines."""
     spack_env = EnvironmentModifications()
     run_env   = EnvironmentModifications()
 
+    # Before proceeding, ensure that specs and packages are consistent
+    #
+    # This is a confusing behavior due to how packages are
+    # constructed.  `setup_dependent_package` may set attributes on
+    # specs in the DAG for use by other packages' install
+    # method. However, spec.package will look up a package via
+    # spack.repo, which defensively copies specs into packages.  This
+    # code ensures that all packages in the DAG have pieces of the
+    # same spec object at build time.
+    #
+    # This is safe for the build process, b/c the build process is a
+    # throwaway environment, but it is kind of dirty.
+    #
+    # TODO: Think about how to avoid this fix and do something cleaner.
+    for s in pkg.spec.traverse(): s.package.spec = s
+
     set_compiler_environment_variables(pkg, spack_env)
     set_build_environment_variables(pkg, spack_env)
-
-    # If a user makes their own package repo, e.g.
-    # spack.repos.mystuff.libelf.Libelf, and they inherit from
-    # an existing class like spack.repos.original.libelf.Libelf,
-    # then set the module variables for both classes so the
-    # parent class can still use them if it gets called.
-    modules = parent_class_modules(pkg.__class__)
-    for mod in modules:
-        set_module_variables_for_package(pkg, mod)
+    setup_module_variables_for_dag(pkg)
 
     # Allow dependencies to modify the module
-    for dependency_spec in pkg.spec.traverse(root=False):
+    spec = pkg.spec
+    for dependency_spec in spec.traverse(root=False):
         dpkg = dependency_spec.package
-        dpkg.setup_dependent_python_module(pkg.module, pkg.spec)
+        dpkg.setup_dependent_package(pkg.module, spec)
 
     # Allow dependencies to set up environment as well
-    for dependency_spec in pkg.spec.traverse(root=False):
+    for dependency_spec in spec.traverse(root=False):
         dpkg = dependency_spec.package
-        dpkg.setup_dependent_environment(spack_env, run_env, pkg.spec)
+        dpkg.setup_dependent_environment(spack_env, run_env, spec)
 
     # Allow the package to apply some settings.
     pkg.setup_environment(spack_env, run_env)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 9d8ac87bd7..9af3221837 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1075,7 +1075,7 @@ class Package(object):
         self.setup_environment(spack_env, run_env)
 
 
-    def setup_dependent_python_module(self, module, dependent_spec):
+    def setup_dependent_package(self, module, dependent_spec):
         """Set up Python module-scope variables for dependent packages.
 
         Called before the install() method of dependents.
diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py
index c4d9940bb7..b20dc8dd60 100644
--- a/var/spack/repos/builtin/packages/mpich/package.py
+++ b/var/spack/repos/builtin/packages/mpich/package.py
@@ -54,7 +54,7 @@ class Mpich(Package):
         env.set('MPICH_F90', spack_f90)
         env.set('MPICH_FC', spack_fc)
 
-    def setup_dependent_python_module(self, module, spec, dep_spec):
+    def setup_dependent_package(self, module, dep_spec):
         """For dependencies, make mpicc's use spack wrapper."""
         # FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
         module.mpicc = join_path(self.prefix.bin, 'mpicc')
diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
index 62abfcc48e..c3e6822cdf 100644
--- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
@@ -1,4 +1,5 @@
 from spack import *
+import sys
 
 class NetlibScalapack(Package):
     """ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
@@ -11,16 +12,16 @@ class NetlibScalapack(Package):
     version('2.0.0', '9e76ae7b291be27faaad47cfc256cbfe')
     # versions before 2.0.0 are not using cmake and requires blacs as
     # a separated package
-    
+
     variant('shared', default=True, description='Build the shared library version')
     variant('fpic', default=False, description="Build with -fpic compiler option")
-    
+
     provides('scalapack')
-    
+
     depends_on('mpi')
     depends_on('lapack')
-    
-    def install(self, spec, prefix):       
+
+    def install(self, spec, prefix):
         options = [
             "-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'),
             "-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else 'ON'),
@@ -40,10 +41,11 @@ class NetlibScalapack(Package):
             make()
             make("install")
 
-    def setup_dependent_python_module(self, module, spec, dependent_spec):
+    def setup_dependent_package(self, module, dependent_spec):
+        spec = self.spec
         lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
-        lib_suffix = lib_dsuffix if '+shared' in spec['scalapack'] else '.a'
+        lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
 
-        spec['scalapack'].fc_link = '-L%s -lscalapack' % spec['scalapack'].prefix.lib
-        spec['scalapack'].cc_link = spec['scalapack'].fc_link
-        spec['scalapack'].libraries = [join_path(spec['scalapack'].prefix.lib, 'libscalapack%s' % lib_suffix)]
+        spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
+        spec.cc_link = spec.fc_link
+        spec.libraries = [join_path(spec.prefix.lib, 'libscalapack%s' % lib_suffix)]
-- 
cgit v1.2.3-70-g09d2