-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spack should be more aggressive about reusing installed software #311
Comments
I think I need to put this on the agenda for the telcon today. Spack's current logic is:
This was intended be conservative, but what it ends up doing is not reusing as much as it could. If we did more matching against existing installs as part of the concretization process, we would reuse more by default, at the price of maybe linking against more old stuff. So I guess my question is: do you want Spack to "settle" for installed stuff more often? I think the answer for most people (like @trws) is "yes". I think we should change the default concretization policy to be to match installed first. That will make installs less deterministic. i.e., your install order will affect what you link against. We should probably provide a command-line option to install a "clean-slate" version of the package, where we concretize without considering installed packages and rebuild stuff that's not current. That would let you get the current behavior only if linking with the existing package doesn't work. @alfredo-gimenez: Thoughts? |
@tgamblin This has bitten me too with GCC. I think the settling for installed stuff is good, but maybe this needs to be controlled per package. For example, rebuilding something small with a new dependency is no big deal, but if it's something like gcc or llvm it would be better to stick with what's already installed. |
@davidbeckingsale: It sounds like you'd be happy with the default being to take what is already installed. You could always do an |
I agree with @davidbeckingsale. Especially in a situation where I want multiple python libraries to all extend the same python, I'd prefer it to look for existing python. The other weird thing is, python has zlib as a dependency, but spack first installed python with no zlib in the dependency graph... |
@alfredo-gimenez: that happens when a This change is actually pretty easy to implement, so I think we can play with it. Do others have opinions on this? @eschnett, @alalazo, @nrichart, @mathstuf @mplegendre ? |
The problem, as I see it, is that when adding a new dependency, existing installs don't have a flag for it and are treated as if they didn't build with it. As an example, adding a
I prefer the first simply because the second's maintenance burden is likely very high compared to the time to just rebuild the software again (When can the declarations safely be dropped? Was it dependent on some system state when it was built (say, a system Qt that happened to be found in which case there is no right answer)?). |
I have |
I think this is different than taking a system version and making it a package (as far as spack is concerned at least). I think the process for that case would be "tell spack that this mpi I already have installed satisfies the "mpi" requirement any package might need" (maybe with some related information about a prefix or something else). For this case, it's as if we have a package |
The work in #120 can handle the MPI case. It uses a package.yaml config file to set "preferred" package configurations in Spack. You could, for example, specify that you're a openmpi@1.8.4 and icc@15 shop, and Spack will by default concertize with that MPI and compiler. You can also start specifying locations for external packages, which Spack then use rather than building its own versions. By pointing an external package at your local MPI installation, and setting that version as preferred you could have default Spack builds always link against the local MPI. This is independent of the original request to prefer already-installed packages. As a first-order we could prefer packages specified in the packages.py, and as a second-order we could prefer packages already installed. |
@mathstuf:
The externals stuff (#120), as @mplegendre mentioned, does this. That is getting merged along with the cray port PR #309.
I think @eschnett meant he has OpenMPI installed via Spack. If OpenMPI is the first thing you install with Spack, it would be really nice if subsequent specs that require MPI just resolved against it.
Which to prefer gets a little complicated and you might want it configurable. I think we should allow someone to decide where they rank their installs stuff compared to their own and site |
@mathstuf Let me clarify: I have the spack package |
Based on this I think the consensus is to look at what is installed, and to add some type of precedence for file-based concretization preferences (once that is merged... I don't think anyone but me, @mplegendre, and @becker33 have seen that :) |
@tgamblin Allowing users rank package.yaml vs site-installs vs user-installs would get complicated. I think we should just pick a simple order and enforce it. If a user explicitly specifies a package version as preferred in package.yaml, then they probably already have that package installed or want to install it, so first-order should be package.yaml. Second-order should be preferring local installs and third-order should be preferring site-installs. These are all just about picking defaults, so if Spack picks a default wrong then a user can always just be more explicit about what they want. |
@mplegendre: I think picking an order within a config scope makes sense. I was thinking more in terms of "what about site scope". My preference would be something like |
I'm coming in on this late, and it seems that the overall decision
Case 1 and 2 are, by my mind and seemingly this discussion, pretty These can be used alone or combined to get pretty much every behavior I This also reminds me, is there a way to refer to "all packages directly |
Due to the time zone I am also entering the discussion late. Besides agreeing with basically everything has been said, I just want to add a consideration that maybe everyone considered implicit : it seems to me that most of the points in this discussion basically ask for more meta-data associated with package entries in the db. Example 1 : original
|
There are two sensible defaults for building boost libraries: build all of them or build none of them. Previously the Spack boost package took the first approach. This commit changes to building no libraries by default. The user can specify which libraries they need using variants (e.g. +iostreams to compile the boost iostreams library). If no libraries are built then a header-only install is performed (no compilation, just copy header files to prefix). The consequence of this change is that packages which specify a dependency on boost may now fail (until they are updated to specify exactly which boost libraries they need compiled). The user may now specify whether to build shared libraries (static libraries are always built) and whether to build libraries with/out multi-threading support (default is to only build with multi-threading support). The executable on the user-config.jam toolset line is set to Spack's cc script. Before, without this, the desired toolset was used but Spack deferred to the boost build system to choose the compiler version. bzip2 and zlib are always specified as dependencies when iostreams is built (before this could be controlled with the +compression variant).
Is this basically solved given #839? |
Not really. While #839 may solve this particular case with Python, the underlying problem is that if I install, let's say, |
@adamjstewart but i think this particular issue would be solved if #839 is implemented assuming that Spack re-use build-only dependencies. I think that's what @mathstuf was referring to. |
Yes, Python would no longer be re-installed I guess. But this problem occurs for every package in Spack, not just Python. |
I'm coming in really late to this discussion, but I've hit this issue a few times [1] and yesterday noticed a potentially useful feature in Homebrew that could possibly serve as an analog for Spack. The brew pin command will prevent a package "from being upgraded when issuing the [1] For example, I have Python set to use
even though the only dependency of |
This should be "just" a bug in the concretiser or some other dependency restricts to |
It may just be that the yams file lists the system python but doesn't mark python as unbuildable. The only way it will take any package version lower than the "ideal" is if it's marked unbuildable.
On 29 Mar 2019, at 5:35, Andreas Baumbach wrote:
This should be "just" a bug in the concretiser or some other dependency restricts to python@2.7.X, the list in spack spec does not show all dependency edges, but only the "first" encountered
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#311 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAoStbrieMy6q0fXHa1CPR3RbaLANe4Bks5vbgijgaJpZM4HAlJd>.
|
Hi, spack install --reuse and skip irrelevant variant settings in dependencies when concretizing. |
Are you aware of the possibility to do In general I don't really see the point, as it does not cost me time to do the rebuild. It does cost my computer and I don't care about its opinions too much. I think that is also the point of view of most of the main contributors (just judging by this issue being open for 3 years) -> so feel free to open a pull request that implements this functionality. I'd expect it to be merged relatively quickly, but I'd also expect it to cost significant time to implement that (as it touches the inner workings of the concretiser) |
thanks, the hash-based package selection looks useful, I didn't know about that. It still means I have to maintain the packages.yaml file carefully. |
@healther I think most of the main contributors, including myself, would love to see Spack reuse installed dependencies as much as possible. But as you said, this completely changes how the concretizer works and would be a large overhaul, which is why this issue has been open for so long. |
a non-intrusive approach would be to have a spack command to generate (part of) a packages.yaml file that presribes a number of installed packages (or loaded modules) |
CC: @fryeguy52, @becker33 Any chance this will get fixed or spack will add an option to make spack do this? For SNL ATDM we are needing to break up the building of the compiler, the "tools" packages, MPI, and the TPL packages into four separate We are already needing to generate package.yaml files to reuse the "tools" packages and MPI that is built in the downstream TPLs package builds. I guess we could script up the the generation of entries for the package.yaml files for these other libraries that get constantly rebuilt like 'libiconv', 'numactl', etc. We have already created the infrastructure for doing this so this would not be that hard to do. The only challenge is having to pin down the versions of all of these packages since that is the only safe way to find install directories of the the form:
A-priori we know all of this info accept for the has
Currently, that can return more than one directory because of this issue (so we just return the first directory found). But if we populate
But that 800+ lines of scripting code is less code than writing a package install system from scratch so so be it. |
@bartlettroscoe this is dependent on a rewrite of the concretization algorithm that Todd is currently working on. @fryeguy52 can tell you about the demo @tgamblin gave at the workshop this week. It's not fully functional yet, but it appears to be coming along well. |
- Added tag 7.6.6 - Defined neurodamus-neocortex, hippocampus, thalamus to use neuron@7.6.6 based on Michael Hines' suggestion on the preferred version
Any progress on this? After much frustration I adopted a multi-stage installation similar to what @bartlettroscoe described, but it would be a lot easier if I could tell spack to reuse installed specs rather than rebuild the latest version. |
For folks still interested in this, check out #25310, which will finally allow the concretizer to aggressively reuse installed packages, packages from build caches, and packages from upstreams. |
Fix BUFR_INC variables for bufr recipe & add MADIS 4.5
When I have python@2.7.10 installed:
I now try to install py-twisted, explicitly setting the dependency ^python@2.7.10:
As you can see, spack tries to reinstall python 2.7.10.
I went ahead with the installation to see the dependency graph of the new python, here it is:
The newly installed python has ^zlib, everything else is the same. py-twisted does not, however, depend on python^zlib, so not sure why spack is making this new dependency requirement. To verify that py-twisted is using the new python^zlib:
TL;DR py-twisted should use the existing python, but it creates a new python^zlib for no apparent reason.
The text was updated successfully, but these errors were encountered: