diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2016-11-04 19:32:25 -0500 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-11-04 17:32:25 -0700 |
commit | 4e6d5350588ab2435afa4393c75190ec0e9c031c (patch) | |
tree | 396f2affcefa9aac2d09b526082120f68a09318c | |
parent | 78154a63e86774fb8952f42883f7788e94d0c8d2 (diff) | |
download | spack-4e6d5350588ab2435afa4393c75190ec0e9c031c.tar.gz spack-4e6d5350588ab2435afa4393c75190ec0e9c031c.tar.bz2 spack-4e6d5350588ab2435afa4393c75190ec0e9c031c.tar.xz spack-4e6d5350588ab2435afa4393c75190ec0e9c031c.zip |
Set Clang as the default compiler on macOS (#2225)
* Set OS-specific default compilers
* Fix flake8 warnings
-rw-r--r-- | etc/spack/defaults/darwin/packages.yaml | 18 | ||||
-rw-r--r-- | etc/spack/defaults/packages.yaml | 1 | ||||
-rw-r--r-- | lib/spack/spack/compilers/__init__.py | 19 | ||||
-rw-r--r-- | lib/spack/spack/preferred_packages.py | 6 |
4 files changed, 19 insertions, 25 deletions
diff --git a/etc/spack/defaults/darwin/packages.yaml b/etc/spack/defaults/darwin/packages.yaml new file mode 100644 index 0000000000..24a08809db --- /dev/null +++ b/etc/spack/defaults/darwin/packages.yaml @@ -0,0 +1,18 @@ +# ------------------------------------------------------------------------- +# This file controls default concretization preferences for Spack. +# +# Settings here are versioned with Spack and are intended to provide +# sensible defaults out of the box. Spack maintainers should edit this +# file to keep it current. +# +# Users can override these settings by editing the following files. +# +# Per-spack-instance settings (overrides defaults): +# $SPACK_ROOT/etc/spack/packages.yaml +# +# Per-user settings (overrides default and site settings): +# ~/.spack/packages.yaml +# ------------------------------------------------------------------------- +packages: + all: + compiler: [clang, gcc, intel] diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index a6b361d908..eae7752eee 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -15,6 +15,7 @@ # ------------------------------------------------------------------------- packages: all: + compiler: [gcc, intel, pgi, clang, xl, nag] providers: mpi: [openmpi, mpich] blas: [openblas] diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index 0db632a880..72f8532d3e 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -26,7 +26,6 @@ system and configuring Spack to use multiple compilers. """ import imp -import platform from llnl.util.lang import list_modules from llnl.util.filesystem import join_path @@ -44,12 +43,6 @@ _path_instance_vars = ['cc', 'cxx', 'f77', 'fc'] _other_instance_vars = ['modules', 'operating_system'] _cache_config_file = [] -# TODO: customize order in config file -if platform.system() == 'Darwin': - _default_order = ['clang', 'gcc', 'intel'] -else: - _default_order = ['gcc', 'intel', 'pgi', 'clang', 'xlc', 'nag'] - def _auto_compiler_spec(function): def converter(cspec_like, *args, **kwargs): @@ -169,18 +162,6 @@ def all_compilers(scope=None, init_config=True): for s in all_compilers_config(scope, init_config)] -def default_compiler(): - versions = [] - for name in _default_order: - versions = find(name) - if versions: - break - else: - raise NoCompilersError() - - return sorted(versions)[-1] - - def find_compilers(*paths): """Return a list of compilers found in the suppied paths. This invokes the find_compilers() method for each operating diff --git a/lib/spack/spack/preferred_packages.py b/lib/spack/spack/preferred_packages.py index 45a41c8e2b..08f9c3cfa8 100644 --- a/lib/spack/spack/preferred_packages.py +++ b/lib/spack/spack/preferred_packages.py @@ -28,9 +28,6 @@ from spack.version import * class PreferredPackages(object): - # Arbitrary, but consistent - _default_order = {'compiler': ['gcc', 'intel', 'clang', 'pgi', 'xlc']} - def __init__(self): self.preferred = spack.config.get_config('packages') self._spec_for_pkgname_cache = {} @@ -128,9 +125,6 @@ class PreferredPackages(object): key = (pkgname, component, second_key) if key not in self._spec_for_pkgname_cache: pkglist = self._order_for_package(pkgname, component, second_key) - if not pkglist: - if component in self._default_order: - pkglist = self._default_order[component] if component == 'compiler': self._spec_for_pkgname_cache[key] = \ [spack.spec.CompilerSpec(s) for s in pkglist] |