summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-08-10 23:15:45 +0200
committerGitHub <noreply@github.com>2021-08-10 14:15:45 -0700
commit371bc37dd4536009787fa4370b5fd7539e6e0478 (patch)
treef157ac69177ce5b69226d48305448caa0abd75b2 /var
parent3fafbafab09967d55301b2f8c1879c5ee3b86d2f (diff)
downloadspack-371bc37dd4536009787fa4370b5fd7539e6e0478.tar.gz
spack-371bc37dd4536009787fa4370b5fd7539e6e0478.tar.bz2
spack-371bc37dd4536009787fa4370b5fd7539e6e0478.tar.xz
spack-371bc37dd4536009787fa4370b5fd7539e6e0478.zip
Rework rules for provider weights (#25331)
Preferred providers had a non-zero weight because in an earlier formulation of the logic program that was needed to prefer external providers over default providers. With the current formulation for externals this is not needed anymore, so we can give a weight of zero to both default choices and providers that are externals. _Using zero ensures that we don't introduce any drift towards having less providers, which was happening when minimizing positive weights_. Modifications: - [x] Default weight for providers starts at 0 (instead of 10, needed before to prefer externals) - [x] Rules to compute the `provider_weight` have been refactored. There are multiple possible weights for a given `Virtual`. Only one gets selected by the solver (the one that minimizes the objective function). - [x] `provider_weight` are now accounting for each different `Virtual`. Before there was a single weight per provider, even if the package was providing multiple virtuals. * Give preferred providers a weight of zero Preferred providers had a non-zero weight because in an earlier formulation of the logic program that was needed to prefer external providers over default providers. With the current formulation for externals this is not needed anymore, so we can give a weight of zero to default choices. Using zero ensures that we don't introduce any drift towards having less providers, which was happening when minimizing positive weights. * Simplify how we compute weights for providers Rewrite rules so that specific events (i.e. being an external) unlock the possibility to use certain weights. The weight being considered is then selected by the minimization process to be the one that gives the best score. * Allow providers to have different weights for different virtuals Before this change we didn't differentiate providers based on the virtual they provide, which meant that packages providing more than one virtual had nonetheless a single weight. With this change there will be a weight per virtual.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin.mock/packages/leaf-adds-virtual/package.py9
-rw-r--r--var/spack/repos/builtin.mock/packages/middle-adds-virtual/package.py7
-rw-r--r--var/spack/repos/builtin.mock/packages/root-adds-virtual/package.py8
3 files changed, 24 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/leaf-adds-virtual/package.py b/var/spack/repos/builtin.mock/packages/leaf-adds-virtual/package.py
new file mode 100644
index 0000000000..be4cc17711
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/leaf-adds-virtual/package.py
@@ -0,0 +1,9 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+class LeafAddsVirtual(Package):
+ version('2.0', sha256='abcde')
+ version('1.0', sha256='abcde')
+
+ depends_on('blas', when='@2.0')
diff --git a/var/spack/repos/builtin.mock/packages/middle-adds-virtual/package.py b/var/spack/repos/builtin.mock/packages/middle-adds-virtual/package.py
new file mode 100644
index 0000000000..884d8737c0
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/middle-adds-virtual/package.py
@@ -0,0 +1,7 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+class MiddleAddsVirtual(Package):
+ version('1.0', sha256='abcde')
+ depends_on('leaf-adds-virtual')
diff --git a/var/spack/repos/builtin.mock/packages/root-adds-virtual/package.py b/var/spack/repos/builtin.mock/packages/root-adds-virtual/package.py
new file mode 100644
index 0000000000..167a81ca67
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/root-adds-virtual/package.py
@@ -0,0 +1,8 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+class RootAddsVirtual(Package):
+ version('1.0', sha256='abcde')
+
+ depends_on('middle-adds-virtual')