solver: set preferences from input specs using %%#51383
solver: set preferences from input specs using %%#51383tgamblin merged 13 commits intospack:developfrom
%%#51383Conversation
46fa46c to
24d7a18
Compare
|
Summary from DMs:
Other thoughts: An issue remains when
Certain things related to compiler dependencies may work now as a happy coincidence: compilers are either externals or reused. That might not always be the case. |
5078ca3 to
7759b90
Compare
7759b90 to
4f599f9
Compare
876572a to
068fcd8
Compare
068fcd8 to
a14ec33
Compare
|
Still missing docs, but should be ready for review |
b96d868 to
a89bd41
Compare
|
Documentation here is minimal, and a small refactor has been extracted in #51474. If people agree I would keep it like it is in this PR, and have another dedicated PR to add more examples in the environment section to explain how the feature can be used in common scenarios. The use cases would be those in the tests added to |
|
Testing this locally. I'm hitting a strange error: I'm working on trying to debug, but figured I'd post early incase it triggers some thoughts on a root cause before I find it. Update 1:I wonder if this is due to how The expansion is probably not parsable since we are communicating config, not specs. Update 2:Even when I manually put the |
|
@psakievich I couldn't reproduce. I just copied the example I have in the description, and tried to concretize: |
a89bd41 to
bbcc790
Compare
Signed-off-by: Massimiliano Culpo <[email protected]>
This commit allows basic support for setting preferences from input using the %% syntax in specs. Signed-off-by: Massimiliano Culpo <[email protected]>
This commit extends the support to toolchains Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
This changeset computes the transitive "link" closure of the nodes where %% is applied. Having the node in the closure of a certain root is a condition to activate the requirement. Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Now, %% affects link + run dependencies instead of just link. The penalty taken by not fulfilling a %% preference is higher than that of a preference in packages.yaml. In this way we can propagate compilers to the link,run closure of a node, and set global preferences for other nodes. Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
Signed-off-by: Massimiliano Culpo <[email protected]>
bbcc790 to
f1d36af
Compare
|
@alalazo I am now able to reproduce, and good news, use with all of sierra. Concretization is notably slower:
I'll test again with the newer commits I see. Also noted that I can't apply compiler constraints or propagations to bundle packages: It's nice that toolchains seem to work, but they are quite a bit slower. UpdateTimings for |
|
Using propagation is slow, due to the closures we have to compute to only propagate on the link/run subdag. I guess the good news is that when we don't use propagation, times are the same as before 😆 .
Well, that's how things work and wasn't changed in this PR. To propagate compiler constraints you have to use toolchains, or conditional dependencies directly. Do you have a reproducer for the error in #51383 (comment) ? |
I figured as much, but it took me a couple of try's before I realized it.
I never did figure this one out. I recloned spack and started with your reproducer. I suspect I inadvertently switched to the wrong branch or something else user error related. |
|
First the good news. This doesn't affect the concretization time, on our usual benchmark, when the option is not used. Tested against:
radiuss.pr.csv
Now the bad news. I started seeing fluctuations with very long solve times on some scrambled output of |
This PR allows using `%%` to set propagated preferences on input
specs, and is particularly useful when dealing with `unify: false`
environments.
An example of an environment that can be concretized with this PR is:
```yaml
spack:
definitions:
- compilers: ["%%llvm_gfortran", "%%c,cxx,fortran=gcc"]
specs:
- matrix:
- [mpileaks, hdf5, trilinos]
- [$compilers]
toolchains:
llvm_gfortran:
- spec: "%c=llvm"
when: "%c"
- spec: "%cxx=llvm"
when: "%cxx"
- spec: "%fortran=gcc"
when: "%fortran"
packages:
callpath:
require:
- "%c=gcc"
concretizer:
unify: false
```
`%%` is now a *propagated* preference. i.e., it forces everything in a node's
sub-DAG to use the preference unless it is impossible.
To allow for exceptions using `%`, `%%`, and spec syntax while still allowing
global preferences in `packages.yaml`, the penalty taken for not fulfilling a `%%`
preference is higher than that of a preference in `packages.yaml`. In this way we
can propagate compilers to the `link,run` closure of a node, and set global
preferences for other nodes.
The performance penalty for using `%%` is not insignificant, but it is also not
present when *not* using `%%`. This has essentially zero cost for solves that do
not use the new functionality.
---------
Signed-off-by: Massimiliano Culpo <[email protected]>


fixes #51244
depends on #51314
This PR allows using
%%to set preferences on input specs, and is particularly useful when dealing withunify: falseenvironments.An example of an environment that can be concretized with this PR is:
which will produce the following result for

mpileaks %%llvm_gfortran:%%is now a propagated preference. i.e., it forces everything in a node's sub-DAG to use the preference unless it is impossible.To allow for exceptions using
%,%%, and spec syntax while still allowing global preferences inpackages.yaml, the penalty taken for not fulfilling a%%preference is higher than that of a preference inpackages.yaml. In this way we can propagate compilers to thelink,runclosure of a node, and set global preferences for other nodes.The performance penalty for using
%%is not insignificant, but it is also not present when not using%%. This has essentially zero cost for solves that do not use the new functionality.