summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-08-08 21:36:44 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2021-11-05 00:15:47 -0700
commit9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87 (patch)
tree44a3f656ff6e68138425c81fd0a42aa6ed15dcb3 /lib
parent40b914503e2441c0f51de737e3901f8f546ccbce (diff)
downloadspack-9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87.tar.gz
spack-9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87.tar.bz2
spack-9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87.tar.xz
spack-9eb94be6dd3d790ff9c4238f6a328f0e03bb8f87.zip
concretizer: only minimize builds when `--reuse` is enabled.
Make the first minimization conditional on whether `--reuse` is enabled in the solve. If `--reuse` is not enabled, there will be nothing in the set to minimize and the objective function (for this criterion) will be 0 for every answer set.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/asp.py2
-rw-r--r--lib/spack/spack/solver/concretize.lp3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 88c2897e20..5fed553080 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1570,6 +1570,8 @@ class SpackSolverSetup(object):
if reuse:
self.gen.h1("Installed packages")
+ self.gen.fact(fn.optimize_for_reuse())
+ self.gen.newline()
self.define_installed_packages(possible)
self.gen.h1('General Constraints')
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index efd364dd92..00c4100a58 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -794,7 +794,8 @@ build(Package) :- not hash(Package, _), node(Package).
% Try hard to reuse installed packages (i.e., minimize the number built)
opt_criterion(16, "number of packages to build (vs. reuse)").
#minimize { 0@16: #true }.
-#minimize { 1@16,Package : build(Package) }.
+#minimize { 1@16,Package : build(Package), optimize_for_reuse() }.
+#defined optimize_for_reuse/0.
% Minimize the number of deprecated versions being used
opt_criterion(15, "deprecated versions used").