Set Clang as the default compiler on macOS (#2225)

* Set OS-specific default compilers

* Fix flake8 warnings
This commit is contained in:
Adam J. Stewart 2016-11-04 19:32:25 -05:00 committed by Todd Gamblin
parent 78154a63e8
commit 4e6d535058
4 changed files with 19 additions and 25 deletions

View file

@ -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]

View file

@ -15,6 +15,7 @@
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
packages: packages:
all: all:
compiler: [gcc, intel, pgi, clang, xl, nag]
providers: providers:
mpi: [openmpi, mpich] mpi: [openmpi, mpich]
blas: [openblas] blas: [openblas]

View file

@ -26,7 +26,6 @@
system and configuring Spack to use multiple compilers. system and configuring Spack to use multiple compilers.
""" """
import imp import imp
import platform
from llnl.util.lang import list_modules from llnl.util.lang import list_modules
from llnl.util.filesystem import join_path from llnl.util.filesystem import join_path
@ -44,12 +43,6 @@
_other_instance_vars = ['modules', 'operating_system'] _other_instance_vars = ['modules', 'operating_system']
_cache_config_file = [] _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 _auto_compiler_spec(function):
def converter(cspec_like, *args, **kwargs): 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)] 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): def find_compilers(*paths):
"""Return a list of compilers found in the suppied paths. """Return a list of compilers found in the suppied paths.
This invokes the find_compilers() method for each operating This invokes the find_compilers() method for each operating

View file

@ -28,9 +28,6 @@
class PreferredPackages(object): class PreferredPackages(object):
# Arbitrary, but consistent
_default_order = {'compiler': ['gcc', 'intel', 'clang', 'pgi', 'xlc']}
def __init__(self): def __init__(self):
self.preferred = spack.config.get_config('packages') self.preferred = spack.config.get_config('packages')
self._spec_for_pkgname_cache = {} self._spec_for_pkgname_cache = {}
@ -128,9 +125,6 @@ def _spec_for_pkgname(self, pkgname, component, second_key):
key = (pkgname, component, second_key) key = (pkgname, component, second_key)
if key not in self._spec_for_pkgname_cache: if key not in self._spec_for_pkgname_cache:
pkglist = self._order_for_package(pkgname, component, second_key) 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': if component == 'compiler':
self._spec_for_pkgname_cache[key] = \ self._spec_for_pkgname_cache[key] = \
[spack.spec.CompilerSpec(s) for s in pkglist] [spack.spec.CompilerSpec(s) for s in pkglist]