diff options
-rwxr-xr-x | bin/spack | 4 | ||||
-rw-r--r-- | lib/spack/spack/cmd/graph.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/cmd/setup.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/compiler.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/compilers/clang.py | 40 | ||||
-rw-r--r-- | lib/spack/spack/compilers/gcc.py | 9 | ||||
-rw-r--r-- | lib/spack/spack/compilers/intel.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/hooks/__init__.py | 7 | ||||
-rw-r--r-- | lib/spack/spack/hooks/case_consistency.py | 101 | ||||
-rw-r--r-- | lib/spack/spack/hooks/yaml_version_check.py (renamed from lib/spack/spack/yaml_version_check.py) | 2 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/likwid/package.py | 6 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/petsc/package.py | 6 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/slepc/package.py | 2 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/xsdktrilinos/package.py | 100 |
14 files changed, 288 insertions, 15 deletions
@@ -156,8 +156,8 @@ def main(): import spack.util.debug as debug debug.register_interrupt_handler() - from spack.yaml_version_check import check_yaml_versions - check_yaml_versions() + # Run any available pre-run hooks + spack.hooks.pre_run() spack.spack_working_dir = working_dir if args.mock: diff --git a/lib/spack/spack/cmd/graph.py b/lib/spack/spack/cmd/graph.py index ed3aed1946..f9011caef4 100644 --- a/lib/spack/spack/cmd/graph.py +++ b/lib/spack/spack/cmd/graph.py @@ -28,6 +28,7 @@ import llnl.util.tty as tty import spack import spack.cmd +import spack.store from spack.spec import * from spack.graph import * @@ -73,7 +74,7 @@ def graph(parser, args): if args.specs: tty.die("Can't specify specs with --installed") args.dot = True - specs = spack.installed_db.query() + specs = spack.store.db.query() else: specs = spack.cmd.parse_specs( diff --git a/lib/spack/spack/cmd/setup.py b/lib/spack/spack/cmd/setup.py index 953906975e..82c5e4cb4e 100644 --- a/lib/spack/spack/cmd/setup.py +++ b/lib/spack/spack/cmd/setup.py @@ -30,6 +30,7 @@ import sys import llnl.util.tty as tty import spack +import spack.store import spack.cmd import spack.cmd.install as install import spack.cmd.common.arguments as arguments @@ -130,7 +131,7 @@ def setup(self, args): tty.die("spack setup only takes one spec.") # Take a write lock before checking for existence. - with spack.installed_db.write_transaction(): + with spack.store.db.write_transaction(): spec = specs[0] if not spack.repo.exists(spec.name): tty.warn("No such package: %s" % spec.name) diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 92fa1ac4db..d5ea85a7b7 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -183,6 +183,16 @@ class Compiler(object): "If you think it should, please edit the compiler subclass and", "submit a pull request or issue.") + # This property should be overridden in the compiler subclass if + # C++17 is supported by that compiler + @property + def cxx17_flag(self): + # If it is not overridden, assume it is not supported and warn the user + tty.die( + "The compiler you have chosen does not currently support C++17.", + "If you think it should, please edit the compiler subclass and", + "submit a pull request or issue.") + # # Compiler classes have methods for querying the version of # specific compiler executables. This is used when discovering compilers. diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 14dc9d6476..3d68a37c44 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -70,8 +70,12 @@ class Clang(Compiler): @property def cxx11_flag(self): if self.is_apple: - # FIXME: figure out from which version Apple's clang supports c++11 - return "-std=c++11" + # Adapted from CMake's AppleClang-CXX rules + # Spack's AppleClang detection only valid form Xcode >= 4.6 + if self.version < ver('4.0.0'): + tty.die("Only Apple LLVM 4.0 and above support c++11") + else: + return "-std=c++11" else: if self.version < ver('3.3'): tty.die("Only Clang 3.3 and above support c++11.") @@ -79,6 +83,38 @@ class Clang(Compiler): return "-std=c++11" @property + def cxx14_flag(self): + if self.is_apple: + # Adapted from CMake's rules for AppleClang + if self.version < ver('5.1.0'): + tty.die("Only Apple LLVM 5.1 and above support c++14.") + elif self.version < ver('6.1.0'): + return "-std=c++1y" + else: + return "-std=c++14" + else: + if self.version < ver('3.4'): + tty.die("Only Clang 3.4 and above support c++14.") + elif self.version < ver('3.5'): + return "-std=c++1y" + else: + return "-std=c++14" + + @property + def cxx17_flag(self): + if self.is_apple: + # Adapted from CMake's rules for AppleClang + if self.version < ver('6.1.0'): + tty.die("Only Apple LLVM 6.1 and above support c++17.") + else: + return "-std=c++1z" + else: + if self.version < ver('3.5'): + tty.die("Only Clang 3.5 and above support c++17.") + else: + return "-std=c++1z" + + @property def pic_flag(self): return "-fPIC" diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 80d24910c3..304f82a492 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -71,10 +71,19 @@ class Gcc(Compiler): def cxx14_flag(self): if self.version < ver('4.8'): tty.die("Only gcc 4.8 and above support c++14.") + elif self.version < ver('4.9'): + return "-std=c++1y" else: return "-std=c++14" @property + def cxx17_flag(self): + if self.version < ver('5.0'): + tty.die("Only gcc 5.0 and above support c++17.") + else: + return "-std=c++1z" + + @property def pic_flag(self): return "-fPIC" diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 4ff7185c84..8461753962 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -66,6 +66,16 @@ class Intel(Compiler): return "-std=c++11" @property + def cxx14_flag(self): + # Adapted from CMake's Intel-CXX rules. + if self.version < ver('15'): + tty.die("Only intel 15.0 and above support c++14.") + elif self.version < ver('15.0.2'): + return "-std=c++1y" + else: + return "-std=c++14" + + @property def pic_flag(self): return "-fPIC" diff --git a/lib/spack/spack/hooks/__init__.py b/lib/spack/spack/hooks/__init__.py index ff4ebc2e57..6454a865b6 100644 --- a/lib/spack/spack/hooks/__init__.py +++ b/lib/spack/spack/hooks/__init__.py @@ -64,16 +64,19 @@ class HookRunner(object): def __init__(self, hook_name): self.hook_name = hook_name - def __call__(self, pkg): + def __call__(self, *args, **kwargs): for module in all_hook_modules(): if hasattr(module, self.hook_name): hook = getattr(module, self.hook_name) if hasattr(hook, '__call__'): - hook(pkg) + hook(*args, **kwargs) + # # Define some functions that can be called to fire off hooks. # +pre_run = HookRunner('pre_run') + pre_install = HookRunner('pre_install') post_install = HookRunner('post_install') diff --git a/lib/spack/spack/hooks/case_consistency.py b/lib/spack/spack/hooks/case_consistency.py new file mode 100644 index 0000000000..faf38f7ae3 --- /dev/null +++ b/lib/spack/spack/hooks/case_consistency.py @@ -0,0 +1,101 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/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 Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, 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 Lesser 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 +############################################################################## +from __future__ import absolute_import +import os +import re +import platform + +from llnl.util.filesystem import * + +import spack +from spack.util.executable import * + + +def pre_run(): + if platform.system() != "Darwin": + return + + git_case_consistency_check(spack.repo.get_repo('builtin').packages_path) + + +def git_case_consistency_check(path): + """Re-sync case of files in a directory with git. + + On case-insensitive but case-preserving filesystems like Mac OS X, + Git doesn't properly rename files that only had their case changed. + + This checks files in a directory against git and does a + case-restoring rename (actually two renames, e.g.:: + + name -> tmp -> NAME + + We use this in Spack to ensure package directories are named + correctly. + + TODO: this check can probably be removed once package names have been + TODO: lowercase for a long while. + + """ + with working_dir(path): + # Don't bother fixing case if Spack isn't in a git repository + git = which('git') + if not git: + return + + try: + git_filenames = git('ls-tree', '--name-only', 'HEAD', output=str) + git_filenames = set(re.split(r'\s+', git_filenames.strip())) + except ProcessError: + return # Ignore errors calling git + + lower_to_mixed = {} + for fn in git_filenames: + lower = fn.lower() + mixed = lower_to_mixed.setdefault(lower, []) + mixed.append(fn) + + # Iterate through all actual files and make sure their names are + # the same as corresponding names in git + actual_filenames = os.listdir('.') + for actual in actual_filenames: + lower = actual.lower() + + # not tracked by git + if lower not in lower_to_mixed: + continue + + # Don't know what to do with multiple matches + if len(lower_to_mixed[lower]) != 1: + continue + + # Skip if case is already correct + git_name = lower_to_mixed[lower][0] + if git_name == actual: + continue + + # restore case with two renames + tmp_name = actual + '.spack.tmp' + os.rename(actual, tmp_name) + os.rename(tmp_name, git_name) diff --git a/lib/spack/spack/yaml_version_check.py b/lib/spack/spack/hooks/yaml_version_check.py index 2c5b511d7f..a4b38198bc 100644 --- a/lib/spack/spack/yaml_version_check.py +++ b/lib/spack/spack/hooks/yaml_version_check.py @@ -31,7 +31,7 @@ import spack.util.spack_yaml as syaml import spack.config -def check_yaml_versions(): +def pre_run(): check_compiler_yaml_version() diff --git a/var/spack/repos/builtin/packages/likwid/package.py b/var/spack/repos/builtin/packages/likwid/package.py index 8d2290d8ad..8d1687a11a 100644 --- a/var/spack/repos/builtin/packages/likwid/package.py +++ b/var/spack/repos/builtin/packages/likwid/package.py @@ -61,9 +61,9 @@ class Likwid(Package): prefix, 'config.mk') - # TODO: - # set INSTALL_CHOWN in config.mk to your user/group. - # Defaults are root. + filter_file('^INSTALL_CHOWN.*', + 'INSTALL_CHOWN = -o $(USER)', + 'config.mk') make() make('install') diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 82b639313a..578349cbc4 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -40,7 +40,7 @@ class Petsc(Package): version('develop', git='https://bitbucket.org/petsc/petsc.git', tag='master') version('for-pflotran-0.1.0', git='https://bitbucket.org/petsc/petsc.git', commit='7943f4e1472fff9cf1fc630a1100136616e4970f') - + version('3.7.4', 'aaf94fa54ef83022c14091f10866eedf') version('3.7.2', '50da49867ce7a49e7a0c1b37f4ec7b34') version('3.6.4', '7632da2375a3df35b8891c9526dbdde7') @@ -79,7 +79,7 @@ class Petsc(Package): depends_on('mpi', when='+mpi') # Build dependencies - depends_on('python @2.6:2.7') + depends_on('python @2.6:2.7', type='build') # Other dependencies depends_on('boost', when='@:3.5+boost') @@ -94,7 +94,7 @@ class Petsc(Package): depends_on('hypre~internal-superlu', when='+hypre+mpi~complex') depends_on('superlu-dist@:4.3', when='@3.4.4:3.6.4+superlu-dist+mpi') depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi') - depends_on('superlu-dist@5.0.0:', when='@for-pflotran-0.1.0+superlu-dist+mpi') + depends_on('superlu-dist@5.0.0:', when='@for-pflotran-0.1.0+superlu-dist+mpi') depends_on('mumps+mpi', when='+mumps+mpi') depends_on('scalapack', when='+mumps+mpi') diff --git a/var/spack/repos/builtin/packages/slepc/package.py b/var/spack/repos/builtin/packages/slepc/package.py index e208400eea..17c512119c 100644 --- a/var/spack/repos/builtin/packages/slepc/package.py +++ b/var/spack/repos/builtin/packages/slepc/package.py @@ -41,6 +41,8 @@ class Slepc(Package): variant('arpack', default=True, description='Enables Arpack wrappers') + # NOTE: make sure PETSc and SLEPc use the same python. + depends_on('python@2.6:2.7', type='build') depends_on('petsc@3.7:', when='@3.7.1:') depends_on('petsc@3.6.3:3.6.4', when='@3.6.2:3.6.3') depends_on('arpack-ng~mpi', when='+arpack^petsc~mpi') diff --git a/var/spack/repos/builtin/packages/xsdktrilinos/package.py b/var/spack/repos/builtin/packages/xsdktrilinos/package.py new file mode 100644 index 0000000000..7aea15ed9c --- /dev/null +++ b/var/spack/repos/builtin/packages/xsdktrilinos/package.py @@ -0,0 +1,100 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/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 Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, 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 Lesser 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 +############################################################################## +from spack import * +import os + + +class Xsdktrilinos(CMakePackage): + """xSDKTrilinos contains the portions of Trilinos that depend on PETSc + because they would cause a circular dependency if built as part of + Trilinos. + """ + homepage = "https://trilinos.org/" + base_url = "https://github.com/trilinos/xSDKTrilinos/archive" + + version('develop', git='https://github.com/trilinos/xSDKTrilinos.git', tag='master') + version('12.8.1', '9cc338ded17d1e10ea6c0dc18b22dcd4') + version('12.6.4', '44c4c54ccbac73bb8939f68797b9454a') + + def url_for_version(self, version): + return '%s/trilinos-release-%s.tar.gz' % \ + (Xsdktrilinos.base_url, version.dashed) + + variant('hypre', default=True, + description='Compile with Hypre preconditioner') + variant('petsc', default=True, + description='Compile with PETSc solvers') + variant('shared', default=True, + description='Enables the build of shared libraries') + variant('debug', default=False, + description='Builds a debug version of the libraries') + + depends_on('cmake', type='build') + + # MPI related dependencies + depends_on('mpi') + depends_on('hypre~internal-superlu', when='+hypre') + depends_on('petsc+mpi~complex', when='+petsc') + depends_on('trilinos@12.6.4', when='@12.6.4') + depends_on('trilinos@12.8.1', when='@12.8.1') + depends_on('trilinos@develop', when='@develop') + + def cmake_args(self): + spec = self.spec + + options = [] + + mpi_bin = spec['mpi'].prefix.bin + options.extend([ + '-DxSDKTrilinos_VERBOSE_CONFIGURE:BOOL=OFF', + '-DxSDKTrilinos_ENABLE_TESTS:BOOL=ON', + '-DxSDKTrilinos_ENABLE_EXAMPLES:BOOL=ON', + '-DTrilinos_INSTALL_DIR=%s' % spec['trilinos'].prefix, + '-DCMAKE_BUILD_TYPE:STRING=%s' % ( + 'DEBUG' if '+debug' in spec else 'RELEASE'), + '-DBUILD_SHARED_LIBS:BOOL=%s' % ( + 'ON' if '+shared' in spec else 'OFF'), + '-DTPL_ENABLE_MPI:BOOL=ON', + '-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix, + '-DxSDKTrilinos_ENABLE_CXX11:BOOL=ON', + '-DTPL_ENABLE_HYPRE:BOOL=%s' % ( + 'ON' if '+hypre' in spec else 'OFF'), + '-DTPL_ENABLE_PETSC:BOOL=%s' % ( + 'ON' if '+petsc' in spec else 'OFF'), + '-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % self.prefix + ]) + + # Fortran lib + if spec.satisfies('%gcc') or spec.satisfies('%clang'): + libgfortran = os.path.dirname(os.popen( + '%s --print-file-name libgfortran.a' % + join_path(mpi_bin, 'mpif90')).read()) + options.extend([ + '-DxSDKTrilinos_EXTRA_LINK_FLAGS:STRING=-L%s/ -lgfortran' % ( + libgfortran), + '-DxSDKTrilinos_ENABLE_Fortran=ON' + ]) + + return options |