summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/cmd/bootstrap.py49
-rw-r--r--lib/spack/spack/platforms/cray_xc.py9
-rw-r--r--var/spack/repos/builtin/packages/mumps/package.py74
-rw-r--r--var/spack/repos/builtin/packages/netlib-scalapack/package.py33
-rw-r--r--var/spack/repos/builtin/packages/py-numpy/package.py1
5 files changed, 110 insertions, 56 deletions
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py
index bec11439b5..60e2bd3a11 100644
--- a/lib/spack/spack/cmd/bootstrap.py
+++ b/lib/spack/spack/cmd/bootstrap.py
@@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
-from subprocess import check_call
import llnl.util.tty as tty
from llnl.util.filesystem import join_path, mkdirp
@@ -31,26 +30,49 @@ from llnl.util.filesystem import join_path, mkdirp
import spack
from spack.util.executable import which
+_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
+
description = "Create a new installation of spack in another prefix"
+
def setup_parser(subparser):
- subparser.add_argument('prefix', help="names of prefix where we should install spack")
+ subparser.add_argument(
+ '-r', '--remote', action='store', dest='remote',
+ help="name of the remote to bootstrap from", default='origin')
+ subparser.add_argument(
+ 'prefix',
+ help="names of prefix where we should install spack")
-def get_origin_url():
+def get_origin_info(remote):
git_dir = join_path(spack.prefix, '.git')
git = which('git', required=True)
- origin_url = git(
- '--git-dir=%s' % git_dir, 'config', '--get', 'remote.origin.url',
- output=str)
- return origin_url.strip()
+ try:
+ branch = git('symbolic-ref', '--short', 'HEAD', output=str)
+ except ProcessError:
+ branch = 'develop'
+ tty.warn('No branch found; using default branch: %s' % branch)
+ if remote == 'origin' and \
+ branch not in ('master', 'develop'):
+ branch = 'develop'
+ tty.warn('Unknown branch found; using default branch: %s' % branch)
+ try:
+ origin_url = git(
+ '--git-dir=%s' % git_dir,
+ 'config', '--get', 'remote.%s.url' % remote,
+ output=str)
+ except ProcessError:
+ origin_url = _SPACK_UPSTREAM
+ tty.warn('No git repository found; '
+ 'using default upstream URL: %s' % origin_url)
+ return (origin_url.strip(), branch.strip())
def bootstrap(parser, args):
- origin_url = get_origin_url()
+ origin_url, branch = get_origin_info(args.remote)
prefix = args.prefix
- tty.msg("Fetching spack from origin: %s" % origin_url)
+ tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url))
if os.path.isfile(prefix):
tty.die("There is already a file at %s" % prefix)
@@ -62,7 +84,8 @@ def bootstrap(parser, args):
files_in_the_way = os.listdir(prefix)
if files_in_the_way:
- tty.die("There are already files there! Delete these files before boostrapping spack.",
+ tty.die("There are already files there! "
+ "Delete these files before boostrapping spack.",
*files_in_the_way)
tty.msg("Installing:",
@@ -73,8 +96,10 @@ def bootstrap(parser, args):
git = which('git', required=True)
git('init', '--shared', '-q')
git('remote', 'add', 'origin', origin_url)
- git('fetch', 'origin', 'master:refs/remotes/origin/master', '-n', '-q')
- git('reset', '--hard', 'origin/master', '-q')
+ git('fetch', 'origin', '%s:refs/remotes/origin/%s' % (branch, branch),
+ '-n', '-q')
+ git('reset', '--hard', 'origin/%s' % branch, '-q')
+ git('checkout', '-B', branch, 'origin/%s' % branch, '-q')
tty.msg("Successfully created a new spack in %s" % prefix,
"Run %s/bin/spack to use this installation." % prefix)
diff --git a/lib/spack/spack/platforms/cray_xc.py b/lib/spack/spack/platforms/cray_xc.py
index e710303e23..8dc575bb71 100644
--- a/lib/spack/spack/platforms/cray_xc.py
+++ b/lib/spack/spack/platforms/cray_xc.py
@@ -2,6 +2,7 @@ import os
from spack.architecture import Platform, Target
from spack.operating_systems.linux_distro import LinuxDistro
from spack.operating_systems.cnl import Cnl
+from spack.util.executable import which
class CrayXc(Platform):
priority = 20
@@ -42,5 +43,11 @@ class CrayXc(Platform):
@classmethod
def detect(self):
- return os.path.exists('/opt/cray/craype')
+ if os.path.exists('/cray_home'):
+ cc_verbose = which('cc')
+ cc_verbose.add_default_arg('-craype-verbose')
+ text = cc_verbose(output=str, error=str, ignore_errors=True).split()
+ if '-D__CRAYXC' in text:
+ return True
+ return False
diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
index 92c45c9b95..b85a6d2b94 100644
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -23,7 +23,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import os, sys, glob
+import os
+import sys
+import glob
+
class Mumps(Package):
"""MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
@@ -44,13 +47,11 @@ class Mumps(Package):
variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
variant('shared', default=True, description='Build shared libraries')
-
depends_on('scotch + esmumps', when='~ptscotch+scotch')
depends_on('scotch + esmumps + mpi', when='+ptscotch')
depends_on('metis@5:', when='+metis')
depends_on('parmetis', when="+parmetis")
depends_on('blas')
- depends_on('lapack')
depends_on('scalapack', when='+mpi')
depends_on('mpi', when='+mpi')
@@ -60,42 +61,52 @@ class Mumps(Package):
# end before install
# def patch(self):
def write_makefile_inc(self):
- if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
- raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
+ if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec: # NOQA: ignore=E501
+ raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi') # NOQA: ignore=E501
- makefile_conf = ["LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib]
+ makefile_conf = ["LIBBLAS = %s" % to_link_flags(
+ self.spec['blas'].blas_shared_lib)
+ ]
orderings = ['-Dpord']
if '+ptscotch' in self.spec or '+scotch' in self.spec:
join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
- makefile_conf.extend(
- ["ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
- "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
- join_lib,
- join_lib.join(['esmumps', 'scotch', 'scotcherr']))])
+ makefile_conf.extend([
+ "ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
+ "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
+ join_lib,
+ join_lib.join(['esmumps',
+ 'scotch',
+ 'scotcherr']))
+ ])
+
orderings.append('-Dscotch')
if '+ptscotch' in self.spec:
orderings.append('-Dptscotch')
if '+parmetis' in self.spec and '+metis' in self.spec:
- libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
- makefile_conf.extend(
- ["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
- "LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
+ makefile_conf.extend([
+ "IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
+ "LMETIS = -L%s -l%s -L%s -l%s" % (
+ self.spec['parmetis'].prefix.lib, 'parmetis',
+ self.spec['metis'].prefix.lib, 'metis')
+ ])
orderings.append('-Dparmetis')
elif '+metis' in self.spec:
- makefile_conf.extend(
- ["IMETIS = -I%s" % self.spec['metis'].prefix.include,
- "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
+ makefile_conf.extend([
+ "IMETIS = -I%s" % self.spec['metis'].prefix.include,
+ "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')
+ ])
orderings.append('-Dmetis')
makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
# when building shared libs need -fPIC, otherwise
- # /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
+ # /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1'
+ # can not be used when making a shared object; recompile with -fPIC
fpic = '-fPIC' if '+shared' in self.spec else ''
# TODO: test this part, it needs a full blas, scalapack and
# partitionning environment with 64bit integers
@@ -104,7 +115,7 @@ class Mumps(Package):
# the fortran compilation flags most probably are
# working only for intel and gnu compilers this is
# perhaps something the compiler should provide
- ['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic,'-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),
+ ['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic, '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'), # NOQA: ignore=E501
'OPTL = %s -O ' % fpic,
'OPTC = %s -O -DINTSIZE64' % fpic])
else:
@@ -113,7 +124,6 @@ class Mumps(Package):
'OPTL = %s -O ' % fpic,
'OPTC = %s -O ' % fpic])
-
if '+mpi' in self.spec:
makefile_conf.extend(
["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
@@ -134,16 +144,17 @@ class Mumps(Package):
if '+shared' in self.spec:
if sys.platform == 'darwin':
- # Building dylibs with mpif90 causes segfaults on 10.8 and 10.10. Use gfortran. (Homebrew)
+ # Building dylibs with mpif90 causes segfaults on 10.8 and
+ # 10.10. Use gfortran. (Homebrew)
makefile_conf.extend([
'LIBEXT=.dylib',
- 'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'],prefix.lib),
+ 'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'], prefix.lib), # NOQA: ignore=E501
'RANLIB=echo'
])
else:
makefile_conf.extend([
'LIBEXT=.so',
- 'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,
+ 'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib, # NOQA: ignore=E501
'RANLIB=echo'
])
else:
@@ -153,9 +164,8 @@ class Mumps(Package):
'RANLIB = ranlib'
])
-
- makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
- 'Makefile.inc')
+ makefile_inc_template = join_path(
+ os.path.dirname(self.module.__file__), 'Makefile.inc')
with open(makefile_inc_template, "r") as fh:
makefile_conf.extend(fh.read().split('\n'))
@@ -164,8 +174,6 @@ class Mumps(Package):
makefile_inc = '\n'.join(makefile_conf)
fh.write(makefile_inc)
-
-
def install(self, spec, prefix):
make_libs = []
@@ -189,15 +197,15 @@ class Mumps(Package):
install_tree('lib', prefix.lib)
install_tree('include', prefix.include)
- if '~mpi' in spec:
+ if '~mpi' in spec:
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
- for f in glob.glob(join_path('libseq','*.h')):
+ for f in glob.glob(join_path('libseq', '*.h')):
install(f, prefix.include)
- # FIXME: extend the tests to mpirun -np 2 (or alike) when build with MPI
- # FIXME: use something like numdiff to compare blessed output with the current
+ # FIXME: extend the tests to mpirun -np 2 when build with MPI
+ # FIXME: use something like numdiff to compare output files
with working_dir('examples'):
if '+float' in spec:
os.system('./ssimpletest < input_simpletest_real')
diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
index a8250a38de..f7733249cf 100644
--- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
@@ -25,8 +25,10 @@
from spack import *
import sys
+
class NetlibScalapack(Package):
- """ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
+ """ScaLAPACK is a library of high-performance linear algebra routines for
+ parallel distributed memory machines"""
homepage = "http://www.netlib.org/scalapack/"
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
@@ -48,10 +50,22 @@ class NetlibScalapack(Package):
def install(self, spec, prefix):
options = [
- "-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'),
- "-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else 'ON'),
- "-DUSE_OPTIMIZED_LAPACK_BLAS:BOOL=ON", # forces scalapack to use find_package(LAPACK)
- ]
+ "-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else
+ 'OFF'),
+ "-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else
+ 'ON'),
+ # forces scalapack to use find_package(LAPACK):
+ "-DUSE_OPTIMIZED_LAPACK_BLAS:BOOL=ON",
+ ]
+
+ # Make sure we use Spack's Lapack:
+ options.extend([
+ '-DLAPACK_FOUND=true',
+ '-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include,
+ '-DLAPACK_LIBRARIES=%s' % (
+ spec['lapack'].lapack_shared_lib if '+shared' in spec else
+ spec['lapack'].lapack_static_lib),
+ ])
if '+fpic' in spec:
options.extend([
@@ -66,16 +80,15 @@ class NetlibScalapack(Package):
make()
make("install")
- # The shared libraries are not installed correctly on Darwin; correct this
+ # The shared libraries are not installed correctly on Darwin:
if (sys.platform == 'darwin') and ('+shared' in spec):
fix_darwin_install_name(prefix.lib)
-
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
- lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
- lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
+ lib_suffix = dso_suffix if '+shared' in spec else 'a'
spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
spec.cc_link = spec.fc_link
- spec.libraries = [join_path(spec.prefix.lib, 'libscalapack%s' % lib_suffix)]
+ spec.libraries = [join_path(spec.prefix.lib,
+ 'libscalapack.%s' % lib_suffix)]
diff --git a/var/spack/repos/builtin/packages/py-numpy/package.py b/var/spack/repos/builtin/packages/py-numpy/package.py
index 6bc11a5e48..2febdac658 100644
--- a/var/spack/repos/builtin/packages/py-numpy/package.py
+++ b/var/spack/repos/builtin/packages/py-numpy/package.py
@@ -44,6 +44,7 @@ class PyNumpy(Package):
extends('python')
depends_on('py-nose', type='build')
+ depends_on('py-setuptools', type='build')
depends_on('blas', when='+blas')
depends_on('lapack', when='+lapack')