summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2020-11-17concretizer: don't require a provider for virtual deps if spec is externalMassimiliano Culpo4-3/+17
This commit introduces a new rule: real_node(Package) :- not external(Package), node(Package). that permits to distinguish between an external node and a real node that shouldn't trim dependency. It solves the case of concretizing ninja with an external Python.
2020-11-17concretizer: spec_clauses() shouldn't emit node_compiler_hard for rule bodies.Todd Gamblin1-2/+0
`node_compiler_hard()` means that something explicitly asked for a node's compiler to be set -- i.e., it's not inherited, it's required. We're generating this in spec_clauses even for specs in rule bodies, which results in conditions like this for optional dependencies: In py-torch/package.py: depends_on('llvm-openmp', when='%apple-clang +openmp') In the generated ASP: declared_dependency("py-torch","llvm-openmp","build") :- node("py-torch"), variant_value("py-torch","openmp","True"), node_compiler("py-torch","apple-clang"), node_compiler_hard("py-torch","apple-clang"), node_compiler_version_satisfies("py-torch","apple-clang",":"). The `node_compiler_hard` there means we would have to *explicitly* set py-torch's compiler to trigger the llvm-openmp dependency, rather than just letting it be set by preferences. This is wrong; the dependency should be there regardless of how the compiler was set. - [x] remove fn.node_compiler_hard() call from spec_clauses when generating rule body clauses.
2020-11-17concretizer: don't generate rules for empty version listsTodd Gamblin1-0/+4
If the version list passed to one_of_iff is empty, it still generates a rule like this: node_compiler_version_satisfies("fujitsu-mpi", "arm", ":") :- 1 { } 1. 1 { } 1 :- node_compiler_version_satisfies("fujitsu-mpi", "arm", ":"). The cardinality rules on the right and left above are never satisfiale, and these rules do nothing. - [x] Skip generating any rules at all for empty version lists.
2020-11-17concretizer: add a rule to avoid cycles in the graph of dependenciesMassimiliano Culpo2-5/+9
2020-11-17External packages have a consistent hash across different concretizersMassimiliano Culpo2-1/+12
2020-11-17Don't fail if MV variants have a tuple as default valueMassimiliano Culpo1-1/+2
2020-11-17Fixup for target preferencesMassimiliano Culpo2-3/+11
2020-11-17Added unit tests to for regressions on open concretizer bugsMassimiliano Culpo2-6/+162
2020-11-17Changed clingo optionsMassimiliano Culpo1-1/+4
2020-11-17Reworked optimization rulesMassimiliano Culpo1-15/+49
2020-11-17concretizer: set target preference for inheritance from rootMassimiliano Culpo1-0/+7
2020-11-17install: one less concretization when installing from fileMassimiliano Culpo1-2/+3
2020-11-17Fixed branch after rebase (port to archspec)Massimiliano Culpo2-13/+14
TODO: Investigate the need to remove memoization on Spec.patches (infinite recursion when testing `__contains__`)
2020-11-17Add unit tests for dependencies being patched by parentMassimiliano Culpo1-0/+17
2020-11-17concretizer: handle dependencies conditional on other dependenciesMassimiliano Culpo1-5/+10
2020-11-17tests: verify to handle dependencies conditional on other dependenciesMassimiliano Culpo1-0/+18
2020-11-17concretizer: handle conflicts with compiler ranges correctlyMassimiliano Culpo3-20/+54
As reported, conflicts with compiler ranges were not treated correctly. This commit adds tests to verify the expected behavior for the new concretizer. The new rules to enforce a correct behavior involve: - Adding a rule to prefer the compiler selected for the root package, if no other preference is set - Give a strong negative weight to compiler preferences expressed in packages.yaml - Maximize on compiler AND compiler version match
2020-11-17Github actions: add CI for ASP based solverMassimiliano Culpo3-0/+16
2020-11-17Make all tests passMassimiliano Culpo8-28/+41
Fixed a couple of tests and marked a few xfails to solve them later.
2020-11-17concretizer: added handling for dev_path variantMassimiliano Culpo3-10/+77
This variant is currently either set from command line, in which case it enters the concretization, or attached from environment after concretization.
2020-11-17concretizer: ensure upfront that variants are validMassimiliano Culpo3-12/+31
2020-11-17concretizer: account for test dependencies only when requiredMassimiliano Culpo3-39/+38
2020-11-17Fix installer.py unit tests that check outputMassimiliano Culpo1-1/+2
2020-11-17Compute the correct package name for hierarchies that change class namesMassimiliano Culpo1-1/+5
2020-11-17concretizer: handle variants defined through validatorsMassimiliano Culpo2-2/+23
Variant of this kind don't have a list of possible values encoded in the ASP facts. Since all we have is a validator the list of possible values just includes just the default value and possibly the value passed from packages.yaml or cli.
2020-11-17concretizer: account for patches variantMassimiliano Culpo2-44/+55
This is done after the builder has actually built the specs, to respect the semantics use with the old concretizer. Later we could move this to the solver as a multivalued variant.
2020-11-17concretizer: ensure that no deprecated spec is being usedMassimiliano Culpo2-16/+30
This is done after the builder has actually built the specs, to respect the semantics use with the old concretizer. A better approach is to substitute the spec directly in concretization.
2020-11-17conftest: hook the new solver in the config fixtureMassimiliano Culpo6-10/+12
2020-11-17concretizer: handle "none" value and '*' wildcardMassimiliano Culpo2-2/+9
The "none" variant value cannot be combined with other values. The '*' wildcard matches anything, including "none". It's thus relevant in queries, but disregarded in concretization.
2020-11-17Fixed failing unit testsMassimiliano Culpo6-20/+27
- The test on concretization of anonymous dependencies has been fixed by raising the expected exception. - The test on compiler bootstrap has been fixed by updating the version of GCC used in the test. Since gcc@2.0 does not support targets later than x86_64, the new concretizer was looking for a non-existing spec, i.e. it was correctly trying to retrieve 'gcc target=x86_64' instead of 'gcc target=core2'. - The test on gitlab CI needed an update of the target
2020-11-17concretizer: virtual entry in packages.yaml, external modulesMassimiliano Culpo2-11/+54
This commit adds support for specifying rules in packages.yaml that refer to virtual packages. The approach is to normalize in memory each configuration and turn it into an equivalent configuration without rules on virtual. This is possible if the set of packages to be handled is considered fixed.
2020-11-17concretizer: concretize a virtual rootMassimiliano Culpo4-5/+41
Before this modification the root of a DAG has to be a real package. This commit adds rules to concretize virtual roots.
2020-11-17concretizer: handle version preferences from packages.yamlMassimiliano Culpo2-2/+22
2020-11-17concretizer: handle target preferences from packages.yamlMassimiliano Culpo2-9/+45
The weight of the target used in concretization is, in order: 1. A specific per package weight, if set in packages.yaml 2. Inherited from the parent, if possible 3. The default target weight (always set)
2020-11-17concretizer: fixed test on compiler preferencesMassimiliano Culpo3-3/+3
2020-11-17concretizer: added logic for preferred variantsMassimiliano Culpo3-20/+58
If preferred variants are present, they'll set the default value of a variant. Otherwise the default value is what is encoded in package.py
2020-11-17concretizer: refine compiler logicMassimiliano Culpo4-17/+42
Concrete versions for compilers are respected verbatim. Permit to use a non-existing compiler if the appropriate configuration option has been set.
2020-11-17Fixed failing unit testsMassimiliano Culpo2-10/+11
- Tests based on TestArchitecture - Tests on non-buildable external
2020-11-17concretizer: prefer using the same compiler over using newer versionsMassimiliano Culpo1-5/+5
2020-11-17concretizer: added support for versioned virtual specsMassimiliano Culpo2-29/+96
2020-11-17concretizer: added rules and code for externalsMassimiliano Culpo4-28/+178
Generate facts on externals by inspecting packages.yaml. Added rules in concretize.lp Added extra logic so that external specs disregard any conflict encoded in the package. In ASP this would be a simple addition to an integrity constraint: :- c1, c2, c3, not external(pkg) Using the the Backend API from Python it requires some scaffolding to obtain a default negated statement.
2020-11-17package_sanity: fixed wrong string formatMassimiliano Culpo1-1/+1
2020-11-17concretizer: add conflict rules from packagesMassimiliano Culpo3-28/+72
Conflict rules from packages are added as integrity constraints in the ASP formulation. Most of the code to generate them has been reused from PyclingoDriver.rules
2020-11-17test_noversion_pkg: generalized the error to be caughtMassimiliano Culpo1-2/+2
The new concretizer and the old concretizer solve constraints in a different way. Here we ensure that a SpackError is raised, instead of a specific error that made sense in the old concretizer but probably not in the new.
2020-11-17compiler constraints: deduplicate the list of compilers before encoding ↵Massimiliano Culpo1-0/+1
one_of_iff rules This fixes 8 bugs in test/concretize.py
2020-11-17concretizer: add compiler version constraintsTodd Gamblin6-61/+59
Add rules to account for compiler version constraints in concretize.lp.
2020-11-17concretizer: use cardinality constraints for versionsTodd Gamblin4-42/+60
Instead of python callbacks, use cardinality constraints for package versions. This is slightly faster and has the advantage that it can be written to an ASP program to be executed *outside* of Spack. We can use this in the future to unify the pyclingo driver and the clingo text driver. This makes use of add_weight_rule() to implement cardinality constraints. add_weight_rule() only has a lower bound parameter, but you can implement a strict "exactly one of" constraint using it. In particular, wee want to define: 1 {v1; v2; v3; ...} 1 :- version_satisfies(pkg, constraint). version_satisfies(pkg, constraint) :- 1 {v1; v2; v3; ...} 1. And we do that like this, for every version constraint: atleast1(pkg, constr) :- 1 {version(pkg, v1); version(pkg, v2); ...}. morethan1(pkg, constr) :- 2 {version(pkg, v1); version(pkg, v2); ...}. version_satisfies(pkg, constr) :- atleast1, not morethan1(pkg, constr). :- version_satisfies(pkg, constr), morethan1. :- version_satisfies(pkg, constr), not atleast1. v1, v2, v3, etc. are computed on the Python side by comparing every possible package version with the constraint. Computing things like this has the added advantage that if v1, v2, v3, etc. comprise *all* possible versions of a package, we can just omit the rules for the constraint under consideration. This happens pretty frequently in the Spack mainline.
2020-11-17concretizer: first working version with pyclingo interfaceTodd Gamblin4-63/+300
- [x] Solver now uses the Python interface to clingo - [x] can extract unsatisfiable cores from problems when things go wrong - [x] use Python callbacks for versions instead of choice rules (this may ultimately hurt performance)
2020-11-17concretizer: add a configuration option to use new or old concretizerTodd Gamblin3-1/+35
- [x] spec.py can call out to the new concretizer - [x] config.yaml now has an option to choose a concretizer (original, clingo)
2020-11-17concretizer: use repository names, not specs with is_virtualTodd Gamblin2-1/+4