Conversation
|
On this system:
using this PR I obtain: % spack solve --timers -l hdf5
Time:
setup: 2.2555
facts [fast]: 0.2137
load [fast]: 0.0030
ground [fast]: 0.3860
solve [fast]: 0.4136
Total: 3.3483
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 30, -2, 1, 0, 0, -14, 0]
hkqq3qs [email protected]%[email protected]~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=darwin-bigsur-cannonlake
x7uoimm ^[email protected]%[email protected]~atomics~cuda~cxx~cxx_exceptions+gpfs~java~legacylaunchers~lustre~memchecker~pmi~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none schedulers=none arch=darwin-bigsur-cannonlake
rg2lvuz ^[email protected]%[email protected]~cairo~cuda~gl~libudev+libxml2~netloc~nvml~pci+shared arch=darwin-bigsur-cannonlake
cn6al67 ^[email protected]%[email protected]~python arch=darwin-bigsur-cannonlake
sqfxpje ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
myhb4f4 ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
klk4s54 ^[email protected]%[email protected]~pic arch=darwin-bigsur-cannonlake
xj67msn ^[email protected]%[email protected]+optimize+pic+shared arch=darwin-bigsur-cannonlake
oaha5wg ^[email protected]%[email protected]+openssl arch=darwin-bigsur-cannonlake
dkwz5wf ^[email protected]%[email protected]+systemcerts arch=darwin-bigsur-cannonlake
dhggqbx ^[email protected]%[email protected]+cpanm+shared+threads patches=517afe8ca1cb12f798f20b21583d91463fe3f4fa9244c6c8e054a92c8135da8f arch=darwin-bigsur-cannonlake
fyidgzf ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
czqittu ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
yemqcvc ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
6aulg5u ^[email protected]%[email protected]~symlinks+termlib arch=darwin-bigsur-cannonlakewhile using % spack solve --timers -l hdf5
Time:
setup: 2.6316
load: 0.0032
ground: 0.9854
solve: 2.6441
Total: 6.3340
==> Best of 0 answers.
==> Optimization: [0, 0, 0, 0, 30, -2, 1, 0, 0, -14, 0]
hkqq3qs [email protected]%[email protected]~cxx~debug~fortran~hl~java+mpi+pic+shared~szip~threadsafe api=none arch=darwin-bigsur-cannonlake
x7uoimm ^[email protected]%[email protected]~atomics~cuda~cxx~cxx_exceptions+gpfs~java~legacylaunchers~lustre~memchecker~pmi~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none schedulers=none arch=darwin-bigsur-cannonlake
rg2lvuz ^[email protected]%[email protected]~cairo~cuda~gl~libudev+libxml2~netloc~nvml~pci+shared arch=darwin-bigsur-cannonlake
cn6al67 ^[email protected]%[email protected]~python arch=darwin-bigsur-cannonlake
sqfxpje ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
myhb4f4 ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
klk4s54 ^[email protected]%[email protected]~pic arch=darwin-bigsur-cannonlake
xj67msn ^[email protected]%[email protected]+optimize+pic+shared arch=darwin-bigsur-cannonlake
oaha5wg ^[email protected]%[email protected]+openssl arch=darwin-bigsur-cannonlake
dkwz5wf ^[email protected]%[email protected]+systemcerts arch=darwin-bigsur-cannonlake
dhggqbx ^[email protected]%[email protected]+cpanm+shared+threads patches=517afe8ca1cb12f798f20b21583d91463fe3f4fa9244c6c8e054a92c8135da8f arch=darwin-bigsur-cannonlake
fyidgzf ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
czqittu ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
yemqcvc ^[email protected]%[email protected] arch=darwin-bigsur-cannonlake
6aulg5u ^[email protected]%[email protected]~symlinks+termlib arch=darwin-bigsur-cannonlake |
|
This is exciting! The only reasons I'm not using the new concretizer at the moment are because a) it's slower than the old concretizer, and b) it still doesn't take into account already-installed packages. Once I have a good reason to use the new concretizer, I can start submitting bug reports for it 😄 |
27f7cd1 to
69eaf36
Compare
|
I like this idea, a lot. Out of curiosity, why as a post-pass rather than checking before creating the fact objects? It probably doesn't matter much, since the solve is so much of the cost, but it made me wonder. |
That's because I want to have the full set of facts in case the fast solve is unsat. Filtering is done on heuristics that will work most of the time, but we are effectively reducing the search space and thus solving a different problem. If that problem is unsat the current implementation falls back to use the full set of facts and solve the original problem. |
|
Another interesting takeaway from the experiments I have done here is that, after this change, the most part of the time is spent setting up the problem. I think we have a lot of space for improvements there, so I am quite confident we can beat the original concretizer in terms of speed as soon as we do a better job of retrieving package metadata to setup the ASP solve. |
69eaf36 to
986a80a
Compare
986a80a to
a957f48
Compare
@alalazo can you clarify this? Is it just the preferred targets/compilers/providers, or the ones that would be optimal if there were no other constraints (or are those always the same thing -- they might be). I'm asking b/c this is concerning:
If all the criteria we limited things to in (1) are optimal with no conflicting constraints, isn't it provable that the result of (2) should be the same as (1)? |
a957f48 to
8dff55a
Compare
In general I try to throw into the solve the ones that would be optimal if there are no other constraints, but I use heuristics not some provably optimal set of reduced facts. Take this as an example: spack/lib/spack/spack/solver/asp.py Lines 881 to 884 in 8dff55a In the code above I scan I think with some effort I can craft examples where a set of weird conflicts may cause the fast solution to be different from the solution one would obtain allowing for all the targets in the solve, but this case should be extremely rare in practice. For what is worth using this PR in the current state it never happened to me to have a fast solution that was different from the full solve, but it may happen. It would be a valid but sub-optimal solution. There are two ways that comes to my mind to deal with this:
The first approach would sacrifice some "correctness" for performance (I put it into quotes since the optimization rules and the weights are partially arbitrary) the second one should guarantee that the two solutions are equal, but wouldn't kick-in in cases where 1 would do. |
8dff55a to
26c6a59
Compare
26c6a59 to
90a2e21
Compare
d5a61ef to
3cddb45
Compare
3cddb45 to
70cca8c
Compare
70cca8c to
13c8069
Compare
13c8069 to
513f51a
Compare
All the facts are recorded by an ad-hoc object. During a first solve we discard information from targets that are unlikely to be chosen. If the problem is unsat, we revert back to using all the facts at our disposal.
Similarly to what was done for targets in the previous commit, to speed-up the concretization process here we try to use only the default compiler in a first solve.
Finally try to reduce the number of providers considered during the first solve. This requires to introduce some heuristics to deal with edge cases, mainly with the ones involving soft preferences (a soft preference that is not met due to the search space reduction will produce a sub-optimal solution, instead of being unsat).
…sages This would happen in specs that don't have any possible virtual in the DAG.
513f51a to
ce3c85a
Compare
|
Outdated by changes to the concretizer and other optimizations in #38447 |
depends on #21148 (it incorporates the same small change)
This PR speeds-up the ASP based solver most of the times by:
I'll post data on the speed-up in the comments below, but most of the time it's roughly a 30%-50% cut of the wall-time compared to
develop.Being based on an heuristic reduction of the search space, I found during development that sometimes 1. may yield different results than 2. when soft-preferences are involved. One thing we should decide during review is therefore if we want this strategy to be: