-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Faster virtuals and concretization #1015
Conversation
Is this ready to beta test in regular use?
|
@citibeth I think so. The only reason I have not merged it yet is that I have not written unit tests for the If you want to beta test it, the only thing you would need to remember is that if things go wrong, remove |
I've been frustrated by speed and eager to try the fix. I merged with 9411cb1, and I think there's an issue with python activation. Try building py-ipython and activating it. It builds fine but gives errors when I start it about readline services being unavailable. Readline is clearly a dependency of python in the spec, but doesn't seem to be followed. |
I got the problem below. Maybe my merge was bad.
|
I've had success with a different merge. This PR has made my life with Spack so much better. I recommend it be merged without delay. |
- Don't need to list all packages unless we have to. - Only use the list of all packages for existence checks if we have generated it for some other purpose.
- Don't add empty/absent fields to Spec YAML when they're not there.
- allow a provider index to be stored and re-read.
- Spack will check if the index needs updating, and will only parse all package files if it does. - Spack tries to parse as few package files as necessary.
- modules weren't set properly as attributes in parent modules
- global compiler cache breaks tests that come after this one.
- Make namespace, arch, and dependnecies show up in spec yaml only if they're set. - Lost some of this functionality with deptypes
Major stuff: - Created a FileCache for managing user cache files in Spack. Currently just handles virtuals. - Moved virtual cache from the repository to the home directory so that users do not need write access to Spack repositories to use them. - Refactored `Transaction` class in `database.py` -- moved it to `LockTransaction` in `lock.py` and made it reusable by other classes. Other additions: - Added tests for file cache and transactions. - Added a few more tests for database - Fixed bug in DB where writes could happen even if exceptions were raised during a transaction. - `spack uninstall` now attempts to repair the database when it discovers that a prefix doesn't exist but a DB record does.
9411cb1
to
05f222a
Compare
This is ready to merge. I've cleaned up a number of changes, and caching is now done in It's rebased on current develop, so the merge should be clean. Can @citibeth, @alalazo, @gartung, @davydden, @glennpj try this out and let me know if it helps? @glennpj: I think your issue in #676 may be something different, but this is worth a try. |
95bb387
to
9d4a36a
Compare
@tgamblin thanks! sorry, did not have time to check it out, but ought to be fine. |
Co-authored-by: Blanco Alonso Jorge <[email protected]>
This should fix #676.
@citibeth, @davydden, @alalazo, @becker33, @mplegendre and others will be interested in this. The changes here bring
deal
concretization down to around 3 seconds from around 20.dealii
might be one of the most complicated packages in off-the-shelf spack. We have larger ones internally and so does @citibeth, so hopefully this will ease their life a bit.Things in this PR (or related to it):
develop
because it was a major time saver) fixes large amount of time spent in re.Scanner. ALexer
(implemented withre.Scanner
), which compiles regexes, was being constructed every time we parse a spec, and that is expensive. Since spec parsing is a large part of evaluating directives likedepends_on
, this causedpackage.py
import to take a long time. Adding a single lexer for all parsers fixes this.ProviderIndex
. We have to import allpackage.py
files when we concretize specs that have virtual dependencies, because we have to find providers but we don't know whichpackage.py
files actually callprovides
. TheProviderIndex
holds that information and is now cached per package repository and automatically updated whenpackage.py
files are newer than the index. It can also be updated incrementally, so updates after the first will not be very expensive.all_package_names()
so that processing small specs doesn't even look at mostpackage.py
files.FlagMap
) -- uses tuples and doesn't manipulate strings. This saves a second or so fordealii
.ProviderIndex
compact,Spec.to_yaml
won't write out empty fields in abstract specs. This should not affect things likespec.yaml
or the install database, as those only contain concrete specs.~/.spack/caches
when$repo/index.yaml
is not writable. This would let users cache providers even for multi-user spack repos.ProviderIndex
cache.All of these commits attack the problem that concretization (and running many spack commands) require some fairly expensive operations to happen for every
package.py
file. This PR reduces the cost of these operations and avoids O(num packages) operations where it can. In the best case, only has tostat
eachpackage.py
file instead of loading all of them and parsing specs. Generally just runningstat
is pretty fast.The concretization algorithm is still at least quadratic, but the DAGs are still small by modern standards in Spack, so this is not killing us yet.