From bbfc519ee5631efa4224d852d9c63446a60a8c07 Mon Sep 17 00:00:00 2001 From: Kevin Brandstatter Date: Thu, 26 Feb 2015 14:20:53 -0600 Subject: [PATCH 01/35] Added packaging files for ATLAS with and without netlib's LAPACK --- var/spack/packages/atlas/package.py | 51 ++++++++++++++++++++ var/spack/packages/lapack-atlas/package.py | 56 ++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 var/spack/packages/atlas/package.py create mode 100644 var/spack/packages/lapack-atlas/package.py diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py new file mode 100644 index 0000000000..3fe42b750e --- /dev/null +++ b/var/spack/packages/atlas/package.py @@ -0,0 +1,51 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install atlas +# +# You can always get back here to change things with: +# +# spack edit atlas +# +# See the spack documentation for more information on building +# packages. +# +from spack import * +from spack.util.executable import Executable +import os + +class Atlas(Package): + """ + Automatically Tuned Linear Algebra Software, generic shared + ATLAS is an approach for the automatic generation and optimization of + numerical software. Currently ATLAS supplies optimized versions for the + complete set of linear algebra kernels known as the Basic Linear Algebra + Subroutines (BLAS), and a subset of the linear algebra routines in the + LAPACK library. + """ + homepage = "http://math-atlas.sourceforge.net/" + url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" + + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') + + # FIXME: Add dependencies if this package requires them. + # depends_on("foo") + + def install(self, spec, prefix): + #os.mkdir('ATLAS-Build') + #os.chdir('ATLAS-Build') + with working_dir('ATLAS-Build', create=True): + self.module.configure = Executable('../configure') + # FIXME: Modify the configure line to suit your build system here. + configure("--prefix=%s" % prefix) + + # FIXME: Add logic to build and install here + make() + make('check') + make('ptcheck') + make('time') + make("install") diff --git a/var/spack/packages/lapack-atlas/package.py b/var/spack/packages/lapack-atlas/package.py new file mode 100644 index 0000000000..bdcad22b09 --- /dev/null +++ b/var/spack/packages/lapack-atlas/package.py @@ -0,0 +1,56 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install atlas +# +# You can always get back here to change things with: +# +# spack edit atlas +# +# See the spack documentation for more information on building +# packages. +# +from spack import * +from spack.util.executable import Executable +import os +import urllib + +class LapackAtlas(Package): + """ + Automatically Tuned Linear Algebra Software, generic shared + ATLAS is an approach for the automatic generation and optimization of + numerical software. Currently ATLAS supplies optimized versions for the + complete set of linear algebra kernels known as the Basic Linear Algebra + Subroutines (BLAS), and a subset of the linear algebra routines in the + LAPACK library. + """ + homepage = "http://math-atlas.sourceforge.net/" + url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" + + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') + + # FIXME: Add dependencies if this package requires them. + # depends_on("foo") + + def install(self, spec, prefix): + #os.mkdir('ATLAS-Build') + #os.chdir('ATLAS-Build') + with working_dir('ATLAS-Build', create=True): + self.module.configure = Executable('../configure') + lapack_file = 'lapack-3.5.0.tgz' + lapack = urllib.URLopener() + lapack.retrieve('http://www.netlib.org/lapack/' + lapack_file, lapack_file) + + configure("--prefix=%s" % prefix, + "--shared", + '--with-netlib-lapack-tarfile=%s' % os.getcwd() + '/' + lapack_file) + + make() + make('check') + make('ptcheck') + make('time') + make("install") From 41256e73696853a6830733b82b44416653a82d2e Mon Sep 17 00:00:00 2001 From: Kevin Brandstatter Date: Thu, 26 Feb 2015 14:57:38 -0600 Subject: [PATCH 02/35] Added packaging files for ATLAS with and without netlib's LAPACK --- var/spack/packages/atlas/package.py | 51 ++++++++++++++++++++ var/spack/packages/lapack-atlas/package.py | 56 ++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 var/spack/packages/atlas/package.py create mode 100644 var/spack/packages/lapack-atlas/package.py diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py new file mode 100644 index 0000000000..3fe42b750e --- /dev/null +++ b/var/spack/packages/atlas/package.py @@ -0,0 +1,51 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install atlas +# +# You can always get back here to change things with: +# +# spack edit atlas +# +# See the spack documentation for more information on building +# packages. +# +from spack import * +from spack.util.executable import Executable +import os + +class Atlas(Package): + """ + Automatically Tuned Linear Algebra Software, generic shared + ATLAS is an approach for the automatic generation and optimization of + numerical software. Currently ATLAS supplies optimized versions for the + complete set of linear algebra kernels known as the Basic Linear Algebra + Subroutines (BLAS), and a subset of the linear algebra routines in the + LAPACK library. + """ + homepage = "http://math-atlas.sourceforge.net/" + url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" + + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') + + # FIXME: Add dependencies if this package requires them. + # depends_on("foo") + + def install(self, spec, prefix): + #os.mkdir('ATLAS-Build') + #os.chdir('ATLAS-Build') + with working_dir('ATLAS-Build', create=True): + self.module.configure = Executable('../configure') + # FIXME: Modify the configure line to suit your build system here. + configure("--prefix=%s" % prefix) + + # FIXME: Add logic to build and install here + make() + make('check') + make('ptcheck') + make('time') + make("install") diff --git a/var/spack/packages/lapack-atlas/package.py b/var/spack/packages/lapack-atlas/package.py new file mode 100644 index 0000000000..bdcad22b09 --- /dev/null +++ b/var/spack/packages/lapack-atlas/package.py @@ -0,0 +1,56 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install atlas +# +# You can always get back here to change things with: +# +# spack edit atlas +# +# See the spack documentation for more information on building +# packages. +# +from spack import * +from spack.util.executable import Executable +import os +import urllib + +class LapackAtlas(Package): + """ + Automatically Tuned Linear Algebra Software, generic shared + ATLAS is an approach for the automatic generation and optimization of + numerical software. Currently ATLAS supplies optimized versions for the + complete set of linear algebra kernels known as the Basic Linear Algebra + Subroutines (BLAS), and a subset of the linear algebra routines in the + LAPACK library. + """ + homepage = "http://math-atlas.sourceforge.net/" + url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" + + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') + + # FIXME: Add dependencies if this package requires them. + # depends_on("foo") + + def install(self, spec, prefix): + #os.mkdir('ATLAS-Build') + #os.chdir('ATLAS-Build') + with working_dir('ATLAS-Build', create=True): + self.module.configure = Executable('../configure') + lapack_file = 'lapack-3.5.0.tgz' + lapack = urllib.URLopener() + lapack.retrieve('http://www.netlib.org/lapack/' + lapack_file, lapack_file) + + configure("--prefix=%s" % prefix, + "--shared", + '--with-netlib-lapack-tarfile=%s' % os.getcwd() + '/' + lapack_file) + + make() + make('check') + make('ptcheck') + make('time') + make("install") From 08f37d478f4b9018d99f6fcac9b82977ad6dc84d Mon Sep 17 00:00:00 2001 From: Kevin Brandstatter Date: Sun, 1 Mar 2015 21:26:37 -0600 Subject: [PATCH 03/35] Removed FIXME comments from atlas --- var/spack/packages/atlas/package.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py index 3fe42b750e..f9bf59343c 100644 --- a/var/spack/packages/atlas/package.py +++ b/var/spack/packages/atlas/package.py @@ -32,18 +32,11 @@ class Atlas(Package): version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') - # FIXME: Add dependencies if this package requires them. - # depends_on("foo") - def install(self, spec, prefix): - #os.mkdir('ATLAS-Build') - #os.chdir('ATLAS-Build') with working_dir('ATLAS-Build', create=True): self.module.configure = Executable('../configure') - # FIXME: Modify the configure line to suit your build system here. configure("--prefix=%s" % prefix) - # FIXME: Add logic to build and install here make() make('check') make('ptcheck') From 0de021d4273f5d217ad6d499018ebd453d796c19 Mon Sep 17 00:00:00 2001 From: Kevin Brandstatter Date: Tue, 3 Mar 2015 19:21:02 -0600 Subject: [PATCH 04/35] Added LAPACK package file that depends on and builds against ATLAS --- var/spack/packages/lapack/package.py | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 var/spack/packages/lapack/package.py diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py new file mode 100644 index 0000000000..682a0a1111 --- /dev/null +++ b/var/spack/packages/lapack/package.py @@ -0,0 +1,43 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install lapack +# +# You can always get back here to change things with: +# +# spack edit lapack +# +# See the spack documentation for more information on building +# packages. +# +from spack import * + +class Lapack(Package): + """ + LAPACK version 3.X is a comprehensive FORTRAN library that does + linear algebra operations including matrix inversions, least + squared solutions to linear sets of equations, eigenvector + analysis, singular value decomposition, etc. It is a very + comprehensive and reputable package that has found extensive + use in the scientific community. + """ + homepage = "http://www.netlib.org/lapack/" + url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" + + version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf') + version('3.4.2', '61bf1a8a4469d4bdb7604f5897179478') + version('3.4.1', '44c3869c38c8335c2b9c2a8bb276eb55') + version('3.4.0', '02d5706ec03ba885fc246e5fa10d8c70') + version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4') + + depends_on('atlas') + + def install(self, spec, prefix): + cmake(".", '-DBLAS_LIBRARIES=f77blas;atlas', *std_cmake_args) + + make() + make("install") From 8921d52a82c7a6eec50feb5e3138d154c7fabcbb Mon Sep 17 00:00:00 2001 From: Kevin Brandstatter Date: Tue, 3 Mar 2015 22:27:16 -0600 Subject: [PATCH 05/35] Working lapack install linking to installed ATLAS --- var/spack/packages/lapack/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py index 682a0a1111..94c05d6173 100644 --- a/var/spack/packages/lapack/package.py +++ b/var/spack/packages/lapack/package.py @@ -37,7 +37,9 @@ class Lapack(Package): depends_on('atlas') def install(self, spec, prefix): - cmake(".", '-DBLAS_LIBRARIES=f77blas;atlas', *std_cmake_args) + atlas_blas = spec['atlas'].prefix.lib + '/libf77blas.a' + atlas_lib = spec['atlas'].prefix.lib + "/libatlas.a" + cmake(".", '-DBLAS_LIBRARIES='+atlas_blas + ";" + atlas_lib, *std_cmake_args) make() make("install") From 30e45df8a52ba1232d740ea74485006dc32330e4 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 4 Mar 2015 09:34:42 -0800 Subject: [PATCH 06/35] Updates to atlas packages. --- var/spack/packages/atlas/package.py | 16 ---------------- var/spack/packages/lapack-atlas/package.py | 16 ---------------- var/spack/packages/lapack/package.py | 22 +++------------------- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py index f9bf59343c..7ee85f7f16 100644 --- a/var/spack/packages/atlas/package.py +++ b/var/spack/packages/atlas/package.py @@ -1,19 +1,3 @@ -# FIXME: -# This is a template package file for Spack. We've conveniently -# put "FIXME" labels next to all the things you'll want to change. -# -# Once you've edited all the FIXME's, delete this whole message, -# save this file, and test out your package like this: -# -# spack install atlas -# -# You can always get back here to change things with: -# -# spack edit atlas -# -# See the spack documentation for more information on building -# packages. -# from spack import * from spack.util.executable import Executable import os diff --git a/var/spack/packages/lapack-atlas/package.py b/var/spack/packages/lapack-atlas/package.py index bdcad22b09..209b02cb94 100644 --- a/var/spack/packages/lapack-atlas/package.py +++ b/var/spack/packages/lapack-atlas/package.py @@ -1,19 +1,3 @@ -# FIXME: -# This is a template package file for Spack. We've conveniently -# put "FIXME" labels next to all the things you'll want to change. -# -# Once you've edited all the FIXME's, delete this whole message, -# save this file, and test out your package like this: -# -# spack install atlas -# -# You can always get back here to change things with: -# -# spack edit atlas -# -# See the spack documentation for more information on building -# packages. -# from spack import * from spack.util.executable import Executable import os diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py index 94c05d6173..b1a41442aa 100644 --- a/var/spack/packages/lapack/package.py +++ b/var/spack/packages/lapack/package.py @@ -1,19 +1,3 @@ -# FIXME: -# This is a template package file for Spack. We've conveniently -# put "FIXME" labels next to all the things you'll want to change. -# -# Once you've edited all the FIXME's, delete this whole message, -# save this file, and test out your package like this: -# -# spack install lapack -# -# You can always get back here to change things with: -# -# spack edit lapack -# -# See the spack documentation for more information on building -# packages. -# from spack import * class Lapack(Package): @@ -37,9 +21,9 @@ class Lapack(Package): depends_on('atlas') def install(self, spec, prefix): - atlas_blas = spec['atlas'].prefix.lib + '/libf77blas.a' - atlas_lib = spec['atlas'].prefix.lib + "/libatlas.a" - cmake(".", '-DBLAS_LIBRARIES='+atlas_blas + ";" + atlas_lib, *std_cmake_args) + atlas_libs = ['libf77blas.a', 'libatlas.a'] + atlas_libs = [join_path(spec['atlas'].prefix.lib, lib,) for lib in atlas_libs] + cmake(".", '-DBLAS_LIBRARIES=' + ";".join(atlas_libs), *std_cmake_args) make() make("install") From 3d2df174d16720e44f6b62f51927496ae2923e74 Mon Sep 17 00:00:00 2001 From: Benjamin Walters Date: Thu, 19 Mar 2015 03:20:24 -0500 Subject: [PATCH 07/35] Added package files for Lapack (has virtual dependency blas) and Netlib blas (provides virtual dependency blas). --- var/spack/packages/lapack/package.py | 41 +++++++++++++++++++++++ var/spack/packages/netlib_blas/package.py | 29 ++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 var/spack/packages/lapack/package.py create mode 100644 var/spack/packages/netlib_blas/package.py diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py new file mode 100644 index 0000000000..25469679ed --- /dev/null +++ b/var/spack/packages/lapack/package.py @@ -0,0 +1,41 @@ +from spack import * +from subprocess import call +import sys +import glob + +class Lapack(Package): + """ + Netlib implementation of Lapack. If we end up having more Lapack libraries, we should + turn it into a virtual dependency. + """ + homepage = "http://www.netlib.org/lapack/" + url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" + + version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf') + + # Doesn't always build correctly in parallel + parallel = False + + # virtual + depends_on("blas") + + def install(self, spec, prefix): + # CMake could be used if the build becomes more complex + + call(['cp', 'make.inc.example', 'make.inc']) + + # Retrieves name of package that satisifies 'blas' virtual dependency + blas_name = next(m for m in ('netlib_blas', 'atlas') if m in spec) + blas_spec = spec[blas_name] + blas_object_path = blas_spec.prefix.lib + '/blas.a' + + # The blas dependency must provide a 'blas.a' - but this is not gauranteed right now + # So maybe we should check if it exists first... maybe... + make('BLASLIB="%s"' % blas_object_path) + + # Manual install since no method provided + # Should probably be changed so only one external call is made + # Can install be used on a list of files? + mkdirp(prefix.lib) + for file in glob.glob('*.a'): + install(file, prefix.lib) diff --git a/var/spack/packages/netlib_blas/package.py b/var/spack/packages/netlib_blas/package.py new file mode 100644 index 0000000000..e6b7ec80a4 --- /dev/null +++ b/var/spack/packages/netlib_blas/package.py @@ -0,0 +1,29 @@ +from spack import * +from subprocess import call + +class NetlibBlas(Package): + """Netlib reference BLAS""" + homepage = "http://www.netlib.org/lapack/" + url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" + + version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf') + + # virtual dependency + provides('blas') + + # Doesn't always build correctly in parallel + parallel = False + + def install(self, spec, prefix): + call(['cp', 'make.inc.example', 'make.inc']) + make('blaslib') + + # Tests that blas builds correctly + make('blas_testing') + + # No install provided + mkdirp(prefix.lib) + install('librefblas.a', prefix.lib) + + # Blas virtual package should provide blas.a + call(['ln', '-s', prefix.lib + '/librefblas.a', prefix.lib + '/blas.a']) \ No newline at end of file From 1b75b34eb648a187ed300848422e5125c804b734 Mon Sep 17 00:00:00 2001 From: Benjamin Walters Date: Thu, 19 Mar 2015 04:37:21 -0500 Subject: [PATCH 08/35] Removed subprocess.call calls and replaced with spack symlink calls --- var/spack/packages/lapack/package.py | 3 +-- var/spack/packages/netlib_blas/package.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py index 25469679ed..9990b0bf33 100644 --- a/var/spack/packages/lapack/package.py +++ b/var/spack/packages/lapack/package.py @@ -1,5 +1,4 @@ from spack import * -from subprocess import call import sys import glob @@ -22,7 +21,7 @@ class Lapack(Package): def install(self, spec, prefix): # CMake could be used if the build becomes more complex - call(['cp', 'make.inc.example', 'make.inc']) + symlink('make.inc.example', 'make.inc') # Retrieves name of package that satisifies 'blas' virtual dependency blas_name = next(m for m in ('netlib_blas', 'atlas') if m in spec) diff --git a/var/spack/packages/netlib_blas/package.py b/var/spack/packages/netlib_blas/package.py index e6b7ec80a4..725bda1309 100644 --- a/var/spack/packages/netlib_blas/package.py +++ b/var/spack/packages/netlib_blas/package.py @@ -1,5 +1,4 @@ from spack import * -from subprocess import call class NetlibBlas(Package): """Netlib reference BLAS""" @@ -15,7 +14,7 @@ class NetlibBlas(Package): parallel = False def install(self, spec, prefix): - call(['cp', 'make.inc.example', 'make.inc']) + symlink('make.inc.example', 'make.inc') make('blaslib') # Tests that blas builds correctly @@ -26,4 +25,4 @@ def install(self, spec, prefix): install('librefblas.a', prefix.lib) # Blas virtual package should provide blas.a - call(['ln', '-s', prefix.lib + '/librefblas.a', prefix.lib + '/blas.a']) \ No newline at end of file + symlink(prefix.lib + '/librefblas.a', prefix.lib + '/blas.a') \ No newline at end of file From a23e1579e3f716c2ba2a445f8ff4ce69ed2632fb Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Wed, 18 Mar 2015 15:09:21 -0700 Subject: [PATCH 09/35] Added BLAS package --- var/spack/packages/blas/package.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 var/spack/packages/blas/package.py diff --git a/var/spack/packages/blas/package.py b/var/spack/packages/blas/package.py new file mode 100644 index 0000000000..7bab63bcd9 --- /dev/null +++ b/var/spack/packages/blas/package.py @@ -0,0 +1,21 @@ +from spack import * +import os + +class Blas(Package): + """The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard + building blocks for performing basic vector and matrix operations.""" + + homepage = "http://www.netlib.org/blas/" + + version('unversioned', '5e99e975f7a1e3ea6abcad7c6e7e42e6', + url='http://www.netlib.org/blas/blas.tgz') + + def install(self, spec, prefix): + make() + mv = which('mv') # Create a shell wrapper for the mv command. + mkdir = which('mkdir') # Create a shell wrapper for the mkdir command. + pwd = os.getcwd() # Retrieve the current working dir. + mkdir('%s' % prefix.lib) # Create the lib dir inside the install dir. + mv('%s/blas_LINUX.a' % pwd, '%s/libblas.a' % pwd) # Rename the generated lib file to libblas.a + mv('%s/libblas.a' % pwd, '%s/libblas.a' % prefix.lib) # Move the library file to the install dir. + From d461aa3722b5b19acebe9a37bea1739222186755 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Wed, 18 Mar 2015 15:53:50 -0700 Subject: [PATCH 10/35] Added Lapack package --- var/spack/packages/lapack/package.py | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 var/spack/packages/lapack/package.py diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py new file mode 100644 index 0000000000..f2dab5ecb6 --- /dev/null +++ b/var/spack/packages/lapack/package.py @@ -0,0 +1,31 @@ +from spack import * +import os + +class Lapack(Package): + """LAPACK is written in Fortran 90 and provides routines for solving systems + of simultaneous linear equations, least-squares solutions of linear systems + of equations, eigenvalue problems, and singular value problems.""" + homepage = "http://www.netlib.org/lapack" + url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" + + version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf') + + depends_on('blas') + + def install(self, spec, prefix): + mv = which('mv') # Create a shell wrapper for the mv command. + mkdir = which('mkdir') # Create a shell wrapper for the mkdir command. + pwd = os.getcwd() # Retrieve the current working dir. + + # Lapack and BLAS testing fails for some reason, but the library is + # built and ready to go at this point. The testing stuff is going to be + # switched off for now. + filter_file('blas_testing lapack_testing ', ' ', 'Makefile', string=True) + + mv('%s/make.inc.example' % pwd, '%s/make.inc' % pwd) + filter_file('../../librefblas.a', '%s/libblas.a' % spec['blas'].prefix.lib, 'make.inc', string=True) # Specify the BLAS lib to use. + + make() + mkdir('%s' % prefix.lib) # Create the lib dir inside the install dir. + mv('%s/liblapack.a' % pwd, '%s/liblapack.a' % prefix.lib) # Move the library file to the install dir. + From c174fe6199eaa86fccf3fafa9bbfbff6f3385089 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Mon, 6 Apr 2015 14:03:09 -0700 Subject: [PATCH 11/35] Fixed BLAS and Lapack installations --- lib/spack/llnl/util/filesystem.py | 1 - lib/spack/llnl/util/filesystem.py.save | 0 lib/spack/llnl/util/filesystem.py.save.1 | 229 +++++++++++++++++++++++ var/spack/packages/blas/package.py | 8 +- var/spack/packages/lapack/package.py | 15 +- 5 files changed, 236 insertions(+), 17 deletions(-) create mode 100644 lib/spack/llnl/util/filesystem.py.save create mode 100644 lib/spack/llnl/util/filesystem.py.save.1 diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 3b34e04740..8eff642938 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -40,7 +40,6 @@ import llnl.util.tty as tty from spack.util.compression import ALLOWED_ARCHIVE_TYPES - def filter_file(regex, repl, *filenames, **kwargs): """Like sed, but uses python regular expressions. diff --git a/lib/spack/llnl/util/filesystem.py.save b/lib/spack/llnl/util/filesystem.py.save new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/spack/llnl/util/filesystem.py.save.1 b/lib/spack/llnl/util/filesystem.py.save.1 new file mode 100644 index 0000000000..82cfe965b2 --- /dev/null +++ b/lib/spack/llnl/util/filesystem.py.save.1 @@ -0,0 +1,229 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +__all__ = ['set_install_permissions', 'install', 'expand_user', 'working_dir', + 'touch', 'touchp', 'mkdirp', 'force_remove', 'join_path', 'ancestor', + 'can_access', 'filter_file', 'change_sed_delimiter', 'is_exe'] + +import os +import sys +import re +import shutil +import stat +import errno +import getpass +from contextlib import contextmanager, closing +from tempfile import NamedTemporaryFile + +import llnl.util.tty as tty +from spack.util.compression import ALLOWED_ARCHIVE_TYPES + +def filter_file(regex, repl, *filenames, **kwargs): + """Like sed, but uses python regular expressions. + + Filters every line of file through regex and replaces the file + with a filtered version. Preserves mode of filtered files. + + As with re.sub, ``repl`` can be either a string or a callable. + If it is a callable, it is passed the match object and should + return a suitable replacement string. If it is a string, it + can contain ``\1``, ``\2``, etc. to represent back-substitution + as sed would allow. + + Keyword Options: + string[=False] If True, treat regex as a plain string. + backup[=True] Make a backup files suffixed with ~ + ignore_absent[=False] Ignore any files that don't exist. + """ + string = kwargs.get('string', False) + backup = kwargs.get('backup', True) + ignore_absent = kwargs.get('ignore_absent', False) + + # Allow strings to use \1, \2, etc. for replacement, like sed + if not callable(repl): + unescaped = repl.replace(r'\\', '\\') + def replace_groups_with_groupid(m): + def groupid_to_group(x): + return m.group(int(x.group(1))) + return re.sub(r'\\([1-9])', groupid_to_group, unescaped) + repl = replace_groups_with_groupid + + if string: + regex = re.escape(regex) + + for filename in filenames: + backup = filename + "~" + + if ignore_absent and not os.path.exists(filename): + continue + + shutil.copy(filename, backup) + try: + with closing(open(backup)) as infile: + with closing(open(filename, 'w')) as outfile: + for line in infile: + foo = re.sub(regex, repl, line) + outfile.write(foo) + except: + # clean up the original file on failure. + shutil.move(backup, filename) + raise + + finally: + if not backup: + shutil.rmtree(backup, ignore_errors=True) + + +def change_sed_delimiter(old_delim, new_delim, *filenames): + """Find all sed search/replace commands and change the delimiter. + e.g., if the file contains seds that look like 's///', you can + call change_sed_delimeter('/', '@', file) to change the + delimiter to '@'. + + NOTE that this routine will fail if the delimiter is ' or ". + Handling those is left for future work. + """ + assert(len(old_delim) == 1) + assert(len(new_delim) == 1) + + # TODO: handle these cases one day? + assert(old_delim != '"') + assert(old_delim != "'") + assert(new_delim != '"') + assert(new_delim != "'") + + whole_lines = "^s@([^@]*)@(.*)@[gIp]$" + whole_lines = whole_lines.replace('@', old_delim) + + single_quoted = r"'s@((?:\\'|[^@'])*)@((?:\\'|[^'])*)@[gIp]?'" + single_quoted = single_quoted.replace('@', old_delim) + + double_quoted = r'"s@((?:\\"|[^@"])*)@((?:\\"|[^"])*)@[gIp]?"' + double_quoted = double_quoted.replace('@', old_delim) + + repl = r's@\1@\2@g' + repl = repl.replace('@', new_delim) + + for f in filenames: + filter_file(whole_lines, repl, f) + filter_file(single_quoted, "'%s'" % repl, f) + filter_file(double_quoted, '"%s"' % repl, f) + + +def set_install_permissions(path): + """Set appropriate permissions on the installed file.""" + if os.path.isdir(path): + os.chmod(path, 0755) + else: + os.chmod(path, 0644) + + +def install(src, dest): + """Manually install a file to a particular location.""" + tty.info("Installing %s to %s" % (src, dest)) + shutil.copy(src, dest) + set_install_permissions(dest) + + src_mode = os.stat(src).st_mode + dest_mode = os.stat(dest).st_mode + if src_mode | stat.S_IXUSR: dest_mode |= stat.S_IXUSR + if src_mode | stat.S_IXGRP: dest_mode |= stat.S_IXGRP + if src_mode | stat.S_IXOTH: dest_mode |= stat.S_IXOTH + os.chmod(dest, dest_mode) + + +def is_exe(path): + """True if path is an executable file.""" + return os.path.isfile(path) and os.access(path, os.X_OK) + + +def expand_user(path): + """Find instances of '%u' in a path and replace with the current user's + username.""" + username = getpass.getuser() + if not username and '%u' in path: + tty.die("Couldn't get username to complete path '%s'" % path) + + return path.replace('%u', username) + + +def mkdirp(*paths): + """Creates a directory, as well as parent directories if needed.""" + for path in paths: + if not os.path.exists(path): + os.makedirs(path) + elif not os.path.isdir(path): + raise OSError(errno.EEXIST, "File alredy exists", path) + + +def force_remove(*paths): + """Remove files without printing errors. Like rm -f, does NOT + remove directories.""" + for path in paths: + try: + os.remove(path) + except OSError, e: + pass + +@contextmanager +def working_dir(dirname, **kwargs): + if kwargs.get('create', False): + mkdirp(dirname) + + orig_dir = os.getcwd() + os.chdir(dirname) + yield + os.chdir(orig_dir) + + +def touch(path): + """Creates an empty file at the specified path.""" + with closing(open(path, 'a')) as file: + os.utime(path, None) + + +def touchp(path): + """Like touch, but creates any parent directories needed for the file.""" + mkdirp(os.path.dirname(path)) + touch(path) + + +def join_path(prefix, *args): + path = str(prefix) + for elt in args: + path = os.path.join(path, str(elt)) + return path + + +def ancestor(dir, n=1): + """Get the nth ancestor of a directory.""" + parent = os.path.abspath(dir) + for i in range(n): + parent = os.path.dirname(parent) + return parent + + +def can_access(file_name): + """True if we have read/write access to the file.""" + return os.access(file_name, os.R_OK|os.W_OK) diff --git a/var/spack/packages/blas/package.py b/var/spack/packages/blas/package.py index 7bab63bcd9..0cf495d0c1 100644 --- a/var/spack/packages/blas/package.py +++ b/var/spack/packages/blas/package.py @@ -12,10 +12,6 @@ class Blas(Package): def install(self, spec, prefix): make() - mv = which('mv') # Create a shell wrapper for the mv command. - mkdir = which('mkdir') # Create a shell wrapper for the mkdir command. - pwd = os.getcwd() # Retrieve the current working dir. - mkdir('%s' % prefix.lib) # Create the lib dir inside the install dir. - mv('%s/blas_LINUX.a' % pwd, '%s/libblas.a' % pwd) # Rename the generated lib file to libblas.a - mv('%s/libblas.a' % pwd, '%s/libblas.a' % prefix.lib) # Move the library file to the install dir. + mkdirp('%s' % prefix.lib) # Create the lib dir inside the install dir. + move('./blas_LINUX.a', '%s/libblas.a' % prefix.lib) # Rename the generated lib file to libblas.a diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py index f2dab5ecb6..de90acd742 100644 --- a/var/spack/packages/lapack/package.py +++ b/var/spack/packages/lapack/package.py @@ -12,20 +12,15 @@ class Lapack(Package): depends_on('blas') - def install(self, spec, prefix): - mv = which('mv') # Create a shell wrapper for the mv command. - mkdir = which('mkdir') # Create a shell wrapper for the mkdir command. - pwd = os.getcwd() # Retrieve the current working dir. - + def install(self, spec, prefix): # Lapack and BLAS testing fails for some reason, but the library is - # built and ready to go at this point. The testing stuff is going to be - # switched off for now. + # built and ready to go after make() is called. The testing stuff is + # going to be switched off for now. filter_file('blas_testing lapack_testing ', ' ', 'Makefile', string=True) - - mv('%s/make.inc.example' % pwd, '%s/make.inc' % pwd) + move('./make.inc.example', './make.inc') filter_file('../../librefblas.a', '%s/libblas.a' % spec['blas'].prefix.lib, 'make.inc', string=True) # Specify the BLAS lib to use. make() mkdir('%s' % prefix.lib) # Create the lib dir inside the install dir. - mv('%s/liblapack.a' % pwd, '%s/liblapack.a' % prefix.lib) # Move the library file to the install dir. + move('./liblapack.a', '%s/liblapack.a' % prefix.lib) # Move the library file to the install dir. From 454d06c25c5aade4315a3f263adf2d0727966148 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Mon, 6 Apr 2015 14:13:58 -0700 Subject: [PATCH 12/35] Removed autosave files from previous commit. --- lib/spack/llnl/util/filesystem.py.save | 0 lib/spack/llnl/util/filesystem.py.save.1 | 229 ----------------------- 2 files changed, 229 deletions(-) delete mode 100644 lib/spack/llnl/util/filesystem.py.save delete mode 100644 lib/spack/llnl/util/filesystem.py.save.1 diff --git a/lib/spack/llnl/util/filesystem.py.save b/lib/spack/llnl/util/filesystem.py.save deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/spack/llnl/util/filesystem.py.save.1 b/lib/spack/llnl/util/filesystem.py.save.1 deleted file mode 100644 index 82cfe965b2..0000000000 --- a/lib/spack/llnl/util/filesystem.py.save.1 +++ /dev/null @@ -1,229 +0,0 @@ -############################################################################## -# Copyright (c) 2013, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# -# This file is part of Spack. -# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://scalability-llnl.github.io/spack -# Please also see the LICENSE file for our notice and the LGPL. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License (as published by -# the Free Software Foundation) version 2.1 dated February 1999. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and -# conditions of the GNU General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## -__all__ = ['set_install_permissions', 'install', 'expand_user', 'working_dir', - 'touch', 'touchp', 'mkdirp', 'force_remove', 'join_path', 'ancestor', - 'can_access', 'filter_file', 'change_sed_delimiter', 'is_exe'] - -import os -import sys -import re -import shutil -import stat -import errno -import getpass -from contextlib import contextmanager, closing -from tempfile import NamedTemporaryFile - -import llnl.util.tty as tty -from spack.util.compression import ALLOWED_ARCHIVE_TYPES - -def filter_file(regex, repl, *filenames, **kwargs): - """Like sed, but uses python regular expressions. - - Filters every line of file through regex and replaces the file - with a filtered version. Preserves mode of filtered files. - - As with re.sub, ``repl`` can be either a string or a callable. - If it is a callable, it is passed the match object and should - return a suitable replacement string. If it is a string, it - can contain ``\1``, ``\2``, etc. to represent back-substitution - as sed would allow. - - Keyword Options: - string[=False] If True, treat regex as a plain string. - backup[=True] Make a backup files suffixed with ~ - ignore_absent[=False] Ignore any files that don't exist. - """ - string = kwargs.get('string', False) - backup = kwargs.get('backup', True) - ignore_absent = kwargs.get('ignore_absent', False) - - # Allow strings to use \1, \2, etc. for replacement, like sed - if not callable(repl): - unescaped = repl.replace(r'\\', '\\') - def replace_groups_with_groupid(m): - def groupid_to_group(x): - return m.group(int(x.group(1))) - return re.sub(r'\\([1-9])', groupid_to_group, unescaped) - repl = replace_groups_with_groupid - - if string: - regex = re.escape(regex) - - for filename in filenames: - backup = filename + "~" - - if ignore_absent and not os.path.exists(filename): - continue - - shutil.copy(filename, backup) - try: - with closing(open(backup)) as infile: - with closing(open(filename, 'w')) as outfile: - for line in infile: - foo = re.sub(regex, repl, line) - outfile.write(foo) - except: - # clean up the original file on failure. - shutil.move(backup, filename) - raise - - finally: - if not backup: - shutil.rmtree(backup, ignore_errors=True) - - -def change_sed_delimiter(old_delim, new_delim, *filenames): - """Find all sed search/replace commands and change the delimiter. - e.g., if the file contains seds that look like 's///', you can - call change_sed_delimeter('/', '@', file) to change the - delimiter to '@'. - - NOTE that this routine will fail if the delimiter is ' or ". - Handling those is left for future work. - """ - assert(len(old_delim) == 1) - assert(len(new_delim) == 1) - - # TODO: handle these cases one day? - assert(old_delim != '"') - assert(old_delim != "'") - assert(new_delim != '"') - assert(new_delim != "'") - - whole_lines = "^s@([^@]*)@(.*)@[gIp]$" - whole_lines = whole_lines.replace('@', old_delim) - - single_quoted = r"'s@((?:\\'|[^@'])*)@((?:\\'|[^'])*)@[gIp]?'" - single_quoted = single_quoted.replace('@', old_delim) - - double_quoted = r'"s@((?:\\"|[^@"])*)@((?:\\"|[^"])*)@[gIp]?"' - double_quoted = double_quoted.replace('@', old_delim) - - repl = r's@\1@\2@g' - repl = repl.replace('@', new_delim) - - for f in filenames: - filter_file(whole_lines, repl, f) - filter_file(single_quoted, "'%s'" % repl, f) - filter_file(double_quoted, '"%s"' % repl, f) - - -def set_install_permissions(path): - """Set appropriate permissions on the installed file.""" - if os.path.isdir(path): - os.chmod(path, 0755) - else: - os.chmod(path, 0644) - - -def install(src, dest): - """Manually install a file to a particular location.""" - tty.info("Installing %s to %s" % (src, dest)) - shutil.copy(src, dest) - set_install_permissions(dest) - - src_mode = os.stat(src).st_mode - dest_mode = os.stat(dest).st_mode - if src_mode | stat.S_IXUSR: dest_mode |= stat.S_IXUSR - if src_mode | stat.S_IXGRP: dest_mode |= stat.S_IXGRP - if src_mode | stat.S_IXOTH: dest_mode |= stat.S_IXOTH - os.chmod(dest, dest_mode) - - -def is_exe(path): - """True if path is an executable file.""" - return os.path.isfile(path) and os.access(path, os.X_OK) - - -def expand_user(path): - """Find instances of '%u' in a path and replace with the current user's - username.""" - username = getpass.getuser() - if not username and '%u' in path: - tty.die("Couldn't get username to complete path '%s'" % path) - - return path.replace('%u', username) - - -def mkdirp(*paths): - """Creates a directory, as well as parent directories if needed.""" - for path in paths: - if not os.path.exists(path): - os.makedirs(path) - elif not os.path.isdir(path): - raise OSError(errno.EEXIST, "File alredy exists", path) - - -def force_remove(*paths): - """Remove files without printing errors. Like rm -f, does NOT - remove directories.""" - for path in paths: - try: - os.remove(path) - except OSError, e: - pass - -@contextmanager -def working_dir(dirname, **kwargs): - if kwargs.get('create', False): - mkdirp(dirname) - - orig_dir = os.getcwd() - os.chdir(dirname) - yield - os.chdir(orig_dir) - - -def touch(path): - """Creates an empty file at the specified path.""" - with closing(open(path, 'a')) as file: - os.utime(path, None) - - -def touchp(path): - """Like touch, but creates any parent directories needed for the file.""" - mkdirp(os.path.dirname(path)) - touch(path) - - -def join_path(prefix, *args): - path = str(prefix) - for elt in args: - path = os.path.join(path, str(elt)) - return path - - -def ancestor(dir, n=1): - """Get the nth ancestor of a directory.""" - parent = os.path.abspath(dir) - for i in range(n): - parent = os.path.dirname(parent) - return parent - - -def can_access(file_name): - """True if we have read/write access to the file.""" - return os.access(file_name, os.R_OK|os.W_OK) From fd34f4b119243d42b64e4ca2c358cf561fde9a14 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Wed, 27 May 2015 17:39:17 -0700 Subject: [PATCH 13/35] Added more FASTMath packages. --- var/spack/packages/arpack/package.py | 22 ++++++++++++ var/spack/packages/arpack/package.py.save | 15 +++++++++ var/spack/packages/boxlib/package.py | 15 +++++++++ var/spack/packages/cblas/package.py | 22 ++++++++++++ var/spack/packages/cgm/package.py | 22 ++++++++++++ var/spack/packages/fastmath/package.py | 15 +++++++++ var/spack/packages/hdf5/package.py | 6 ++-- var/spack/packages/hypre/package.py | 33 ++++++++++++++++++ var/spack/packages/hypre/package.py.save | 26 +++++++++++++++ var/spack/packages/metis/package.py | 27 ++++++--------- var/spack/packages/parpack/package.py | 26 +++++++++++++++ var/spack/packages/petsc/package.py | 35 ++++++++++++++++++++ var/spack/packages/zoltan_distrib/package.py | 33 ++++++++++++++++++ 13 files changed, 278 insertions(+), 19 deletions(-) create mode 100644 var/spack/packages/arpack/package.py create mode 100644 var/spack/packages/arpack/package.py.save create mode 100644 var/spack/packages/boxlib/package.py create mode 100644 var/spack/packages/cblas/package.py create mode 100644 var/spack/packages/cgm/package.py create mode 100644 var/spack/packages/fastmath/package.py create mode 100644 var/spack/packages/hypre/package.py create mode 100644 var/spack/packages/hypre/package.py.save create mode 100644 var/spack/packages/parpack/package.py create mode 100644 var/spack/packages/petsc/package.py create mode 100644 var/spack/packages/zoltan_distrib/package.py diff --git a/var/spack/packages/arpack/package.py b/var/spack/packages/arpack/package.py new file mode 100644 index 0000000000..22781262a7 --- /dev/null +++ b/var/spack/packages/arpack/package.py @@ -0,0 +1,22 @@ +from spack import * + +class Arpack(Package): + """FIXME: put a proper description of your package here.""" + homepage = "http://www.caam.rice.edu/software/ARPACK/" + url = "http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz" + + version('96', 'fffaa970198b285676f4156cebc8626e') + + depends_on('blas') + depends_on('lapack') + + def install(self, spec, prefix): + move('./ARMAKES/ARmake.CRAY', './ARmake.inc') + filter_file('PLAT = CRAY', 'PLAT = ', './ARmake.inc', string=True) + filter_file('home = $(HOME)/ARPACK', 'home = %s' % pwd(), './ARmake.inc', string=True) + filter_file('BLASdir = $(home)/BLAS', 'BLASdir = %s' % spec['blas'].prefix, './ARmake.inc', string=True) + filter_file('LAPACKdir = $(home)/LAPACK', 'LAPACKdir = %s' % spec['lapack'].prefix, './ARmake.inc', string=True) + filter_file('ARPACKLIB = $(home)/libarpack_$(PLAT).a', 'ARPACKLIB = %s/lib/libarpack.a' % prefix, './ARmake.inc', string=True) + + cd('./SRC') + make('all') diff --git a/var/spack/packages/arpack/package.py.save b/var/spack/packages/arpack/package.py.save new file mode 100644 index 0000000000..fe4f7999c6 --- /dev/null +++ b/var/spack/packages/arpack/package.py.save @@ -0,0 +1,15 @@ +from spack import * + +class Arpack(Package): + """ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.""" + + homepage = "http://www.caam.rice.edu/software/ARPACK/" + url = "http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz" + + version('96', 'fffaa970198b285676f4156cebc8626e') + + depends_on("blas") + depends_on("lapack") + + def install(self, spec, prefix): + diff --git a/var/spack/packages/boxlib/package.py b/var/spack/packages/boxlib/package.py new file mode 100644 index 0000000000..3e71a1383d --- /dev/null +++ b/var/spack/packages/boxlib/package.py @@ -0,0 +1,15 @@ +from spack import * + +class Boxlib(Package): + """BoxLib, a software framework for massively parallel block-structured adaptive mesh refinement (AMR) codes.""" + + homepage = "https://ccse.lbl.gov/BoxLib/" + url = "https://ccse.lbl.gov/pub/Downloads/BoxLib.git"; + + version('master', 'https://ccse.lbl.gov/pub/Downloads/BoxLib.git') + + def install(self, spec, prefix): + #configure("--prefix=%s" % prefix) + #make() + #make("install") + cd(pwd()) diff --git a/var/spack/packages/cblas/package.py b/var/spack/packages/cblas/package.py new file mode 100644 index 0000000000..81dac667d1 --- /dev/null +++ b/var/spack/packages/cblas/package.py @@ -0,0 +1,22 @@ +from spack import * +import os + +class Cblas(Package): + """The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard + building blocks for performing basic vector and matrix operations.""" + + homepage = "http://www.netlib.org/blas/_cblas/" + + version('unversioned', '1e8830f622d2112239a4a8a83b84209a', + url='http://www.netlib.org/blas/blast-forum/cblas.tgz') + + depends_on('blas') + parallel = False + + def install(self, spec, prefix): + filter_file('BLLIB = /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/blas_LINUX.a', 'BLLIB = %s/libblas.a' % spec['blas'].prefix.lib, './Makefile.in', string=True) + + make('all') # Compile. + mkdirp('%s' % prefix.lib) # Create the lib dir inside the install dir. + move('./lib/cblas_LINUX.a', '%s/libcblas.a' % prefix.lib) # Rename the generated lib file to libcblas.a + diff --git a/var/spack/packages/cgm/package.py b/var/spack/packages/cgm/package.py new file mode 100644 index 0000000000..7f32458c72 --- /dev/null +++ b/var/spack/packages/cgm/package.py @@ -0,0 +1,22 @@ +from spack import * + +class Cgm(Package): + """The Common Geometry Module, Argonne (CGMA) is a code library which provides geometry functionality used for mesh generation and other applications.""" + homepage = "http://trac.mcs.anl.gov/projects/ITAPS/wiki/CGM" + url = "http://ftp.mcs.anl.gov/pub/fathom/cgm13.1.1.tar.gz" + + version('13.1.1', '4e8dbc4ba8f65767b29f985f7a23b01f') + version('13.1.0', 'a6c7b22660f164ce893fb974f9cb2028') + version('13.1' , '95f724bda04919fc76818a5b7bc0b4ed') + + depends_on("openmpi") + + def install(self, spec, prefix): + configure("--with-mpi", + "--prefix=%s" % prefix, + "CFLAGS=-static", + "CXXFLAGS=-static", + "FCFLAGS=-static") + + make() + make("install") diff --git a/var/spack/packages/fastmath/package.py b/var/spack/packages/fastmath/package.py new file mode 100644 index 0000000000..a09a459000 --- /dev/null +++ b/var/spack/packages/fastmath/package.py @@ -0,0 +1,15 @@ +from spack import * + +class Fastmath(Package): + """Dummy groupinstall package that installs all packages in the fastmath suite.""" + + homepage = "http://redmine.scorec.rpi.edu/projects/fastmath" + url = "http://www.netlib.org/blas/blas.tgz" + + version('1.0', '5e99e975f7a1e3ea6abcad7c6e7e42e6') + + depends_on('blas') + depends_on('lapack') + + def install(self, spec, prefix): + pwd() diff --git a/var/spack/packages/hdf5/package.py b/var/spack/packages/hdf5/package.py index 992dd8ec70..1dfd3c0345 100644 --- a/var/spack/packages/hdf5/package.py +++ b/var/spack/packages/hdf5/package.py @@ -23,9 +23,9 @@ def install(self, spec, prefix): "--prefix=%s" % prefix, "--with-zlib=%s" % spec['zlib'].prefix, "--enable-parallel", - "--enable-shared", - "CC=%s" % spec['mpich'].prefix.bin + "/mpicc", - "CXX=%s" % spec['mpich'].prefix.bin + "/mpic++") + "--enable-shared") + # "CC=%s" % spec['mpich'].prefix.bin + "/mpicc", + # "CXX=%s" % spec['mpich'].prefix.bin + "/mpic++") make() make("install") diff --git a/var/spack/packages/hypre/package.py b/var/spack/packages/hypre/package.py new file mode 100644 index 0000000000..34bdab57a1 --- /dev/null +++ b/var/spack/packages/hypre/package.py @@ -0,0 +1,33 @@ +from spack import * + +class Hypre(Package): + """Hypre is a library of high performance preconditioners that features parallel multigrid + methods for both structured and unstructured grid problems.""" + + homepage = "https://computation.llnl.gov/project/linear_solvers/software.php" + url = "https://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz" + + version('2.10.0b', '768be38793a35bb5d055905b271f5b8e') + + depends_on("openmpi") + depends_on("blas") + depends_on("lapack") + + def install(self, spec, prefix): + blas_dir = spec['blas'].prefix + lapack_dir = spec['lapack'].prefix + + # Hypre's source is staged under ./src so we'll have to manually + # cd into it. + cd("./src") + + configure( + "--prefix=%s" % prefix, + "--with-blas-libs=blas", + "--with-blas-lib-dirs=%s/lib" % blas_dir, + "--with-lapack-libs=\"lapack blas\"", + "--with-lapack-lib-dirs=%s/lib" % lapack_dir, + "--with-MPI") + + make() + make("install") diff --git a/var/spack/packages/hypre/package.py.save b/var/spack/packages/hypre/package.py.save new file mode 100644 index 0000000000..532a1a3c5f --- /dev/null +++ b/var/spack/packages/hypre/package.py.save @@ -0,0 +1,26 @@ +from spack import * + +class Hypre(Package): + """Hypre is a library of high performance preconditioners that features parallel multigrid + methods for both structured and unstructured grid problems.""" + + homepage = "https://computation.llnl.gov/project/linear_solvers/software.php" + url = "https://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz" + + version('2.10.0b', '768be38793a35bb5d055905b271f5b8e') + + depends_on("openmpi") + depends_on("blas") + depends_on("lapack") + + def install(self, spec, prefix): + lapack_dir = spec['lapack'].prefix + configure( + "--prefix=%s" % prefix, + "--with-blas-libs=blas", + "--with-blas-lib-dirs=%s/lib" % spec['blas'].prefix, + "--with-lapack-libs=lapack blas", + "--with-lapack-lib-dirs=%s/lib" % lapack_dir) + + make() + make("install") diff --git a/var/spack/packages/metis/package.py b/var/spack/packages/metis/package.py index fa13d52127..7ce5ae1925 100644 --- a/var/spack/packages/metis/package.py +++ b/var/spack/packages/metis/package.py @@ -5,28 +5,23 @@ class Metis(Package): partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, - multilevel k-way, and multi-constraint partitioning schemes - developed in our lab.""" + multilevel k-way, and multi-constraint partitioning schemes.""" homepage = "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview" url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz" version('5.1.0', '5465e67079419a69e0116de24fce58fe') - # FIXME: Add dependencies if this package requires them. - # depends_on("foo") - - def patch(self): - filter_file(r'#define IDXTYPEWIDTH 32', '#define IDXTYPEWIDTH 64', 'include/metis.h', - string=True) - + depends_on('mpi') def install(self, spec, prefix): - with working_dir('spack-build', create=True): - cmake('..', - '-DGKLIB_PATH=../GKlib', - '-DBUILD_SHARED_LIBS=TRUE', - *std_cmake_args) - make() - make("install") + cmake(".", + '-DGKLIB_PATH=%s/GKlib' % pwd(), + '-DSHARED=1', + '-DCMAKE_C_COMPILER=mpicc', + '-DCMAKE_CXX_COMPILER=mpicxx', + '-DSHARED=1', + *std_cmake_args) + make() + make("install") diff --git a/var/spack/packages/parpack/package.py b/var/spack/packages/parpack/package.py new file mode 100644 index 0000000000..1b9faf9354 --- /dev/null +++ b/var/spack/packages/parpack/package.py @@ -0,0 +1,26 @@ +from spack import * + +class Parpack(Package): + """ARPACK is a collection of Fortran77 subroutines designed to solve large + scale eigenvalue problems.""" + + homepage = "http://www.caam.rice.edu/software/ARPACK/download.html" + url = "http://www.caam.rice.edu/software/ARPACK/SRC/parpack96.tar.Z" + + version('96', 'a175f70ff71837a33ff7e4b0b6054f43') + + depends_on('blas') + depends_on('lapack') + + def install(self, spec, prefix): + move("./ARMAKES/ARmake.CJ", "./ARmake.inc"); + filter_file('home = /home1/Netlib/ARPACK', 'home = %s' % pwd(), './ARmake.inc', string=True) + filter_file('PLAT = CJ', 'PLAT = ', './ARmake.inc', string=True) + filter_file('LAPACKdir = $(home)/LAPACK', 'LAPACKLIB = %s' % spec['lapack'].prefix, './ARmake.inc', string=True) + filter_file('BLASdir = $(home)/BLAS', 'BLASLIB = %s' % spec['blas'].prefix, './ARmake.inc', string=True) + filter_file('ARPACKLIB = $(home)/libarpack_$(PLAT).a', 'ARPACKLIB = %s/libarpack.a' % prefix, './ARmake.inc', string=True) + filter_file('MAKE = /bin/make', 'MAKE = make', './ARmake.inc', string=True) + filter_file('FFLAGS', '#FFLAGS', './ARmake.inc', string=True) + filter_file('FC = f77', 'FC = gfortran', './ARmake.inc', string=True) + cd('./PARPACK/SRC/MPI') + make('all') diff --git a/var/spack/packages/petsc/package.py b/var/spack/packages/petsc/package.py new file mode 100644 index 0000000000..ffc522b1da --- /dev/null +++ b/var/spack/packages/petsc/package.py @@ -0,0 +1,35 @@ +from spack import * + +class Petsc(Package): + """PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.""" + + homepage = "http://www.mcs.anl.gov/petsc/index.html" + url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.5.3.tar.gz" + + version('3.5.3', 'd4fd2734661e89f18ac6014b5dd1ef2f') + version('3.5.2', 'ad170802b3b058b5deb9cd1f968e7e13') + version('3.5.1', 'a557e029711ebf425544e117ffa44d8f') + + depends_on("blas") + depends_on("lapack") + depends_on("hypre") + depends_on("parmetis") + depends_on("metis") + depends_on("hdf5") + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix, + "--with-blas-lib=%s/lib/libblas.a" % spec['blas'].prefix, + "--with-lapack-lib=%s/lib/liblapack.a" % spec['lapack'].prefix, + "--with-hypre-lib=%s/lib/libhypre.a" % spec['hypre'].prefix, + "--with-hypre-include=%s/include" % spec['hypre'].prefix, + "--with-parmetis-lib=%s/lib/libparmetis.a" % spec['parmetis'].prefix, + "--with-parmetis-include=%s/include" % spec['parmetis'].prefix, + "--with-metis-lib=%s/lib/libmetis.a" % spec['metis'].prefix, + "--with-metis-include=%s/include" % spec['metis'].prefix, + "--with-hdf5-lib=%s/lib/libhdf5.a" % spec['hdf5'].prefix, + "--with-hdf5-include=%s/include" % spec['hdf5'].prefix, + "--with-shared-libraries=0") + + make() + make("install") diff --git a/var/spack/packages/zoltan_distrib/package.py b/var/spack/packages/zoltan_distrib/package.py new file mode 100644 index 0000000000..85f32f0a2d --- /dev/null +++ b/var/spack/packages/zoltan_distrib/package.py @@ -0,0 +1,33 @@ +# FIXME: +# This is a template package file for Spack. We've conveniently +# put "FIXME" labels next to all the things you'll want to change. +# +# Once you've edited all the FIXME's, delete this whole message, +# save this file, and test out your package like this: +# +# spack install zoltan_distrib +# +# You can always get back here to change things with: +# +# spack edit zoltan_distrib +# +# See the spack documentation for more information on building +# packages. +# +from spack import * + +class ZoltanDistrib(Package): + """FIXME: put a proper description of your package here.""" + + homepage = "http://www.example.com" + url = "http://www.cs.sandia.gov/~kddevin/Zoltan_Distributions/zoltan_distrib_v3.81.tar.gz" + + version('3.81', 'e0587ac69dbc3b17d28f515ed0933719') + + def install(self, spec, prefix): + # FIXME: Modify the configure line to suit your build system here. + configure("--prefix=%s" % prefix) + + # FIXME: Add logic to build and install here + make() + make("install") From 9d71093500eae5913d2cebc78008506bcf31adc1 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Wed, 27 May 2015 17:42:18 -0700 Subject: [PATCH 14/35] Updated Zoltan. --- var/spack/packages/zoltan_distrib/package.py | 33 -------------------- 1 file changed, 33 deletions(-) delete mode 100644 var/spack/packages/zoltan_distrib/package.py diff --git a/var/spack/packages/zoltan_distrib/package.py b/var/spack/packages/zoltan_distrib/package.py deleted file mode 100644 index 85f32f0a2d..0000000000 --- a/var/spack/packages/zoltan_distrib/package.py +++ /dev/null @@ -1,33 +0,0 @@ -# FIXME: -# This is a template package file for Spack. We've conveniently -# put "FIXME" labels next to all the things you'll want to change. -# -# Once you've edited all the FIXME's, delete this whole message, -# save this file, and test out your package like this: -# -# spack install zoltan_distrib -# -# You can always get back here to change things with: -# -# spack edit zoltan_distrib -# -# See the spack documentation for more information on building -# packages. -# -from spack import * - -class ZoltanDistrib(Package): - """FIXME: put a proper description of your package here.""" - - homepage = "http://www.example.com" - url = "http://www.cs.sandia.gov/~kddevin/Zoltan_Distributions/zoltan_distrib_v3.81.tar.gz" - - version('3.81', 'e0587ac69dbc3b17d28f515ed0933719') - - def install(self, spec, prefix): - # FIXME: Modify the configure line to suit your build system here. - configure("--prefix=%s" % prefix) - - # FIXME: Add logic to build and install here - make() - make("install") From 1f0246f970c4198e59f039590b808afd5ef98d88 Mon Sep 17 00:00:00 2001 From: Saravan Pantham Date: Wed, 27 May 2015 17:44:48 -0700 Subject: [PATCH 15/35] Updated HDF5 to use MPI. --- var/spack/packages/hdf5/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/var/spack/packages/hdf5/package.py b/var/spack/packages/hdf5/package.py index 1dfd3c0345..992dd8ec70 100644 --- a/var/spack/packages/hdf5/package.py +++ b/var/spack/packages/hdf5/package.py @@ -23,9 +23,9 @@ def install(self, spec, prefix): "--prefix=%s" % prefix, "--with-zlib=%s" % spec['zlib'].prefix, "--enable-parallel", - "--enable-shared") - # "CC=%s" % spec['mpich'].prefix.bin + "/mpicc", - # "CXX=%s" % spec['mpich'].prefix.bin + "/mpic++") + "--enable-shared", + "CC=%s" % spec['mpich'].prefix.bin + "/mpicc", + "CXX=%s" % spec['mpich'].prefix.bin + "/mpic++") make() make("install") From 5d7a6c0c4671626fd402245fe57cec526e6365f8 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 14:01:06 -0700 Subject: [PATCH 16/35] Add FileFilter convenience class to llnl.util.filesystem. --- lib/spack/llnl/util/filesystem.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 8eff642938..029a7536df 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -25,7 +25,7 @@ __all__ = ['set_install_permissions', 'install', 'install_tree', 'traverse_tree', 'expand_user', 'working_dir', 'touch', 'touchp', 'mkdirp', 'force_remove', 'join_path', 'ancestor', 'can_access', 'filter_file', - 'change_sed_delimiter', 'is_exe', 'force_symlink'] + 'FileFilter', 'change_sed_delimiter', 'is_exe', 'force_symlink'] import os import sys @@ -96,6 +96,15 @@ def groupid_to_group(x): shutil.rmtree(backup, ignore_errors=True) +class FileFilter(object): + """Convenience class for calling filter_file a lot.""" + def __init__(self, *filenames): + self.filenames = filenames + + def filter(self, regex, repl, **kwargs): + return filter_file(regex, repl, *self.filenames, **kwargs) + + def change_sed_delimiter(old_delim, new_delim, *filenames): """Find all sed search/replace commands and change the delimiter. e.g., if the file contains seds that look like 's///', you can From 422a75e4b85345bd517c73760430ae773d49dc00 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 14:01:33 -0700 Subject: [PATCH 17/35] Clean up arpack build, use the Spack f77 compiler. --- var/spack/packages/arpack/package.py | 33 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/var/spack/packages/arpack/package.py b/var/spack/packages/arpack/package.py index 22781262a7..30c1b8f545 100644 --- a/var/spack/packages/arpack/package.py +++ b/var/spack/packages/arpack/package.py @@ -1,7 +1,9 @@ from spack import * class Arpack(Package): - """FIXME: put a proper description of your package here.""" + """A collection of Fortran77 subroutines designed to solve large scale + eigenvalue problems. + """ homepage = "http://www.caam.rice.edu/software/ARPACK/" url = "http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz" @@ -10,13 +12,24 @@ class Arpack(Package): depends_on('blas') depends_on('lapack') + def patch(self): + # Filter the cray makefile to make a spack one. + move('ARMAKES/ARmake.CRAY', 'ARmake.inc') + makefile = FileFilter('ARmake.inc') + + # Be sure to use Spack F77 wrapper + makefile.filter('^FC.*', 'FC = f77') + + # Set up some variables. + makefile.filter('^PLAT.*', 'PLAT = ') + makefile.filter('^home =.*', 'home = %s' % pwd()) + makefile.filter('^BLASdir.*', 'BLASdir = %s' % self.spec['blas'].prefix) + makefile.filter('^LAPACKdir.*', 'LAPACKdir = %s' % self.spec['lapack'].prefix) + + # build the library in our own prefix. + makefile.filter('^ARPACKLIB.*', 'ARPACKLIB = %s/lib/libarpack.a' % self.prefix) + + def install(self, spec, prefix): - move('./ARMAKES/ARmake.CRAY', './ARmake.inc') - filter_file('PLAT = CRAY', 'PLAT = ', './ARmake.inc', string=True) - filter_file('home = $(HOME)/ARPACK', 'home = %s' % pwd(), './ARmake.inc', string=True) - filter_file('BLASdir = $(home)/BLAS', 'BLASdir = %s' % spec['blas'].prefix, './ARmake.inc', string=True) - filter_file('LAPACKdir = $(home)/LAPACK', 'LAPACKdir = %s' % spec['lapack'].prefix, './ARmake.inc', string=True) - filter_file('ARPACKLIB = $(home)/libarpack_$(PLAT).a', 'ARPACKLIB = %s/lib/libarpack.a' % prefix, './ARmake.inc', string=True) - - cd('./SRC') - make('all') + with working_dir('SRC'): + make('all') From 03780ea10557cbcc9846469bbdb8cbfd56ee9d92 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 14:02:10 -0700 Subject: [PATCH 18/35] Remove autosave files from saravan's PR --- var/spack/packages/arpack/package.py.save | 15 ------------- var/spack/packages/hypre/package.py.save | 26 ----------------------- 2 files changed, 41 deletions(-) delete mode 100644 var/spack/packages/arpack/package.py.save delete mode 100644 var/spack/packages/hypre/package.py.save diff --git a/var/spack/packages/arpack/package.py.save b/var/spack/packages/arpack/package.py.save deleted file mode 100644 index fe4f7999c6..0000000000 --- a/var/spack/packages/arpack/package.py.save +++ /dev/null @@ -1,15 +0,0 @@ -from spack import * - -class Arpack(Package): - """ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.""" - - homepage = "http://www.caam.rice.edu/software/ARPACK/" - url = "http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz" - - version('96', 'fffaa970198b285676f4156cebc8626e') - - depends_on("blas") - depends_on("lapack") - - def install(self, spec, prefix): - diff --git a/var/spack/packages/hypre/package.py.save b/var/spack/packages/hypre/package.py.save deleted file mode 100644 index 532a1a3c5f..0000000000 --- a/var/spack/packages/hypre/package.py.save +++ /dev/null @@ -1,26 +0,0 @@ -from spack import * - -class Hypre(Package): - """Hypre is a library of high performance preconditioners that features parallel multigrid - methods for both structured and unstructured grid problems.""" - - homepage = "https://computation.llnl.gov/project/linear_solvers/software.php" - url = "https://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz" - - version('2.10.0b', '768be38793a35bb5d055905b271f5b8e') - - depends_on("openmpi") - depends_on("blas") - depends_on("lapack") - - def install(self, spec, prefix): - lapack_dir = spec['lapack'].prefix - configure( - "--prefix=%s" % prefix, - "--with-blas-libs=blas", - "--with-blas-lib-dirs=%s/lib" % spec['blas'].prefix, - "--with-lapack-libs=lapack blas", - "--with-lapack-lib-dirs=%s/lib" % lapack_dir) - - make() - make("install") From b9746de52e62a6e11fabcd25ec7fbd9dbb9505d6 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 14:57:52 -0700 Subject: [PATCH 19/35] Working ARPACK package. --- var/spack/packages/arpack/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/var/spack/packages/arpack/package.py b/var/spack/packages/arpack/package.py index 30c1b8f545..df46bdda83 100644 --- a/var/spack/packages/arpack/package.py +++ b/var/spack/packages/arpack/package.py @@ -1,4 +1,6 @@ from spack import * +import os +import shutil class Arpack(Package): """A collection of Fortran77 subroutines designed to solve large scale @@ -14,15 +16,16 @@ class Arpack(Package): def patch(self): # Filter the cray makefile to make a spack one. - move('ARMAKES/ARmake.CRAY', 'ARmake.inc') + shutil.move('ARMAKES/ARmake.CRAY', 'ARmake.inc') makefile = FileFilter('ARmake.inc') # Be sure to use Spack F77 wrapper makefile.filter('^FC.*', 'FC = f77') + makefile.filter('^FFLAGS.*', 'FFLAGS = -O2 -g') # Set up some variables. makefile.filter('^PLAT.*', 'PLAT = ') - makefile.filter('^home =.*', 'home = %s' % pwd()) + makefile.filter('^home.*', 'home = %s' % os.getcwd()) makefile.filter('^BLASdir.*', 'BLASdir = %s' % self.spec['blas'].prefix) makefile.filter('^LAPACKdir.*', 'LAPACKdir = %s' % self.spec['lapack'].prefix) @@ -31,5 +34,6 @@ def patch(self): def install(self, spec, prefix): + mkdirp(self.prefix.lib) with working_dir('SRC'): make('all') From 53feb12ea078cd9661eca2311fdbc18b352ddc37 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 15:50:01 -0700 Subject: [PATCH 20/35] Cleanup and consolidate error handling --- bin/spack | 9 +-------- lib/spack/spack/build_environment.py | 4 ++++ lib/spack/spack/error.py | 15 +++++++++++++++ lib/spack/spack/package.py | 11 +---------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/bin/spack b/bin/spack index 354754594e..5c042edd2d 100755 --- a/bin/spack +++ b/bin/spack @@ -126,14 +126,7 @@ def main(): try: return_val = command(parser, args) except SpackError, e: - if spack.debug: - # In debug mode, raise with a full stack trace. - raise - elif e.long_message: - tty.die(e.message, e.long_message) - else: - tty.die(e.message) - + e.die() except KeyboardInterrupt: sys.stderr.write('\n') tty.die("Keyboard interrupt.") diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index f9e795ac42..81fbedc689 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -280,6 +280,10 @@ def child_fun(): # Use os._exit here to avoid raising a SystemExit exception, # which interferes with unit tests. os._exit(0) + + except spack.error.SpackError, e: + e.die() + except: # Child doesn't raise or return to main spack code. # Just runs default exception handler and exits. diff --git a/lib/spack/spack/error.py b/lib/spack/spack/error.py index e8fa756682..bfa7951a47 100644 --- a/lib/spack/spack/error.py +++ b/lib/spack/spack/error.py @@ -22,6 +22,10 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os +import sys +import llnl.util.tty as tty +import spack class SpackError(Exception): """This is the superclass for all Spack errors. @@ -38,6 +42,17 @@ def long_message(self): return self._long_message + def die(self): + if spack.debug: + sys.excepthook(*sys.exc_info()) + os._exit(1) + else: + tty.error(self.message) + if self.long_message: + print self.long_message + os._exit(1) + + def __str__(self): msg = self.message if self.long_message: diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 5dd410d0e4..e3d766f582 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -816,17 +816,8 @@ def real_work(): except ProcessError, e: # Annotate with location of build log. e.build_log = log_path - - # One of the processes returned an error code. - # Suppress detailed stack trace here unless in debug mode - if spack.debug: - raise e - else: - tty.error(e) - - # Still need to clean up b/c there was an error. cleanup() - os._exit(1) + raise e except: # other exceptions just clean up and raise. From eb9859ce750def63db8bc436338f94e875276a2e Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 16:15:34 -0700 Subject: [PATCH 21/35] Executables now have a useful __str__ function. --- lib/spack/spack/util/executable.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index 6eede0f78e..1dcda0d87f 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -124,6 +124,11 @@ def __repr__(self): return "" % self.exe + def __str__(self): + return ' '.join(self.exe) + + + def which(name, **kwargs): """Finds an executable in the path like command-line which.""" path = kwargs.get('path', os.environ.get('PATH', '').split(os.pathsep)) From f29fc5822be81d7bc1776160b4159a6c3a44c831 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 16:16:11 -0700 Subject: [PATCH 22/35] Working boxlib package. --- var/spack/packages/boxlib/package.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/var/spack/packages/boxlib/package.py b/var/spack/packages/boxlib/package.py index 3e71a1383d..4f1b71132f 100644 --- a/var/spack/packages/boxlib/package.py +++ b/var/spack/packages/boxlib/package.py @@ -1,15 +1,25 @@ from spack import * class Boxlib(Package): - """BoxLib, a software framework for massively parallel block-structured adaptive mesh refinement (AMR) codes.""" + """BoxLib, a software framework for massively parallel + block-structured adaptive mesh refinement (AMR) codes.""" homepage = "https://ccse.lbl.gov/BoxLib/" url = "https://ccse.lbl.gov/pub/Downloads/BoxLib.git"; - version('master', 'https://ccse.lbl.gov/pub/Downloads/BoxLib.git') + # TODO: figure out how best to version this. No tags in the repo! + version('master', git='https://ccse.lbl.gov/pub/Downloads/BoxLib.git') + + depends_on('mpi') def install(self, spec, prefix): - #configure("--prefix=%s" % prefix) - #make() - #make("install") - cd(pwd()) + args = std_cmake_args + args += ['-DCCSE_ENABLE_MPI=1', + '-DCMAKE_C_COMPILER=%s' % which('mpicc'), + '-DCMAKE_CXX_COMPILER=%s' % which('mpicxx'), + '-DCMAKE_Fortran_COMPILER=%s' % which('mpif90')] + + cmake('.', *args) + make() + make("install") + From c5ab3f4e82039f0acc809271e3e37e96028ae90f Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 16:29:37 -0700 Subject: [PATCH 23/35] CBLAS package working and patching in spack compilers. --- var/spack/packages/cblas/package.py | 32 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/var/spack/packages/cblas/package.py b/var/spack/packages/cblas/package.py index 81dac667d1..93cf5fb7b8 100644 --- a/var/spack/packages/cblas/package.py +++ b/var/spack/packages/cblas/package.py @@ -2,21 +2,31 @@ import os class Cblas(Package): - """The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard - building blocks for performing basic vector and matrix operations.""" + """The BLAS (Basic Linear Algebra Subprograms) are routines that + provide standard building blocks for performing basic vector and + matrix operations.""" homepage = "http://www.netlib.org/blas/_cblas/" - version('unversioned', '1e8830f622d2112239a4a8a83b84209a', - url='http://www.netlib.org/blas/blast-forum/cblas.tgz') + # tarball has no version, but on the date below, this MD5 was correct. + version('2015-06-06', '1e8830f622d2112239a4a8a83b84209a', + url='http://www.netlib.org/blas/blast-forum/cblas.tgz') depends_on('blas') parallel = False - def install(self, spec, prefix): - filter_file('BLLIB = /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/blas_LINUX.a', 'BLLIB = %s/libblas.a' % spec['blas'].prefix.lib, './Makefile.in', string=True) - - make('all') # Compile. - mkdirp('%s' % prefix.lib) # Create the lib dir inside the install dir. - move('./lib/cblas_LINUX.a', '%s/libcblas.a' % prefix.lib) # Rename the generated lib file to libcblas.a - + def patch(self): + mf = FileFilter('Makefile.in') + + mf.filter('^BLLIB =.*', 'BLLIB = %s/libblas.a' % self.spec['blas'].prefix.lib) + mf.filter('^CC =.*', 'CC = cc') + mf.filter('^FC =.*', 'FC = f90') + + + def install(self, spec, prefix): + make('all') + mkdirp(prefix.lib) + + # Rename the generated lib file to libcblas.a + install('./lib/cblas_LINUX.a', '%s/libcblas.a' % prefix.lib) + From 5294e2b9b9a6d3301062577fc726c059a3c495cd Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 16:56:59 -0700 Subject: [PATCH 24/35] CGM package working on cab. --- var/spack/packages/cgm/package.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/var/spack/packages/cgm/package.py b/var/spack/packages/cgm/package.py index 7f32458c72..05d6395c5a 100644 --- a/var/spack/packages/cgm/package.py +++ b/var/spack/packages/cgm/package.py @@ -1,7 +1,9 @@ from spack import * class Cgm(Package): - """The Common Geometry Module, Argonne (CGMA) is a code library which provides geometry functionality used for mesh generation and other applications.""" + """The Common Geometry Module, Argonne (CGMA) is a code library + which provides geometry functionality used for mesh generation and + other applications.""" homepage = "http://trac.mcs.anl.gov/projects/ITAPS/wiki/CGM" url = "http://ftp.mcs.anl.gov/pub/fathom/cgm13.1.1.tar.gz" @@ -9,14 +11,20 @@ class Cgm(Package): version('13.1.0', 'a6c7b22660f164ce893fb974f9cb2028') version('13.1' , '95f724bda04919fc76818a5b7bc0b4ed') - depends_on("openmpi") + depends_on("mpi") + + def patch(self): + filter_file('^(#include "CGMParallelConventions.h")', + '//\1', + 'geom/parallel/CGMReadParallel.cpp') + def install(self, spec, prefix): configure("--with-mpi", - "--prefix=%s" % prefix, - "CFLAGS=-static", - "CXXFLAGS=-static", - "FCFLAGS=-static") + "--prefix=%s" % prefix, + "CFLAGS=-static", + "CXXFLAGS=-static", + "FCFLAGS=-static") make() make("install") From d266bf0184ca0d3a466d2370be0e61c13ff30dcd Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 17:20:33 -0700 Subject: [PATCH 25/35] Working Hypre, PARPACK. --- var/spack/packages/arpack/package.py | 6 ++-- var/spack/packages/hypre/package.py | 31 ++++++++++---------- var/spack/packages/parpack/package.py | 41 +++++++++++++++++++-------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/var/spack/packages/arpack/package.py b/var/spack/packages/arpack/package.py index df46bdda83..8c67c536f3 100644 --- a/var/spack/packages/arpack/package.py +++ b/var/spack/packages/arpack/package.py @@ -30,10 +30,12 @@ def patch(self): makefile.filter('^LAPACKdir.*', 'LAPACKdir = %s' % self.spec['lapack'].prefix) # build the library in our own prefix. - makefile.filter('^ARPACKLIB.*', 'ARPACKLIB = %s/lib/libarpack.a' % self.prefix) + makefile.filter('^ARPACKLIB.*', 'ARPACKLIB = %s/libarpack.a' % os.getcwd()) def install(self, spec, prefix): - mkdirp(self.prefix.lib) with working_dir('SRC'): make('all') + + mkdirp(prefix.lib) + install('libarpack.a', prefix.lib) diff --git a/var/spack/packages/hypre/package.py b/var/spack/packages/hypre/package.py index 34bdab57a1..198b3f00dc 100644 --- a/var/spack/packages/hypre/package.py +++ b/var/spack/packages/hypre/package.py @@ -1,15 +1,16 @@ from spack import * class Hypre(Package): - """Hypre is a library of high performance preconditioners that features parallel multigrid - methods for both structured and unstructured grid problems.""" + """Hypre is a library of high performance preconditioners that + features parallel multigrid methods for both structured and + unstructured grid problems.""" homepage = "https://computation.llnl.gov/project/linear_solvers/software.php" url = "https://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz" version('2.10.0b', '768be38793a35bb5d055905b271f5b8e') - depends_on("openmpi") + depends_on("mpi") depends_on("blas") depends_on("lapack") @@ -17,17 +18,15 @@ def install(self, spec, prefix): blas_dir = spec['blas'].prefix lapack_dir = spec['lapack'].prefix - # Hypre's source is staged under ./src so we'll have to manually + # Hypre's source is staged under ./src so we'll have to manually # cd into it. - cd("./src") - - configure( - "--prefix=%s" % prefix, - "--with-blas-libs=blas", - "--with-blas-lib-dirs=%s/lib" % blas_dir, - "--with-lapack-libs=\"lapack blas\"", - "--with-lapack-lib-dirs=%s/lib" % lapack_dir, - "--with-MPI") - - make() - make("install") + with working_dir("src"): + configure( + "--prefix=%s" % prefix, + "--with-blas-libs=blas", + "--with-blas-lib-dirs=%s/lib" % blas_dir, + "--with-lapack-libs=\"lapack blas\"", + "--with-lapack-lib-dirs=%s/lib" % lapack_dir, + "--with-MPI") + make() + make("install") diff --git a/var/spack/packages/parpack/package.py b/var/spack/packages/parpack/package.py index 1b9faf9354..622aceca04 100644 --- a/var/spack/packages/parpack/package.py +++ b/var/spack/packages/parpack/package.py @@ -1,7 +1,9 @@ from spack import * +import os +import shutil class Parpack(Package): - """ARPACK is a collection of Fortran77 subroutines designed to solve large + """ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.""" homepage = "http://www.caam.rice.edu/software/ARPACK/download.html" @@ -9,18 +11,33 @@ class Parpack(Package): version('96', 'a175f70ff71837a33ff7e4b0b6054f43') + depends_on('mpi') depends_on('blas') depends_on('lapack') + def patch(self): + # Filter the CJ makefile to make a spack one. + shutil.move('ARMAKES/ARmake.CJ', 'ARmake.inc') + mf = FileFilter('ARmake.inc') + + # Be sure to use Spack F77 wrapper + mf.filter('^FC.*', 'FC = f77') + mf.filter('^FFLAGS.*', 'FFLAGS = -O2 -g') + + # Set up some variables. + mf.filter('^PLAT.*', 'PLAT = ') + mf.filter('^home.*', 'home = %s' % os.getcwd()) + mf.filter('^BLASdir.*', 'BLASdir = %s' % self.spec['blas'].prefix) + mf.filter('^LAPACKdir.*', 'LAPACKdir = %s' % self.spec['lapack'].prefix) + mf.filter('^MAKE.*', 'MAKE = make') + + # build the library in our own prefix. + mf.filter('^ARPACKLIB.*', 'PARPACKLIB = %s/libparpack.a' % os.getcwd()) + + def install(self, spec, prefix): - move("./ARMAKES/ARmake.CJ", "./ARmake.inc"); - filter_file('home = /home1/Netlib/ARPACK', 'home = %s' % pwd(), './ARmake.inc', string=True) - filter_file('PLAT = CJ', 'PLAT = ', './ARmake.inc', string=True) - filter_file('LAPACKdir = $(home)/LAPACK', 'LAPACKLIB = %s' % spec['lapack'].prefix, './ARmake.inc', string=True) - filter_file('BLASdir = $(home)/BLAS', 'BLASLIB = %s' % spec['blas'].prefix, './ARmake.inc', string=True) - filter_file('ARPACKLIB = $(home)/libarpack_$(PLAT).a', 'ARPACKLIB = %s/libarpack.a' % prefix, './ARmake.inc', string=True) - filter_file('MAKE = /bin/make', 'MAKE = make', './ARmake.inc', string=True) - filter_file('FFLAGS', '#FFLAGS', './ARmake.inc', string=True) - filter_file('FC = f77', 'FC = gfortran', './ARmake.inc', string=True) - cd('./PARPACK/SRC/MPI') - make('all') + with working_dir('PARPACK/SRC/MPI'): + make('all') + + mkdirp(prefix.lib) + install('libparpack.a', prefix.lib) From b6ad37557f337a3d78cd4f63b0a420c7f8b712af Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 17:41:15 -0700 Subject: [PATCH 26/35] fix up Saravan's petsc install --- var/spack/packages/petsc/package.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/var/spack/packages/petsc/package.py b/var/spack/packages/petsc/package.py index ffc522b1da..4864e39bf1 100644 --- a/var/spack/packages/petsc/package.py +++ b/var/spack/packages/petsc/package.py @@ -1,7 +1,9 @@ from spack import * class Petsc(Package): - """PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.""" + """PETSc is a suite of data structures and routines for the + scalable (parallel) solution of scientific applications modeled by + partial differential equations.""" homepage = "http://www.mcs.anl.gov/petsc/index.html" url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.5.3.tar.gz" @@ -10,26 +12,29 @@ class Petsc(Package): version('3.5.2', 'ad170802b3b058b5deb9cd1f968e7e13') version('3.5.1', 'a557e029711ebf425544e117ffa44d8f') + depends_on("boost") depends_on("blas") depends_on("lapack") depends_on("hypre") depends_on("parmetis") depends_on("metis") depends_on("hdf5") + depends_on("mpi") def install(self, spec, prefix): configure("--prefix=%s" % prefix, - "--with-blas-lib=%s/lib/libblas.a" % spec['blas'].prefix, - "--with-lapack-lib=%s/lib/liblapack.a" % spec['lapack'].prefix, - "--with-hypre-lib=%s/lib/libhypre.a" % spec['hypre'].prefix, - "--with-hypre-include=%s/include" % spec['hypre'].prefix, - "--with-parmetis-lib=%s/lib/libparmetis.a" % spec['parmetis'].prefix, - "--with-parmetis-include=%s/include" % spec['parmetis'].prefix, - "--with-metis-lib=%s/lib/libmetis.a" % spec['metis'].prefix, - "--with-metis-include=%s/include" % spec['metis'].prefix, - "--with-hdf5-lib=%s/lib/libhdf5.a" % spec['hdf5'].prefix, - "--with-hdf5-include=%s/include" % spec['hdf5'].prefix, + "CC=cc", + "CXX=c++", + "FC=f90", + "--with-blas-lib=%s/libblas.a" % spec['blas'].prefix.lib, + "--with-lapack-lib=%s/liblapack.a" % spec['lapack'].prefix.lib, + "--with-boost-dir=%s" % spec['boost'].prefix, + "--with-hypre-dir=%s" % spec['hypre'].prefix, + "--with-parmetis-dir=%s" % spec['parmetis'].prefix, + "--with-metis-dir=%s" % spec['metis'].prefix, + "--with-hdf5-dir=%s" % spec['hdf5'].prefix, "--with-shared-libraries=0") - make() + # PETSc has its own way of doing parallel make. + make('MAKE_NP=%s' % make_jobs, parallel=False) make("install") From c43b5d670bf45ed6346db7d498b537ff70c7dbb0 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 17:48:33 -0700 Subject: [PATCH 27/35] Remove dummy fastmath package. --- var/spack/packages/fastmath/package.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 var/spack/packages/fastmath/package.py diff --git a/var/spack/packages/fastmath/package.py b/var/spack/packages/fastmath/package.py deleted file mode 100644 index a09a459000..0000000000 --- a/var/spack/packages/fastmath/package.py +++ /dev/null @@ -1,15 +0,0 @@ -from spack import * - -class Fastmath(Package): - """Dummy groupinstall package that installs all packages in the fastmath suite.""" - - homepage = "http://redmine.scorec.rpi.edu/projects/fastmath" - url = "http://www.netlib.org/blas/blas.tgz" - - version('1.0', '5e99e975f7a1e3ea6abcad7c6e7e42e6') - - depends_on('blas') - depends_on('lapack') - - def install(self, spec, prefix): - pwd() From 5d94864b6c4ef8d458295daad5284f1e7cc30a65 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 26 Mar 2015 00:36:27 -0700 Subject: [PATCH 28/35] Rename netlib_blas -> netlib-blas --- var/spack/packages/lapack/package.py | 4 ++-- var/spack/packages/{netlib_blas => netlib-blas}/package.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename var/spack/packages/{netlib_blas => netlib-blas}/package.py (100%) diff --git a/var/spack/packages/lapack/package.py b/var/spack/packages/lapack/package.py index d174c5281f..d9d37e3e4a 100644 --- a/var/spack/packages/lapack/package.py +++ b/var/spack/packages/lapack/package.py @@ -24,9 +24,9 @@ class Lapack(Package): # Doesn't always build correctly in parallel parallel = False - @when('^netlib_blas') + @when('^netlib-blas') def get_blas_libs(self): - blas = self.spec['netlib_blas'] + blas = self.spec['netlib-blas'] return [join_path(blas.prefix.lib, 'blas.a')] diff --git a/var/spack/packages/netlib_blas/package.py b/var/spack/packages/netlib-blas/package.py similarity index 100% rename from var/spack/packages/netlib_blas/package.py rename to var/spack/packages/netlib-blas/package.py From 8b9dcfe6359ac0ba044906549dccc5e2e6275c09 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 26 Mar 2015 00:42:31 -0700 Subject: [PATCH 29/35] Delete lapack/atlas combined package. --- var/spack/packages/lapack-atlas/package.py | 40 ---------------------- 1 file changed, 40 deletions(-) delete mode 100644 var/spack/packages/lapack-atlas/package.py diff --git a/var/spack/packages/lapack-atlas/package.py b/var/spack/packages/lapack-atlas/package.py deleted file mode 100644 index 209b02cb94..0000000000 --- a/var/spack/packages/lapack-atlas/package.py +++ /dev/null @@ -1,40 +0,0 @@ -from spack import * -from spack.util.executable import Executable -import os -import urllib - -class LapackAtlas(Package): - """ - Automatically Tuned Linear Algebra Software, generic shared - ATLAS is an approach for the automatic generation and optimization of - numerical software. Currently ATLAS supplies optimized versions for the - complete set of linear algebra kernels known as the Basic Linear Algebra - Subroutines (BLAS), and a subset of the linear algebra routines in the - LAPACK library. - """ - homepage = "http://math-atlas.sourceforge.net/" - url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" - - version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') - - # FIXME: Add dependencies if this package requires them. - # depends_on("foo") - - def install(self, spec, prefix): - #os.mkdir('ATLAS-Build') - #os.chdir('ATLAS-Build') - with working_dir('ATLAS-Build', create=True): - self.module.configure = Executable('../configure') - lapack_file = 'lapack-3.5.0.tgz' - lapack = urllib.URLopener() - lapack.retrieve('http://www.netlib.org/lapack/' + lapack_file, lapack_file) - - configure("--prefix=%s" % prefix, - "--shared", - '--with-netlib-lapack-tarfile=%s' % os.getcwd() + '/' + lapack_file) - - make() - make('check') - make('ptcheck') - make('time') - make("install") From 26b9592780f09714b36a49424ee84698e1bb8ad5 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 7 Apr 2015 22:32:00 -0700 Subject: [PATCH 30/35] Add disablement of cpu throttle check. --- var/spack/packages/atlas/package.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py index 7ee85f7f16..fc0a1a7e67 100644 --- a/var/spack/packages/atlas/package.py +++ b/var/spack/packages/atlas/package.py @@ -16,10 +16,22 @@ class Atlas(Package): version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') + def patch(self): + # Disable thraed check. LLNL's environment does not allow + # disabling of CPU throttling in a way that ATLAS actually + # understands. + filter_file(r'^\s+if \(thrchk\) exit\(1\);', 'if (0) exit(1);', + 'CONFIG/src/config.c') + # TODO: investigate a better way to add the check back in + # TODO: using, say, MSRs. Or move this to a variant. + def install(self, spec, prefix): with working_dir('ATLAS-Build', create=True): self.module.configure = Executable('../configure') - configure("--prefix=%s" % prefix) + configure('--prefix=%s' % prefix, + '-C', 'ic', 'cc', + '-C', 'if', 'f77', + "--dylibs") make() make('check') From 0570660d8109eb0a1a1d80ab104f9a7ad5ecc623 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 6 Jun 2015 18:23:12 -0700 Subject: [PATCH 31/35] Make blas a virtual dependency, default netlib-blas. --- var/spack/packages/atlas/package.py | 4 ++++ var/spack/packages/blas/package.py | 17 ----------------- var/spack/packages/netlib-blas/package.py | 7 ++++--- 3 files changed, 8 insertions(+), 20 deletions(-) delete mode 100644 var/spack/packages/blas/package.py diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py index fc0a1a7e67..255f22d666 100644 --- a/var/spack/packages/atlas/package.py +++ b/var/spack/packages/atlas/package.py @@ -14,6 +14,10 @@ class Atlas(Package): homepage = "http://math-atlas.sourceforge.net/" url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" + # TODO: make this provide BLAS once we have the ability to prefer dependencies. + # TODO: until then netlib-blas will be the default (and only) blas + # provides('blas') + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') def patch(self): diff --git a/var/spack/packages/blas/package.py b/var/spack/packages/blas/package.py deleted file mode 100644 index 0cf495d0c1..0000000000 --- a/var/spack/packages/blas/package.py +++ /dev/null @@ -1,17 +0,0 @@ -from spack import * -import os - -class Blas(Package): - """The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard - building blocks for performing basic vector and matrix operations.""" - - homepage = "http://www.netlib.org/blas/" - - version('unversioned', '5e99e975f7a1e3ea6abcad7c6e7e42e6', - url='http://www.netlib.org/blas/blas.tgz') - - def install(self, spec, prefix): - make() - mkdirp('%s' % prefix.lib) # Create the lib dir inside the install dir. - move('./blas_LINUX.a', '%s/libblas.a' % prefix.lib) # Rename the generated lib file to libblas.a - diff --git a/var/spack/packages/netlib-blas/package.py b/var/spack/packages/netlib-blas/package.py index 725bda1309..ce8fc1eef4 100644 --- a/var/spack/packages/netlib-blas/package.py +++ b/var/spack/packages/netlib-blas/package.py @@ -16,7 +16,7 @@ class NetlibBlas(Package): def install(self, spec, prefix): symlink('make.inc.example', 'make.inc') make('blaslib') - + # Tests that blas builds correctly make('blas_testing') @@ -24,5 +24,6 @@ def install(self, spec, prefix): mkdirp(prefix.lib) install('librefblas.a', prefix.lib) - # Blas virtual package should provide blas.a - symlink(prefix.lib + '/librefblas.a', prefix.lib + '/blas.a') \ No newline at end of file + # Blas virtual package should provide blas.a and libblas.a + symlink(prefix.lib + '/librefblas.a', prefix.lib + '/blas.a') + symlink(prefix.lib + '/librefblas.a', prefix.lib + '/libblas.a') From 0fc3b58890ddb18c4a2384c6f015c8f9417a1c01 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 7 Jun 2015 15:21:31 -0700 Subject: [PATCH 32/35] SPACK-38: Allow specs to be indexed by virtual dependencies. - The following now work differently: spec['mpi'] spec['blas'] This can return a spec for openmpi, mpich, mvapich, etc., EVEN if the spec is already concretized. This means that in a package that `depends_on('mpi')`, you can do `spec['mpi']` to see what it was concretized to. This should simplify MPI and BLAS packages. 'mpi' in spec 'blas' in spec Previously, if the spec had been concretized, these would be `False` because there was not a dependency in the DAG with either of these names. These will now be `True` even if the spec has been concretized. So, e.g., this will print "YES" s = Spec('callpath ^mpich') if 'mpi' in spec: print "YES" - Similarly, this will be True: Spec('mpich').satisfies('mpi') - Because of the way virtual dependencies are currently implemented, the above required some fiddling around with `package.py` so that it would never call `Spec.__contains__` (and result in endless recursion). - This should be fixed by allowing virutal dependnecies to have their own package class. - This would allow a quicker check for vdeps, without a call to `all_packages`. - For the time being, `package.py` shouldn't call `__contains__` --- lib/spack/spack/package.py | 37 ++++++++++------ lib/spack/spack/spec.py | 33 ++++++++++++-- lib/spack/spack/test/concretize.py | 9 +++- lib/spack/spack/test/spec_semantics.py | 61 ++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 18 deletions(-) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index e3d766f582..5abf2a6bb3 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -471,13 +471,18 @@ def extendee_spec(self): """Spec of the extendee of this package, or None if it is not an extension.""" if not self.extendees: return None - name = next(iter(self.extendees)) - if not name in self.spec: - spec, kwargs = self.extendees[name] - return spec - # Need to do this to get the concrete version of the spec - return self.spec[name] + # TODO: allow more than one extendee. + name = next(iter(self.extendees)) + + # If the extendee is in the spec's deps already, return that. + for dep in self.spec.traverse(): + if name == dep.name: + return dep + + # Otherwise return the spec from the extends() directive + spec, kwargs = self.extendees[name] + return spec @property @@ -542,7 +547,7 @@ def preorder_traversal(self, visited=None, **kwargs): def provides(self, vpkg_name): """True if this package provides a virtual package with the specified name.""" - return vpkg_name in self.provided + return any(s.name == vpkg_name for s in self.provided) def virtual_dependencies(self, visited=None): @@ -561,8 +566,11 @@ def installed_dependents(self): on this one.""" dependents = [] for spec in spack.db.installed_package_specs(): - if self.name != spec.name and self.spec in spec: - dependents.append(spec) + if self.name == spec.name: + continue + for dep in spec.traverse(): + if spec == dep: + dependents.append(spec) return dependents @@ -985,10 +993,13 @@ def do_deactivate(self, **kwargs): activated = spack.install_layout.extension_map(self.extendee_spec) for name, aspec in activated.items(): - if aspec != self.spec and self.spec in aspec: - raise ActivationError( - "Cannot deactivate %s beacuse %s is activated and depends on it." - % (self.spec.short_spec, aspec.short_spec)) + if aspec == self.spec: + continue + for dep in aspec.traverse(): + if self.spec == dep: + raise ActivationError( + "Cannot deactivate %s beacuse %s is activated and depends on it." + % (self.spec.short_spec, aspec.short_spec)) self.extendee_spec.package.deactivate(self, **self.extendee_args) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index aa13f0422c..5876fc6cf8 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -498,7 +498,13 @@ def virtual(self): Possible idea: just use conventin and make virtual deps all caps, e.g., MPI vs mpi. """ - return not spack.db.exists(self.name) + return Spec.is_virtual(self.name) + + + @staticmethod + def is_virtual(name): + """Test if a name is virtual without requiring a Spec.""" + return not spack.db.exists(name) @property @@ -1224,7 +1230,17 @@ def satisfies(self, other, deps=True, strict=False): """ other = self._autospec(other) - # First thing we care about is whether the name matches + # A concrete provider can satisfy a virtual dependency. + if not self.virtual and other.virtual: + pkg = spack.db.get(self.name) + if pkg.provides(other.name): + for provided, when_spec in pkg.provided.items(): + if self.satisfies(when_spec, deps=False, strict=strict): + if provided.satisfies(other): + return True + return False + + # Otherwise, first thing we care about is whether the name matches if self.name != other.name: return False @@ -1364,11 +1380,21 @@ def version(self): def __getitem__(self, name): - """TODO: reconcile __getitem__, _add_dependency, __contains__""" + """Get a dependency from the spec by its name.""" for spec in self.traverse(): if spec.name == name: return spec + if Spec.is_virtual(name): + # TODO: this is a kind of kludgy way to find providers + # TODO: should we just keep virtual deps in the DAG instead of + # TODO: removing them on concretize? + for spec in self.traverse(): + if spec.virtual: + continue + if spec.package.provides(name): + return spec + raise KeyError("No spec with name %s in %s" % (name, self)) @@ -1380,6 +1406,7 @@ def __contains__(self, spec): for s in self.traverse(): if s.satisfies(spec, strict=True): return True + return False diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index cc839a2340..b3a77d076a 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -152,7 +152,10 @@ def test_virtual_is_fully_expanded_for_callpath(self): spec.concretize() self.assertTrue('zmpi' in spec.dependencies) - self.assertFalse('mpi' in spec) + self.assertTrue(all(not 'mpi' in d.dependencies for d in spec.traverse())) + self.assertTrue('zmpi' in spec) + self.assertTrue('mpi' in spec) + self.assertTrue('fake' in spec.dependencies['zmpi']) @@ -168,7 +171,9 @@ def test_virtual_is_fully_expanded_for_mpileaks(self): self.assertTrue('zmpi' in spec.dependencies['callpath'].dependencies) self.assertTrue('fake' in spec.dependencies['callpath'].dependencies['zmpi'].dependencies) - self.assertFalse('mpi' in spec) + self.assertTrue(all(not 'mpi' in d.dependencies for d in spec.traverse())) + self.assertTrue('zmpi' in spec) + self.assertTrue('mpi' in spec) def test_my_dep_depends_on_provider_of_my_virtual_dep(self): diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index 20df2603f5..6666dbbb52 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -189,6 +189,67 @@ def test_unsatisfiable_variant_mismatch(self): self.check_unsatisfiable('mpich+foo', 'mpich~foo') + def test_satisfies_virtual(self): + self.assertTrue(Spec('mpich').satisfies(Spec('mpi'))) + self.assertTrue(Spec('mpich2').satisfies(Spec('mpi'))) + self.assertTrue(Spec('zmpi').satisfies(Spec('mpi'))) + + + # ================================================================================ + # Indexing specs + # ================================================================================ + def test_self_index(self): + s = Spec('callpath') + self.assertTrue(s['callpath'] == s) + + + def test_dep_index(self): + s = Spec('callpath') + s.normalize() + + self.assertTrue(s['callpath'] == s) + self.assertTrue(type(s['dyninst']) == Spec) + self.assertTrue(type(s['libdwarf']) == Spec) + self.assertTrue(type(s['libelf']) == Spec) + self.assertTrue(type(s['mpi']) == Spec) + + self.assertTrue(s['dyninst'].name == 'dyninst') + self.assertTrue(s['libdwarf'].name == 'libdwarf') + self.assertTrue(s['libelf'].name == 'libelf') + self.assertTrue(s['mpi'].name == 'mpi') + + + def test_spec_contains_deps(self): + s = Spec('callpath') + s.normalize() + self.assertTrue('dyninst' in s) + self.assertTrue('libdwarf' in s) + self.assertTrue('libelf' in s) + self.assertTrue('mpi' in s) + + + def test_virtual_index(self): + s = Spec('callpath') + s.concretize() + + s_mpich = Spec('callpath ^mpich') + s_mpich.concretize() + + s_mpich2 = Spec('callpath ^mpich2') + s_mpich2.concretize() + + s_zmpi = Spec('callpath ^zmpi') + s_zmpi.concretize() + + + self.assertTrue(s['mpi'].name != 'mpi') + self.assertTrue(s_mpich['mpi'].name == 'mpich') + self.assertTrue(s_mpich2['mpi'].name == 'mpich2') + self.assertTrue(s_zmpi['zmpi'].name == 'zmpi') + + for spec in [s, s_mpich, s_mpich2, s_zmpi]: + self.assertTrue('mpi' in spec) + # ================================================================================ # Constraints From 3f3ceb24c49b8d466048491743e9628bab44f46a Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 7 Jun 2015 15:39:40 -0700 Subject: [PATCH 33/35] Add some comments b/c I didn't understand my own test. --- lib/spack/spack/test/directory_layout.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py index beac038410..b3ad8efec4 100644 --- a/lib/spack/spack/test/directory_layout.py +++ b/lib/spack/spack/test/directory_layout.py @@ -167,12 +167,15 @@ def test_handle_unknown_package(self): def test_find(self): """Test that finding specs within an install layout works.""" packages = list(spack.db.all_packages())[:max_packages] + + # Create install prefixes for all packages in the list installed_specs = {} for pkg in packages: spec = pkg.spec.concretized() installed_specs[spec.name] = spec self.layout.create_install_directory(spec) + # Make sure all the installed specs appear in DirectoryLayout.all_specs() found_specs = dict((s.name, s) for s in self.layout.all_specs()) for name, spec in found_specs.items(): self.assertTrue(name in found_specs) From 0a92349f90703bb21e58d8e46d7027d654d31eff Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 7 Jun 2015 15:40:01 -0700 Subject: [PATCH 34/35] Try a little harder in concretize_version() -- concretize unsafe versions too. - This can result in the user being prompted to download an unsafe version. - Avoids overly strict errors when something *could* be satisfiable but we don't know about hte version. --- lib/spack/spack/concretize.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index 15e886ad3c..2e1d5d7f03 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -75,7 +75,23 @@ def concretize_version(self, spec): if valid_versions: spec.versions = ver([valid_versions[-1]]) else: - raise NoValidVersionError(spec) + # We don't know of any SAFE versions that match the given + # spec. Grab the spec's versions and grab the highest + # *non-open* part of the range of versions it specifies. + # Someone else can raise an error if this happens, + # e.g. when we go to fetch it and don't know how. But it + # *might* work. + if not spec.versions or spec.versions == VersionList([':']): + raise NoValidVersionError(spec) + else: + last = spec.versions[-1] + if isinstance(last, VersionRange): + if last.end: + spec.versions = ver([last.end]) + else: + spec.versions = ver([last.start]) + else: + spec.versions = ver([last]) def concretize_architecture(self, spec): @@ -174,8 +190,8 @@ def __init__(self, compiler_spec): class NoValidVersionError(spack.error.SpackError): - """Raised when there is no available version for a package that - satisfies a spec.""" + """Raised when there is no way to have a concrete version for a + particular spec.""" def __init__(self, spec): super(NoValidVersionError, self).__init__( - "No available version of %s matches '%s'" % (spec.name, spec.versions)) + "There are no valid versions for %s that match '%s'" % (spec.name, spec.versions)) From bde9c7eee3fb55258b6c5e0ddb143882ebe0cca3 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 7 Jun 2015 15:41:15 -0700 Subject: [PATCH 35/35] Upate ATLAS and netlib-blas. --- var/spack/packages/atlas/package.py | 34 +++++++++++++++++------ var/spack/packages/netlib-blas/package.py | 17 ++++++++++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/var/spack/packages/atlas/package.py b/var/spack/packages/atlas/package.py index 255f22d666..fc683363a7 100644 --- a/var/spack/packages/atlas/package.py +++ b/var/spack/packages/atlas/package.py @@ -12,13 +12,17 @@ class Atlas(Package): LAPACK library. """ homepage = "http://math-atlas.sourceforge.net/" - url = "http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2" - # TODO: make this provide BLAS once we have the ability to prefer dependencies. - # TODO: until then netlib-blas will be the default (and only) blas + version('3.11.34', '0b6c5389c095c4c8785fd0f724ec6825', + url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2/download') + version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da', + url='http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2') + + # TODO: make this provide BLAS once it works better. Create a way + # TODO: to mark "beta" packages and require explicit invocation. + # provides('blas') - version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da') def patch(self): # Disable thraed check. LLNL's environment does not allow @@ -29,13 +33,25 @@ def patch(self): # TODO: investigate a better way to add the check back in # TODO: using, say, MSRs. Or move this to a variant. + @when('@:3.10') def install(self, spec, prefix): with working_dir('ATLAS-Build', create=True): - self.module.configure = Executable('../configure') - configure('--prefix=%s' % prefix, - '-C', 'ic', 'cc', - '-C', 'if', 'f77', - "--dylibs") + configure = Executable('../configure') + configure('--prefix=%s' % prefix, '-C', 'ic', 'cc', '-C', 'if', 'f77', "--dylibs") + make() + make('check') + make('ptcheck') + make('time') + make("install") + + + def install(self, spec, prefix): + with working_dir('ATLAS-Build', create=True): + configure = Executable('../configure') + configure('--incdir=%s' % prefix.include, + '--libdir=%s' % prefix.lib, + '--cc=cc', + "--shared") make() make('check') diff --git a/var/spack/packages/netlib-blas/package.py b/var/spack/packages/netlib-blas/package.py index ce8fc1eef4..0a6cdb0442 100644 --- a/var/spack/packages/netlib-blas/package.py +++ b/var/spack/packages/netlib-blas/package.py @@ -1,4 +1,6 @@ from spack import * +import os + class NetlibBlas(Package): """Netlib reference BLAS""" @@ -13,8 +15,16 @@ class NetlibBlas(Package): # Doesn't always build correctly in parallel parallel = False + def patch(self): + os.symlink('make.inc.example', 'make.inc') + + mf = FileFilter('make.inc') + mf.filter('^FORTRAN.*', 'FORTRAN = f90') + mf.filter('^LOADER.*', 'LOADER = f90') + mf.filter('^CC =.*', 'CC = cc') + + def install(self, spec, prefix): - symlink('make.inc.example', 'make.inc') make('blaslib') # Tests that blas builds correctly @@ -25,5 +35,6 @@ def install(self, spec, prefix): install('librefblas.a', prefix.lib) # Blas virtual package should provide blas.a and libblas.a - symlink(prefix.lib + '/librefblas.a', prefix.lib + '/blas.a') - symlink(prefix.lib + '/librefblas.a', prefix.lib + '/libblas.a') + with working_dir(prefix.lib): + symlink('librefblas.a', 'blas.a') + symlink('librefblas.a', 'libblas.a')