Commit graph

4419 commits

Author SHA1 Message Date
Massimiliano Culpo
72569a0198 concretizer: emit facts for integrity constraints 2020-12-20 07:00:46 -08:00
Massimiliano Culpo
e644255770 concretizer: emit facts for constraints on imposed dependencies 2020-12-20 07:00:46 -08:00
Massimiliano Culpo
d8dc4b141e concretizer: avoid redundant grounding on dependency types 2020-12-20 07:00:46 -08:00
Todd Gamblin
bb78a73ed3 concretizer: move conditional dependency logic into concretize.lp
Continuing to convert everything in `asp.py` into facts, make the
generation of ground rules for conditional dependencies use facts, and
move the semantics into `concretize.lp`.

This is probably the most complex logic in Spack, as dependencies can be
conditional on anything, and we need conditional ASP rules to accumulate
and map all the dependency conditions to spec attributes.

The logic looks complicated, but essentially it accumulates any
constraints associated with particular conditions into a fact associated
with the condition by id. Then, if *any* condition id's fact is True, we
trigger the dependency.

This simplifies the way `declared_dependency()` works -- the dependency
is now declared regardless of whether it is conditional, and the
conditions are handled by `dependency_condition()` facts.
2020-12-20 07:00:46 -08:00
Todd Gamblin
d7fe2d5678 concretizer: spec_clauses should traverse dependencies
There are currently no places where we do not want to traverse
dependencies in `spec_clauses()`, so simplify the logic by consolidating
`spec_traverse_clauses()` with `spec_clauses()`.
2020-12-20 07:00:46 -08:00
Todd Gamblin
87a9e1c951 concretizer: pull _develop_specs_from_env out of main setup loop 2020-12-20 07:00:46 -08:00
Todd Gamblin
950fb0948b concretizer: add #defined statements to avoid warnings.
`version_satisfies/2` and `node_compiler_version_satisfies/3` are
generated but need `#defined` directives to avoid " info: atom does not
occur in any rule head:" warnings.
2020-12-20 07:00:46 -08:00
Massimiliano Culpo
4901728c5b
asp: memoize the list of all target_specs to speed-up setup phase (#20473)
* asp: memoize the list of all target_specs to speed-up setup phase

* asp: memoize using a cache per solver object
2020-12-19 07:07:22 -08:00
Scott Wittenburg
594512bdb3
ci: fixes for compiler bootstrapping (#17563)
This PR addresses a number of issues related to compiler bootstrapping.

Specifically:
1. Collect compilers to be bootstrapped while queueing in installer
Compiler tasks currently have an incomplete list in their task.dependents,
making those packages fail to install as they think they have not all their
dependencies installed. This PR collects the dependents and sets them on
compiler tasks.

2. allow boostrapped compilers to back off target
Bootstrapped compilers may be built with a compiler that doesn't support
the target used by the rest of the spec.  Allow them to build with less
aggressive target optimization settings.

3. Support for target ranges
Backing off the target necessitates computing target ranges, so make Spack
handle those properly.  Notably, this adds an intersection method for target
ranges and fixes the way ranges are satisfied and constrained on Spec objects.

This PR also:
- adds testing
- improves concretizer handling of target ranges

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2020-12-18 02:05:06 -08:00
psakievich
093a247b25
View location resolve environment variables (#20420) 2020-12-17 10:25:08 -08:00
Tamara Dahlgren
b7d9e269ef
docs: add single node concurrent build example (#20416) 2020-12-17 17:23:55 +01:00
Massimiliano Culpo
76f1548fe2
unit-tests: ensure that installed packages can be reused (#20307)
refers #20292

Added a unit test that ensures we can reuse installed
packages even if in the repository variants have been
removed or added.
2020-12-17 00:31:59 -08:00
Adam J. Stewart
826cd07cf7
PythonPackage: add import module smoke tests (#20023) 2020-12-16 15:15:03 -08:00
Greg Becker
3840c0ac45
docs: fix spack install debug arg order (#20428) 2020-12-16 13:57:08 -08:00
Adam J. Stewart
20752db103
Docs: add more Command Reference links to spack test (#20413) 2020-12-16 12:08:32 -08:00
Tamara Dahlgren
cb01981628
docs: fix spack command for unit-test pytest help (#20415) 2020-12-16 10:13:22 -08:00
Greg Becker
352dc0624c
Fix comparisons for abstract specs (#20341)
bug only relevant for python3
2020-12-15 14:44:58 -08:00
Todd Gamblin
b6089ac691
concretizer: don't use one_of_iff for range constraints (#20383)
Currently, version range constraints, compiler version range constraints,
and target range constraints are implemented by generating ground rules
from `asp.py`, via `one_of_iff()`.  The rules look like this:

```
version_satisfies("python", "2.6:") :- 1 { version("python", "2.4"); ... } 1.
1 { version("python", "2.4"); ... } 1. :- version_satisfies("python", "2.6:").
```

So, `version_satisfies(Package, Constraint)` is true if and only if the
package is assigned a version that satisfies the constraint. We
precompute the set of known versions that satisfy the constraint, and
generate the rule in `SpackSolverSetup`.

We shouldn't need to generate already-ground rules for this. Rather, we
should leave it to the grounder to do the grounding, and generate facts
so that the constraint semantics can be defined in `concretize.lp`.

We can replace rules like the ones above with facts like this:

```
version_satisfies("python", "2.6:", "2.4")
```

And ground them in `concretize.lp` with rules like this:

```
1 { version(Package, Version) : version_satisfies(Package, Constraint, Version) } 1
  :- version_satisfies(Package, Constraint).
version_satisfies(Package, Constraint)
  :- version(Package, Version), version_satisfies(Package, Constraint, Version).
```

The top rule is the same as before. It makes conditional dependencies and
other places where version constraints are used work properly. Note that
we do not need the cardinality constraint for the second rule -- we
already have rules saying there can be only one version assigned to a
package, so we can just infer from `version/2` `version_satisfies/3`.
This form is also safe for grounding -- If we used the original form we'd
have unsafe variables like `Constraint` and `Package` -- the original
form only really worked when specified as ground to begin with.

- [x] use facts instead of generating rules for package version constraints
- [x] use facts instead of generating rules for compiler version constraints
- [x] use facts instead of generating rules for target range constraints
- [x] remove `one_of_iff()` and `iff()` as they're no longer needed
2020-12-15 11:58:58 -08:00
Tamara Dahlgren
21f30e3074
Bugfix/docs: correct and expand smoke test documentation (#20278) 2020-12-15 08:38:00 -08:00
Tamara Dahlgren
d67ca265a3
outputs: restore default output of fetch/build/total times (#20394) 2020-12-15 01:46:30 -08:00
Massimiliano Culpo
e7f4c2b49e
package sanity: ensure all variant defaults are allowed values (#20373) 2020-12-15 10:22:15 +01:00
Todd Gamblin
495e8cfb8e
concretizer: remove clingo command-line driver (#20362)
I was keeping the old `clingo` driver code around in case we had to run
using the command line tool instad of through the Python interface.

So far, the command line is faster than running through Python, but I'm
working on fixing that.  I found that if I do this:

```python
control = clingo.Control()
control.load("concretize.lp")
control.load("hdf5.lp")       # code from spack solve --show asp hdf5
control.load("display.lp")

control.ground([("base", [])])
control.solve(...)
```

It's just as fast as the command line tool. So we can always generate the
code and load it manually if we need to -- we don't need two drivers for
clingo. Given that the python interface is also the only way to get unsat
cores, I think we pretty much have to use it.

So, I'm removing the old command line driver and other unused code. We
can dig it up again from the history if it is needed.
2020-12-14 09:35:53 +01:00
Ben Cowan
cf37e9276d
Debugging support: fix compiler wrapper log on Mac OS (#20333)
This fixes a logging error observed on macOS 11.0.1 (Big Sur).
When performing a Spack install in debugging mode (e.g.
`spack -d install py-scipy`) Spack is supposed to write a log of
compiler wrapper command line invocations to the current working
directory.

Due to a regression error introduced by #18205, these files were
no-longer generated, and Spack was printing errors such as
"No such file or directory: None/." This is because the log file
directory gets set from `spack.main.spack_working_dir`, but that
variable is not set in the spawned process.

This PR ensures that the working directory (at the time of the
"spack install" invocation) is persisted to the subprocess.
2020-12-11 15:54:11 -08:00
Tamara Dahlgren
59628cd9e8
Tests: enable re-use of post-install tests in smoke tests (#20298) 2020-12-10 10:35:27 -08:00
Adam J. Stewart
3f5f80956e
Command Reference: add link to spack test docs (#20054) 2020-12-08 09:26:03 -08:00
Andrew W Elble
a90026fb89
concretizer: try hard to obtain all needed variant_possible_value()'s (#20102)
Track all the variant values mentioned when emitting constraints, validate them
and emit a fact that allows them as possible values.

This modification ensures that open-ended variants (variants accepting any string 
or any integer) are projected to the finite set of values that are relevant for this 
concretization.
2020-12-08 15:46:52 +01:00
Harmen Stoppels
50f8332d95
Compiler wrapper linting (#20249)
* Fix duplicate entries in case
* make sure the arg is not interpreted as two items in a list
* use -n over ! -z
2020-12-07 18:58:19 -08:00
Massimiliano Culpo
98c2627132 bugfix: work around issue handling packages not in any repo 2020-12-07 17:18:33 -08:00
Todd Gamblin
1343a815c0 concretizer: refactor handling of special variants dev_build and patches
Other parts of the concretizer code build up lists of things we can't
know without traversing all specs and packages, and they output these
list at the very end.

The code for this for variant values from spec literals was intertwined
with the code for traversing the input specs. This only covers the input
specs and misses variant values that might come from directives in
packages.

- [x] move ad-hoc value handling code into spec_clauses so we do it in
  one place for CLI and packages

- [x] move handling of `variant_possible_value`, etc. into
  `concretize.lp`, where we can automatically infer variant existence
  more concisely.

- [x] simplify/clarify some of the code for variants in `spec_clauses()`
2020-12-07 17:18:33 -08:00
vvolkl
ed258ca9e9
Add "spack versions --new" flag to only show new versions (#20030)
* [cmd versions] add spack versions --new flag to only fetch new versions

format

[cmd versions] rename --latest to --newest and add --remote-only

[cmd versions] add tests for --remote-only and --new

format

[cmd versions] update shell tab completion

[cmd versions] remove test for --remote-only --new which gives empty output

[cmd versions] final rename

format

* add brillig mock package

* add test for spack versions --new

* [brillig] format

* [versions] increase test coverage

* Update lib/spack/spack/cmd/versions.py

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>

* Update lib/spack/spack/cmd/versions.py

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2020-12-07 09:29:10 -06:00
Massimiliano Culpo
3843f43e69
concretizer: each external version is allowed by definition (#20247)
Registering external versions among the lists of allowed ones
generates the correct rules for `version_satisfies`
2020-12-06 10:29:05 +01:00
Harmen Stoppels
984ae7e695
Also allow --rpath as rpath linker flags (#18473) 2020-12-04 12:29:55 -05:00
Massimiliano Culpo
8b74b50cff
concretizer: restrict maximizing variant values to MV variants (#20194) 2020-12-04 16:27:03 +01:00
eugeneswalker
badf3368ad
allow install of build-deps from cache via --include-build-deps switch (#19955)
* allow install of build-deps from cache via --include-build-deps switch

* make clear that --include-build-deps is useful for CI pipeline troubleshooting
2020-12-03 15:27:01 -08:00
Matthias Wolf
794b60f7e7
environment installs: fix reporting. (#20004)
PR #15702 changed the invocation of the report context when installing
specs, do the same when building environments.
2020-12-03 15:04:13 -08:00
Greg Becker
d6765fe95d
avoid circular import (#20236) 2020-12-03 13:54:09 -08:00
Andrew W Elble
09aae616c7
concretizer: call inject_patches_variants() on the roots of the specs (#20203)
As was done in the old concretizer. Fixes an issue where conditionally
patched dependencies did not show up in spec (gdal+jasper)
2020-12-03 16:28:34 +01:00
Danny Taller
e22e037e30
Add CARE package, fixes for ROCmPackage and subclasses (#20070)
* use develop version of blt with fixes for rocm

* package updates for care+rocm

* fixes for plain cpu build

* add camp dependency on raja
2020-12-02 17:07:56 -08:00
Massimiliano Culpo
05848c87c5
concretizer: try hard to infer the real version of compilers (#20099)
fixes #20055

Compiler with custom versions like gcc@foo are not currently
matched to the appropriate targets. This is because the
version of spec doesn't match the "real" version of the
compiler.

This PR replicates the strategy used in the original
concretizer to deal with that and tries to detect the real
version of compilers if the version in the spec returns no
results.
2020-12-02 20:30:28 +01:00
Harmen Stoppels
b0baf42988
Fix hipcc once more (#20095) 2020-12-02 15:58:58 +01:00
Andrew W Elble
0c326e87a9
concretizer: don't optimize emitting version_satisfies() (#20128)
When all versions were allowed a version_satisfies rule was not emitted,
and this caused conditional directives to fail.
2020-12-02 09:53:53 +01:00
Massimiliano Culpo
7c01ba8fea
spec: return early from concretization if a spec is already concrete (#20196) 2020-12-01 18:09:14 +01:00
AMD Toolchain Support
ec1eddb6e7
AOCC-2.3.0 is now added to spack (#20089)
* AOCC-2.3.0 is now added to spack

Change-Id: I18fd9606e6fd9a288cc7dc6c6ead11ea17839a7c

* Added flag and version tests for AOCC-2.3.0

* Addressed review comments

Co-authored-by: vkallesh <Vijay-teekinavar.Kallesh@amd.com>
2020-12-01 08:07:58 -06:00
Massimiliano Culpo
e2033566bf
concretizer: remove ad-hoc rule for external packages (#20193)
fixes #20040

Matching compilers among nodes has been prioritized
in #20020. Selection of default variants has been
tuned in #20182. With this setup there is no need
to have an ad-hoc rule for external packages. On
the contrary it should be removed to prefer having
default variant values over more external nodes in
the DAG.
2020-12-01 10:11:40 +01:00
Massimiliano Culpo
7fd777c3d9
concretizer: swap priority of selecting provider and default variant (#20182)
refers #20040

Before this PR optimization rules would have selected default
providers at a higher priority than default variants. Here we
swap this priority and we consider variants that are forced by
any means (root spec or spec in depends_on clause) the same as
if they were with a default value.

This prevents the solver from avoiding expected configurations
just because they contain directives like:

depends_on('pkg+foo')

and `+foo` is not the default variant value for pkg.
2020-12-01 07:45:48 +01:00
George Hartzell
bb9f5d613c
Typos: add missing closing parens (#20174) 2020-11-30 10:28:07 -06:00
Adam J. Stewart
868dbb24c1
libQGLViewer: add new package (#20164) 2020-11-30 10:25:40 -05:00
Massimiliano Culpo
8dd3797d32
concretizer: treat target ranges in directives correctly (#19988)
fixes #19981

This commit adds support for target ranges in directives,
for instance:

conflicts('+foo', when='target=x86_64:,aarch64:')

If any target in a spec body is not a known target the
following clause will be emitted:

node_target_satisfies(Package, TargetConstraint)

when traversing the spec and a definition of
the clause will then be printed at the end similarly
to what is done for package and compiler versions.
2020-11-27 20:53:39 +01:00
Massimiliano Culpo
44665cb4e6
archspec: added support for aocc (#20124) 2020-11-26 16:18:40 +01:00
Massimiliano Culpo
03ff89fee6
concretizer: prioritize matching compilers over newer versions (#20020)
fixes #20019

Before this modification having a newer version of a node came
at higher priority in the optimization than having matching
compilers. This could result in unexpected configurations for
packages with conflict directives on compilers of the type:

conflicts('%gcc@X.Y:', when='@:A.B')

where changing the compiler for just that node is preferred to
lower the node version to less than 'A.B'. Now the priority has
been switched so the solver will try to lower the version of the
nodes in question before changing their compiler.
2020-11-26 13:10:48 +01:00