Git Product home page Git Product logo

Comments (8)

jcortial-safran avatar jcortial-safran commented on September 21, 2024 1

Bisected to 89fc9a9, which just adds new versions and deps, not immediately useful.

That was indeed the trigger in this case, cause it caused the old version of vtk and the old version of lcov to have both a penalty of 2.

@jcortial-safran Thank you very much for the reproducer, that was super helpful. Can you confirm that this:

diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 60165338c6..4d8a202ce3 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -1432,11 +1432,11 @@ opt_criterion(73, "deprecated versions used").
 % 1. Version weight
 % 2. Number of variants with a non default value, if not set
 % for the root package.
-opt_criterion(70, "version weight").
+opt_criterion(70, "version badness (roots)").
 #minimize{ 0@270: #true }.
 #minimize{ 0@70: #true }.
 #minimize {
-    Weight@70+Priority
+    Weight@70+Priority,PackageNode
     : attr("root", PackageNode),
       version_weight(PackageNode, Weight),
       build_priority(PackageNode, Priority)
@@ -1526,13 +1526,14 @@ opt_criterion(30, "non-preferred OS's").
 }.
 
 % Choose more recent versions for nodes
-opt_criterion(25, "version badness").
+opt_criterion(25, "version badness (non roots)").
 #minimize{ 0@225: #true }.
 #minimize{ 0@25: #true }.
 #minimize{
     Weight@25+Priority,node(X, Package)
     : version_weight(node(X, Package), Weight),
       build_priority(node(X, Package), Priority),
+      not attr("root", node(X, Package)),
       not runtime(Package)
 }.

solves the issue for you?

Thanks for your help !

Yes it solves the issue in the example. It also improves greatmy the concretized specs in my real case. However it seems that some suboptimal specs (not in the roots, but in a dependent package, namely py-cython) remain even after your changes, I will try to exhibit a minimal example before I submit a new issue.

from spack.

haampie avatar haampie commented on September 21, 2024

Bisected to 89fc9a9, which just adds new versions and deps, not immediately useful.

edit: just removing version 2.0 from lcov is sufficient to have it pick up 1.16 on @1.

from spack.

alalazo avatar alalazo commented on September 21, 2024

I can reproduce too. The optimization weights when @1.16 is forced say:

==> Best of 7 considered solutions.
==> Optimization Criteria:
  Priority  Criterion                                            Installed  ToBuild
  1         number of packages to build (vs. reuse)                      -        0
  2         number of nodes from the same package                        -        0
  3         requirement weight                                           0        0
  4         deprecated versions used                                     0        0
  5         version weight                                               0        3
  6         number of non-default variants (roots)                       0        0
  7         preferred providers for roots                                0        0
  8         default values of variants not being used (roots)            0        0
  9         number of non-default variants (non-roots)                   0        0
  10        preferred providers (non-roots)                              0        0
  11        compiler mismatches that are not from CLI                    0        0
  12        compiler mismatches that are not from CLI                    0        0
  13        non-preferred OS's                                           0        0
  14        version badness                                              0       15
  15        default values of variants not being used (non-roots)        0        6
  16        non-preferred compilers                                      0        0
  17        target mismatches                                            0        0
  18        non-preferred targets                                        0        0
  19        compiler mismatches (runtimes)                               0        0
  20        version badness (runtimes)                                   0        0
  21        non-preferred targets (runtimes)                             0        0
  22        edge wiring                                                 12        0

versus this output when @1 is given:

==> Best of 8 considered solutions.
==> Optimization Criteria:
  Priority  Criterion                                            Installed  ToBuild
  1         number of packages to build (vs. reuse)                      -        0
  2         number of nodes from the same package                        -        0
  3         requirement weight                                           0        0
  4         deprecated versions used                                     0        0
  5         version weight                                               0        2
  6         number of non-default variants (roots)                       0        0
  7         preferred providers for roots                                0        0
  8         default values of variants not being used (roots)            0        0
  9         number of non-default variants (non-roots)                   0        0
  10        preferred providers (non-roots)                              0        0
  11        compiler mismatches that are not from CLI                    0        0
  12        compiler mismatches that are not from CLI                    0        0
  13        non-preferred OS's                                           0        0
  14        version badness                                              0       16
  15        default values of variants not being used (non-roots)        0        6
  16        non-preferred compilers                                      0        0
  17        target mismatches                                            0        0
  18        non-preferred targets                                        0        0
  19        compiler mismatches (runtimes)                               0        0
  20        version badness (runtimes)                                   0        0
  21        non-preferred targets (runtimes)                             0        0
  22        edge wiring                                                 12        0

from spack.

alalazo avatar alalazo commented on September 21, 2024

Looking into it

from spack.

alalazo avatar alalazo commented on September 21, 2024

Wow, I found a trivial typo in the root optimisation weight that apparently has been there since ever. I'm submitting a bugfix, but this bug is kind of rare to hit, since there must be two sub-optimal versions used in the environment and they must have the same penalty score.

from spack.

alalazo avatar alalazo commented on September 21, 2024

Bisected to 89fc9a9, which just adds new versions and deps, not immediately useful.

That was indeed the trigger in this case, cause it caused the old version of vtk and the old version of lcov to have both a penalty of 2.

@jcortial-safran Thank you very much for the reproducer, that was super helpful. Can you confirm that this:

diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 60165338c6..4d8a202ce3 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -1432,11 +1432,11 @@ opt_criterion(73, "deprecated versions used").
 % 1. Version weight
 % 2. Number of variants with a non default value, if not set
 % for the root package.
-opt_criterion(70, "version weight").
+opt_criterion(70, "version badness (roots)").
 #minimize{ 0@270: #true }.
 #minimize{ 0@70: #true }.
 #minimize {
-    Weight@70+Priority
+    Weight@70+Priority,PackageNode
     : attr("root", PackageNode),
       version_weight(PackageNode, Weight),
       build_priority(PackageNode, Priority)
@@ -1526,13 +1526,14 @@ opt_criterion(30, "non-preferred OS's").
 }.
 
 % Choose more recent versions for nodes
-opt_criterion(25, "version badness").
+opt_criterion(25, "version badness (non roots)").
 #minimize{ 0@225: #true }.
 #minimize{ 0@25: #true }.
 #minimize{
     Weight@25+Priority,node(X, Package)
     : version_weight(node(X, Package), Weight),
       build_priority(node(X, Package), Priority),
+      not attr("root", node(X, Package)),
       not runtime(Package)
 }.

solves the issue for you?

from spack.

alalazo avatar alalazo commented on September 21, 2024

However it seems that some suboptimal specs (not in the roots, but in a dependent package, namely py-cython) remain even after your changes, I will try to exhibit a minimal example before I submit a new issue.

Note that cases like that might happen if giving a penalty to some nodes results in avoiding bigger penalties on other nodes.

from spack.

jcortial-safran avatar jcortial-safran commented on September 21, 2024

However it seems that some suboptimal specs (not in the roots, but in a dependent package, namely py-cython) remain even after your changes, I will try to exhibit a minimal example before I submit a new issue.

Note that cases like that might happen if giving a penalty to some nodes results in avoiding bigger penalties on other nodes.

Yes, I agree. I need to confirm that the solution is indeed suboptimal.

from spack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.