summaryrefslogtreecommitdiff
path: root/.coveragerc
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2020-06-10 20:45:16 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2020-11-17 10:04:13 -0800
commit115384afbd61f3fb82ba102431c3910ed2773f51 (patch)
tree2ea3d4bca9e95bcc34749821f675e262bf481d8f /.coveragerc
parent0ed019d4efd9445771d2c49a623706ecc6ea0819 (diff)
downloadspack-115384afbd61f3fb82ba102431c3910ed2773f51.tar.gz
spack-115384afbd61f3fb82ba102431c3910ed2773f51.tar.bz2
spack-115384afbd61f3fb82ba102431c3910ed2773f51.tar.xz
spack-115384afbd61f3fb82ba102431c3910ed2773f51.zip
concretizer: use cardinality constraints for versions
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.
Diffstat (limited to '.coveragerc')
0 files changed, 0 insertions, 0 deletions