Improve concretization performance#14190
Conversation
|
@tgamblin thank you, very instructive! I see a > 3x speedup. (I also built on top of that to speed-up our own custom commands) |
|
@matz-e: can you run |
Before$ time spack spec r-condop
...
real 1m11.689s
user 1m1.083s
sys 0m4.075sAfter$ time spack spec r-condop
...
real 0m12.434s
user 0m10.675s
sys 0m0.547sGreat job! |
|
@adamjstewart @ajw1980: try now. |
793616d to
b610fd1
Compare
|
@tgamblin now things are slightly slower than the previous commit (ran it twice just to make sure): $ time spack spec r-condop
...
real 0m17.480s
user 0m14.182s
sys 0m0.921s |
|
Yes, now I think we're looking good. Profile: |
|
@adamjstewart: does the previous commit still run in 12s for you? |
|
"spack find" is still a little slow for the python3 environment I have. It takes around 34 seconds. Here is the pyinstrument for that. Running outside of the environment is fast -- about 1.5 seconds real time. |
Previous commit is consistently 12 seconds, current commit is 13-20 seconds. |
|
I think there's still a lot of room for improvement within Spack Environments. Concretization seems pretty fast now. After concretization, I see thousands of comments like: These debug messages show that we're installing the same files dozens of times. After this finishes, I see messages like: thousands of times. This step lasts around 15 minutes for a partially installed environment. If you don't run |
`get_platform()` is pretty expensive and can be called many times in a spack invocation. - [x] memoize `get_platform()`
Checks for deprecated specs were repeatedly taking out read locks on the database, which can be very slow. - [x] put a read transaction around the deprecation check
1b33c6a to
80d42ae
Compare
|
@adamjstewart: see if the latest commits have the same issue. Turns out the transaction really belongs in |
|
@ajw1980: I pushed another commit that should speed up |
d152f8f to
54328be
Compare
|
@tgamblin latest commit has a bug: |
`spack spec -I` queries the database for installation status and should use a read transaction around calls to `Spec.tree()`.
`Environment.added_specs()` has a loop around calls to `Package.installed()`, which can result in repeated DB queries. Optimize this with a read transaction in `Environment`.
54328be to
421d4e4
Compare
|
@adamjstewart: oops try now |
|
On the latest commit, $ time spack spec r-condop
...
real 0m11.816s
user 0m10.789s
sys 0m0.512sHowever, if I run $ time spack install
...
real 29m57.196s
user 27m50.154s
sys 1m20.027sThe environment in question is pretty big: spack:
specs:
- bash
- graphviz
- watch
- wget
- automake
- autoconf
- libtool
- m4
- cmake
- ninja
- patchelf
- mercurial
- subversion
- gnupg
- python
- py-codecov
- py-flake8
- py-matplotlib
- py-numpy
- py-pandas
- py-pytest
- py-pytest-cov
- py-pytest-mock
- py-pytest-runner
- py-setuptools
- py-scikit-learn
- py-scipy
- py-sphinx
- py-sphinx-rtd-theme
- py-sphinxcontrib-programoutput
- py-tables
- py-torch
- py-torchvision
- py-twine
- gdal
concretization: togetherIf you run |
|
@adamjstewart: go ahead and open another issue for that one as I can't reproduce it right now. I do want to stamp that out, though. |
I able to revisit this only just now. After locking the database a bit more, I observe a 10x speed-up, seems in-line with the other results. I think that's fine. I've attached some results pyinstrument_filter.txt for our custom command (based on Scitas) Thank you for the speed-up! |
Fixes #12779.
This addresses two problems:
get_platform()is pretty expensive and can be called many times in a spack invocation.get_platform()@ajw1980 @matz-e: does this improve things for you?