bugfix: use string keys to set preferred targets (#12921)

Preferred targets were failing because we were looking them up by
Microarchitecture object, not by string.

- [x] Add a call to `str()` to fix target lookup.
- [x] Add a test to exercise this part of concretization.
- [x] Add documentation for setting `target` in `packages.yaml`
This commit is contained in:
Todd Gamblin
2019-09-24 01:18:48 -07:00
committed by Massimiliano Culpo
parent 2468ccee58
commit 18d63a239f
4 changed files with 32 additions and 9 deletions

View File

@@ -865,9 +865,11 @@ or together by using the reserved keyword ``arch``:
$ spack install libelf arch=cray-CNL10-haswell
Normally users don't have to bother specifying the architecture
if they are installing software for their current host as in that case the
values will be detected automatically.
Normally users don't have to bother specifying the architecture if they
are installing software for their current host, as in that case the
values will be detected automatically. If you need fine-grained control
over which packages use which targets (or over *all* packages' default
target), see :ref:`concretization-preferences`.
.. admonition:: Cray machines

View File

@@ -149,6 +149,7 @@ Here's an example ``packages.yaml`` file that sets preferred packages:
version: [2.2, 2.4, 2.3]
all:
compiler: [gcc@4.4.7, 'gcc@4.6:', intel, clang, pgi]
target: [sandybridge]
providers:
mpi: [mvapich2, mpich, openmpi]
@@ -162,11 +163,11 @@ on the command line if explicitly requested.
Each ``packages.yaml`` file begins with the string ``packages:`` and
package names are specified on the next level. The special string ``all``
applies settings to each package. Underneath each package name is
one or more components: ``compiler``, ``variants``, ``version``,
or ``providers``. Each component has an ordered list of spec
``constraints``, with earlier entries in the list being preferred over
later entries.
applies settings to *all* packages. Underneath each package name is one
or more components: ``compiler``, ``variants``, ``version``,
``providers``, and ``target``. Each component has an ordered list of
spec ``constraints``, with earlier entries in the list being preferred
over later entries.
Sometimes a package installation may have constraints that forbid
the first concretization rule, in which case Spack will use the first