Spack environments can concretize specs together#11372
Spack environments can concretize specs together#11372scheibelp merged 8 commits intospack:developfrom
Conversation
|
I was also thinking that maintaining a view by default:
Of course, any explicit configuration for views should override the default. I wonder what is the stance of other people on this. |
healther
left a comment
There was a problem hiding this comment.
I'm not sure if I should approve the changes, I like the intention, but I'm not well enough versed in the code to give serious feedback.
I very much like this feature. Whether the view generation default should be tied to it I'm not sure. I think that in most cases when you want one concretisation you'll probably also want a view, but that kind of implicit binding is way to smart not to bite back at some point in the future. The question is whether there should be something like a system-like: True/False configuration entry as a kind of shortcut for "let me treat this as /usr"?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This issue was actually thought through and discussed since the beginning of Spack Environments. In the end, we implemented what we did, rather than the full plan, in order to get SOMETHING functional out the door --- and because the concretizer at the time did not support The full plan is basically to allow Or you could do (for example): The last case is actually the most likely, IMHO. In my experience, a Spack Environment for a particular project requires (a) a bunch of required dependencies for the project, and (b) a bunch of ancillary command-line tools that are used to create input files, view output files, do source code control, etc. Packages in (a) should be concretized together, and packages in (b) should not. In other words, my preferred environment would look something like this: |
citibeth
left a comment
There was a problem hiding this comment.
Please add functionality to allow arbitrary subsets within the environment to be concretized together. That is much more useful than an all-or-nothing choice.
Three counterpoints to this:
|
Is the full plan written somewhere? I didn't participate in the initial discussions and I thought that what was planned was merged already. Also, the concretizer didn't change in the meanwhile - I just wrote a function around it 🙂 From my point of view there are two major cases in which environments can be useful:
Point 1. can somehow be addressed by the current state of environments and support for that use case will be completed by #11057. Point 2. is instead kind of unusable, or at least very inconvenient, as people might need to over-constraint specs in order for them to be concretized in a self-consistent manner. This PR makes point 2. usable.
That, in my opinion, can be added later - on top of #11057. Because basically the subset and syntax you're looking for is exactly the one introduced by @becker33 in that PR. We could allow having a boolean key I don't see the need to oblige people to use the more complicated (and more powerful) syntax in #11057 if they just need to express a simple list of specs that needs to be concretized together. Going to your example, that would look like: spack:
specs:
- matrix:
- ['git', 'emacs', 'nco']
- matrix:
- ['libA', 'libB', 'libC', 'libD']
concretize_together: truebut if I just need the four libraries concretized together, I'd rather say something like: spack:
specs:
- 'libA'
- 'libB'
- 'libC'
- 'libD'
concretize_together: truerather than: spack:
specs:
- matrix:
- ['libA', 'libB', 'libC', 'libD']
concretize_together: trueIn the end I don't think that your request to extend the feature should be a blocker for this PR, as what you ask for can be implemented later. But I'll let @scheibelp and @becker33 judge that. |
|
On Wed, May 15, 2019 at 1:47 PM Massimiliano Culpo ***@***.***> wrote:
This issue was actually thought through and discussed since the beginning
of Spack Environments. In the end, we implemented what we did, rather than
the full plan, in order to get SOMETHING functional out the door --- and
because the concretizer at the time did not support concretize_together in
a lightweight manner.
Is the full plan written somewhere? I didn't participate in the initial
discussions and I thought that what was planned was merged already.
See here (search down for "Peter, Todd and I discussed this possibility").
You did participate in this discussion.
https://groups.google.com/forum/#!topic/spack/ECirfnwHXlo
@alalazo: I think we should somehow add the concept of a "multi-spec DAG".
> Name is provisional of course, but the idea is that you can select from a
> spec-list (which represents a blob of installed packages) subsets which
> share the same constraints as a single spec:
>
> - no 2 different versions of the same library
>
>
> - unique provider for a service (e.g. openmpi for mpi)
>
>
@citibeth:
Peter, Todd and I discussed this possibility. In that scheme, spec lists
become essentially a two-level nested list:
```
1.
(a) python
(b) py-numpy
(b) py-mystuff
2.
(a) ***@***.***
3.
(a) foo
```
In this case, everything with the same number will be concretized
together. We already have (or almost have) a way to concretize things
together, via *BundlePackage*. It's clunkier than the above, but it
works. Therefore, we decided that version 1 should just do single-level
spec lists, and we can add this grouping-by-concretization feature later.
Also, the concretizer didn't change in the meanwhile - I just wrote a
function around it 🙂
Yes, I understand that; but I think it's a good hack, and not one that
makes things too messy at higher levels :-)
Please add functionality to allow arbitrary subsets within the environment
to be concretized together. That is much more useful than an all-or-nothing
choice.
That, in my opinion, can be added later - on top of #11057
<#11057>. Because basically the subset
and syntax you're looking for is exactly the one introduced by @becker33
<https://github.com/becker33> in that PR. We could allow having a boolean
key concretize_together at the same level of the matrix key, and the one
appearing here can be overridden by that.
I see that spec matrices can be used to create sub-groups of specs. But I
don't think it's the right syntax for here.
I don't see the need to oblige people to use the more complicated (and
more powerful) syntax in #11057
<#11057> if they just need to express
a simple list of specs that needs to be concretized together.
Neither do I. I think the syntax I proposed in the email list (above) is
more like what we want.
In the end I don't think that your request to extend the feature should be
a blocker for this PR, as what you ask for can be implemented later. But
I'll let @scheibelp <https://github.com/scheibelp> and @becker33
<https://github.com/becker33> judge that.
Let's please at least figure out (and agree on) what syntax we'll
eventually use before merging this. I don't want to end up merging a
half-baked feature, and later having to re-do its syntax because we didn't
think of the full version at the time. As long as we can agree on an
eventual syntax now --- and this PR conforms to that eventual syntax ---
then I'm OK with merging what we have.
|
|
Side note: I still fail to see why I would want to have packages with conflicting dependencies (i.e. not concretised together) in the same environment, so take my comments with some amount of salt. Why couldn't we (in the future) extend the something like: The only thing that does not trivially fit into this scheme is autogenerated matrices of software, but in this case the full freedom to choose arbitrary combinations is probably not needed anyways. IOW each combination of the matrix is probably supposed to be concretised together anyways. For the default settings: I agree with @citibeth that a subtle connection between |
|
On Thu, May 16, 2019 at 3:26 AM Andreas Baumbach ***@***.***> wrote:
Side note: I still fail to see why I would want to have packages with
conflicting dependencies (i.e. not concretised together) in the same
environment,
Imagine you want to create an environment with two programs, whose
dependencies look like:
A -> F -> [email protected]
B -> G -> [email protected]
B requires the new features of [email protected]; but the upgrade to [email protected] broke some
behavior that A depended on (and they haven't updated it yet, maybe
never). To install A and B both in the same environment, you will have to
concretize them separately. Since L is a library, it is linked to F and G
via RPATH; therefore conflicts don't matter here. (i.e. neither module for
L needs to be loaded when rendering this environment).
Why couldn't we (in the future) extend the concretise_together setting to
take either a bool (all or nothing) or a list of tuples. Where each tuple
would contain each set of (partial) specs that should be concretised
together?
something like:
concretise_together: [ ***@***.***, ***@***.***),
***@***.***, ***@***.***),
***@***.***:, ***@***.***:) ]
We could. But there are other syntaxes that I think would be more
intuitive (eg the one I proposed in the email quoted above). I just don't
know... that's why I'm asking that we figure this out before locking
ourselves into a syntax that might not be what we want in the end.
The only thing that does not trivially fit into this scheme is
autogenerated matrices of software, but in this case the full freedom to
choose arbitrary combinations is probably not needed anyways. IOW each
combination of the matrix is probably supposed to be concretised together
anyways.
I haven't thought much about autogenerated matrices. But I agree, each
matrix would probably need to be concretized together.
I would go further and suggest that each matrix should be its own
environment (i.e. its own set of software for which a view or single module
is created to activate it). So maybe we need to think through the matrix
stuff further.
For the default settings: I agree with @citibeth
<https://github.com/citibeth> that a subtle connection between
concretise_together and maintain_view is bad because it surprises the
user. But if concretise_together is anticipated to produce problems like
"We just ran out of inodes" it *might* be a good idea. From my experience
I didn't run into that problem, but then again I only was on comparatively
and small clusters.
You run out of inodes if your sysadmins have set up inode limits on your
HPC. (Speaking from experience...) Using views instead of loading modules
approximately double the number of required inodes.
|
|
In real life, I think most environments will be concretized together in one
batch. That is the case we need to make easy.
|
|
It's also worth pointing out that it IS possible to get things to all
concretize the same way, even with today's Environments in which everything
concretizes separately. You do that by putting all your versions and
variants in appropriate `spack.yaml` (`packages.yaml` section) file, and
then just putting "bare" specs (i.e. no version or variants) in the
environment spec itself. This is a little heavy-weight to set up, but I've
had good experience with it. I do think that being able to concretize it
all together will be an easier / more flexible way to go (and more
guarantee that you don't accidentally / unnecessarily build the same thing
twice).
|
That is my thought exactly, but currently it is not the default behaviour, @alalazo's change would do that (on the cost of potential future compatibility problems). |
|
@alalazo <https://github.com/alalazo>'s change would do that (on the cost
of potential future compatibility problems).
The technical capabilities introduced by this PR are a good thing. Let's
please just make the effort to get it right --- and according to the design
that was originally discussed by the key parties here.
… |
|
Regarding #11372 (comment)
@tgamblin suggested that once the concretizer is updated to allow for multiple instances of dependencies based on dependency type (e.g. that two run dependencies can use conflicting link dependencies), that this issue will be handled automatically. Given that, I think |
Short answer: I agree. Long answer: I'm reluctant to break things, or leave them broken, on the assumption that the new concretizer will make it all well. That's why Spack still can't build Python3 stacks without a lot of fiddling. However, there already exist other ways to get everything to concretize the same way, even with This brings up the next question: will we get rid of And finally... if we go this route, then we seem to be agreeing that environments are not just a bunch of specs, but specs that are meant to be concretized together (a la Linux distro); the only real exception being that non-top-level packages in the DAG could have multiple instances when needed. If this is the case, then #11057 needs to be significantly reworked, because it breaks this fundamental assumption/feature of environments. If we do plan on merging #11057 in its current form --- which implicitly involves subsets of packages concretized together and separately from others --- then we might as well go whole hog and make it an explicit feature of environments. In other words, I see a fundamental conflict between #11372 and #11057. We go either one way or the other. And right now, it looks like we're leaning toward #11372 and away from #11057. Any thoughts / comments? |
citibeth
left a comment
There was a problem hiding this comment.
The large issues have been resolved. I still believe:
- There should not be linkage between
concretize_togetherand automatic view creation / maintenance. - This PR would benefit from come attention paid to consistency of variable names in the code.
fixes spack#9902 fixes spack#11095 This PR adds a boolean entry in spec.yaml called 'concretize_together'. If set to True all the specs in the environment are concretized to be self-consistent, meaning there will be a single configuration for each package and a single provider for each virtual dependency. The default value is False to maintain backward compatibility with the behavior before this PR.
918acee to
be56262
Compare
be56262 to
18fbfc7
Compare
Concretization strategies are functions of the Environment class that respect the semantic of the 'concretization' method. They are now registered using a decorator. Docs have been updated accordingly and a note has been added to stress that when concretizing specs together any new addition of a user spec will trigger a re-concretization of the entire environment.
|
Can anybody in the thread test drive again this PR and give some feedback? The only change with respect to its previous state is that |
Then I tried (not fully aware of the syntax) Iterating Then appear to do their jobs in the respective environments. |
|
@kmanalo That's expected behavior: in the schema the value is supposed to be a string not a list. I agree that the default error message might be confusing in that case. |
scheibelp
left a comment
There was a problem hiding this comment.
I have two additional requests
The schema is easier to read, but consistency is harder to enforce.
|
Thanks! |
|
Great to see this got merged. Hope to test this soon. I don't see any documentation for this new option at https://spack.readthedocs.io/en/latest/spack.html. When will that appear? |
|
@bartlettroscoe There's a brief mention of the new option here and here. Let me know what you think of that. |
|
Looks good. I look forward to trying this out (but I think that means a complete upgrade of Spack so I am a little nervous). I was looking for the term "concretize" instead of "concretization" so I missed this reference. |
This PR adds a 'concretize' entry to an environment's spec.yaml file which controls how user specs are concretized. By default it is set to 'separately' which means that each spec added by the user is concretized separately (the behavior of environments before this PR). If set to 'together', the environment will concretize all of the added user specs together; this means that all specs and their dependencies will be consistent with each other (for example, a user could develop code linked against the set of libraries in the environment without conflicts). If the environment was previously concretized, this will re-concretize all specs, in which case previously-installed specs may no longer be used by the environment (in this sense, adding a new spec to an environment with 'concretize: together' can be significantly more expensive). The 'concretize: together' setting is not compatible with Spec matrices; this PR adds a check to look for multiple instances of the same package added to the environment and fails early when 'concretize: together' is set (to avoid confusing messages about conflicts later on).
|
Alas, I can't even try this due to #13248 when attempting an upgrade. :-( |
This PR adds a 'concretize' entry to an environment's spec.yaml file which controls how user specs are concretized. By default it is set to 'separately' which means that each spec added by the user is concretized separately (the behavior of environments before this PR). If set to 'together', the environment will concretize all of the added user specs together; this means that all specs and their dependencies will be consistent with each other (for example, a user could develop code linked against the set of libraries in the environment without conflicts). If the environment was previously concretized, this will re-concretize all specs, in which case previously-installed specs may no longer be used by the environment (in this sense, adding a new spec to an environment with 'concretize: together' can be significantly more expensive). The 'concretize: together' setting is not compatible with Spec matrices; this PR adds a check to look for multiple instances of the same package added to the environment and fails early when 'concretize: together' is set (to avoid confusing messages about conflicts later on).
depends on #12213
fixes #9902
fixes #11095
This PR adds a boolean entry in
spack.yaml:If set to
trueall the specs in the environment are concretized to be self-consistent, meaning there will be a single configuration for each package and a single provider for each virtual dependency. The default value isfalseto maintain backward compatibility with the behavior before this PR.