Merged
Conversation
3727e23 to
8d24870
Compare
I.e., removed the count checks and "unreleased" warning generation.
Manually confirmed cross-process detection. Implicit failure mark removal is not included in this commit.
This approach improves coordination of concurrent/parallel installs especially w.r.t. failed builds.
tgamblin
pushed a commit
that referenced
this pull request
Feb 27, 2020
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents. - [x] populate dependents when loading from yaml
tgamblin
pushed a commit
that referenced
this pull request
Mar 2, 2020
…15197) The distributed build PR (#13100) -- did not check the install status of dependencies when using the `--only package` option so would refuse to install a package with the claim that it had uninstalled dependencies whether that was the case or not. - [x] add install status checks for the `--only package` case. - [x] add initial set of tests
tgamblin
added a commit
that referenced
this pull request
Mar 7, 2020
This is a minor permission fix on the new installer.py introduced in #13100.
tgamblin
added a commit
that referenced
this pull request
Mar 8, 2020
This is a minor permission fix on the new installer.py introduced in #13100.
1 task
tgamblin
pushed a commit
that referenced
this pull request
Mar 20, 2020
…15197) The distributed build PR (#13100) -- did not check the install status of dependencies when using the `--only package` option so would refuse to install a package with the claim that it had uninstalled dependencies whether that was the case or not. - [x] add install status checks for the `--only package` case. - [x] add initial set of tests
tgamblin
pushed a commit
that referenced
this pull request
Mar 20, 2020
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents. - [x] populate dependents when loading from yaml
tgamblin
added a commit
that referenced
this pull request
Mar 20, 2020
This is a minor permission fix on the new installer.py introduced in #13100.
tgamblin
added a commit
that referenced
this pull request
Mar 28, 2020
With the addition of #13100 (parallel builds), people are going to try to run Spack in the background more often. This makes Spack handle that situation gracefully, the way a good POSIX program should. Specifically: 1. When `spack install` is running, we disable echo and canonical input so that users can type `v` to toggle build output. We do that in a safe way now, so that it does not generate `SIGTTOU` in the background (#14682 did this). 2. We properly disable keyboard input mode when Spack is placed in the background, and re-enable it when Spack is in the foreground. This means that if you Ctrl-Z a spack install, your terminal won't be left in a weird state. 3. We'll continue writing verbose output when Spack is in the background. If you have `stty +tostop` on, it'll end up stopping the build when you try to run in the background, unless you redirect output. This is normal behavior and it lets you easily do thingslike `spack install &> log.txt &` 4. Spack works fine when stopped in the background or when running in the background. (2) is handled mostly with signal handlers (the way things like `vi` and `emacs` do it) -- see the code for how that's done -- it's a bit tricky in Python, as Python did not support blocking signals until 3.8. It turns out we can still make it work.
tgamblin
added a commit
that referenced
this pull request
Mar 28, 2020
With the addition of #13100 (parallel builds), people are going to try to run Spack in the background more often. This makes Spack handle that situation gracefully, the way a good POSIX program should. Specifically: 1. When `spack install` is running, we disable echo and canonical input so that users can type `v` to toggle build output. We do that in a safe way now, so that it does not generate `SIGTTOU` in the background (#14682 did this). 2. We properly disable keyboard input mode when Spack is placed in the background, and re-enable it when Spack is in the foreground. This means that if you Ctrl-Z a spack install, your terminal won't be left in a weird state. 3. We'll continue writing verbose output when Spack is in the background. If you have `stty +tostop` on, it'll end up stopping the build when you try to run in the background, unless you redirect output. This is normal behavior and it lets you easily do things like this: spack install -v &> log.txt & 4. Spack works fine when stopped in the background or when running in the background. (2) is handled mostly with signal handlers (the way things like `vi` and `emacs` do it) -- see the code for how that's done -- it's a bit tricky in Python, as Python did not support blocking signals until 3.8. It turns out we can still make it work.
tgamblin
added a commit
that referenced
this pull request
Mar 28, 2020
With the addition of #13100 (parallel builds), people are going to try to run Spack in the background more often. This makes Spack handle that situation gracefully, the way a good POSIX program should. Specifically: 1. When `spack install` is running, we disable echo and canonical input so that users can type `v` to toggle build output. We do that in a safe way now, so that it does not generate `SIGTTOU` in the background (#14682 did this). 2. We properly disable keyboard input mode when Spack is placed in the background, and re-enable it when Spack is in the foreground. This means that if you Ctrl-Z a spack install, your terminal won't be left in a weird state. 3. We'll continue writing verbose output when Spack is in the background. If you have `stty +tostop` on, it'll end up stopping the build when you try to run in the background, unless you redirect output. This is normal behavior and it lets you easily do things like this: spack install -v &> log.txt & 4. Spack works fine when stopped in the background or when running in the background. (2) is handled mostly with signal handlers (the way things like `vi` and `emacs` do it) -- see the code for how that's done -- it's a bit tricky in Python, as Python did not support blocking signals until 3.8. It turns out we can still make it work.
tgamblin
added a commit
that referenced
this pull request
Mar 28, 2020
With the addition of #13100 (parallel builds), people are going to try to run Spack in the background more often. This makes Spack handle that situation gracefully, the way a good POSIX program should. Specifically: 1. When `spack install` is running, we disable echo and canonical input so that users can type `v` to toggle build output. We do that in a safe way now, so that it does not generate `SIGTTOU` in the background (#14682 did this). 2. We properly disable keyboard input mode when Spack is placed in the background, and re-enable it when Spack is in the foreground. This means that if you Ctrl-Z a spack install, your terminal won't be left in a weird state. 3. We'll continue writing verbose output when Spack is in the background. If you have `stty +tostop` on, it'll end up stopping the build when you try to run in the background, unless you redirect output. This is normal behavior and it lets you easily do things like this: spack install -v &> log.txt & 4. Spack works fine when stopped in the background or when running in the background. (2) is handled mostly with signal handlers (the way things like `vi` and `emacs` do it) -- see the code for how that's done -- it's a bit tricky in Python, as Python did not support blocking signals until 3.8. It turns out we can still make it work.
tgamblin
added a commit
that referenced
this pull request
Apr 1, 2020
With the addition of #13100 (parallel builds), people are going to try to run Spack in the background more often. This makes Spack handle that situation gracefully, the way a good POSIX program should. Specifically: 1. When `spack install` is running, we disable echo and canonical input so that users can type `v` to toggle build output. We do that in a safe way now, so that it does not generate `SIGTTOU` in the background (#14682 did this). 2. We properly disable keyboard input mode when Spack is placed in the background, and re-enable it when Spack is in the foreground. This means that if you Ctrl-Z a spack install, your terminal won't be left in a weird state. 3. We'll continue writing verbose output when Spack is in the background. If you have `stty +tostop` on, it'll end up stopping the build when you try to run in the background, unless you redirect output. This is normal behavior and it lets you easily do things like this: spack install -v &> log.txt & 4. Spack works fine when stopped in the background or when running in the background. (2) is handled mostly with signal handlers (the way things like `vi` and `emacs` do it) -- see the code for how that's done -- it's a bit tricky in Python, as Python did not support blocking signals until 3.8. It turns out we can still make it work.
tgamblin
added a commit
that referenced
this pull request
Jul 27, 2020
A bug was introduced in #13100 where ChildErrors would be redundantly printed when raised during a build. We should eventually revisit error handling in builds and figure out what the right separation of responsibilities is for distributed builds, but for now just skip printing. - [x] SpackErrors were designed to be printed by the forked process, not by the parent, so check if they've already been printed.
tgamblin
added a commit
that referenced
this pull request
Jul 27, 2020
A bug was introduced in #13100 where ChildErrors would be redundantly printed when raised during a build. We should eventually revisit error handling in builds and figure out what the right separation of responsibilities is for distributed builds, but for now just skip printing. - [x] SpackErrors were designed to be printed by the forked process, not by the parent, so check if they've already been printed.
1 task
tgamblin
added a commit
that referenced
this pull request
Jul 27, 2020
A bug was introduced in #13100 where ChildErrors would be redundantly printed when raised during a build. We should eventually revisit error handling in builds and figure out what the right separation of responsibilities is for distributed builds, but for now just skip printing. - [x] SpackErrors were designed to be printed by the forked process, not by the parent, so check if they've already been printed. - [x] update tests
tgamblin
added a commit
that referenced
this pull request
Jul 27, 2020
A bug was introduced in #13100 where ChildErrors would be redundantly printed when raised during a build. We should eventually revisit error handling in builds and figure out what the right separation of responsibilities is for distributed builds, but for now just skip printing. - [x] SpackErrors were designed to be printed by the forked process, not by the parent, so check if they've already been printed. - [x] update tests
tgamblin
added a commit
that referenced
this pull request
Jul 27, 2020
A bug was introduced in #13100 where ChildErrors would be redundantly printed when raised during a build. We should eventually revisit error handling in builds and figure out what the right separation of responsibilities is for distributed builds, but for now just skip printing. - [x] SpackErrors were designed to be printed by the forked process, not by the parent, so check if they've already been printed. - [x] update tests
11 tasks
tgamblin
pushed a commit
that referenced
this pull request
Nov 17, 2020
As of #13100, Spack installs the dependencies of a _single_ spec in parallel. Environments, when installed, can only get parallelism from each individual spec, as they're installed in order. This PR makes entire environments build in parallel by extending Spack's package installer to accept multiple root specs. The install command and Environment class have been updated to use the new parallel install method. The specs and kwargs for each *uninstalled* package (when not force-replacing installations) of an environment are collected, passed to the `PackageInstaller`, and processed using a single build queue. This introduces a `BuildRequest` class to track install arguments, and it significantly cleans up the code used to track package ids during installation. Package ids in the build queue are now just DAG hashes as you would expect, Other tasks: - [x] Finish updating the unit tests based on `PackageInstaller`'s use of `BuildRequest` and the associated changes - [x] Change `environment.py`'s `install_all` to use the `PackageInstaller` directly - [x] Change the `install` command to leverage the new installation process for multiple specs - [x] Change install output messages for external packages, e.g.: `[+] /usr` -> `[+] /usr (external bzip2-1.0.8-<dag-hash>` - [x] Fix incomplete environment install's view setup/update and not confirming all packages are installed (?) - [x] Ensure externally installed package dependencies are properly accounted for in remaining build tasks - [x] Add tests for coverage (if insufficient and can identity the appropriate, uncovered non-comment lines) - [x] Add documentation - [x] Resolve multi-compiler environment install issues - [x] Fix issue with environment installation reporting (restore CDash/JUnit reports)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9394
Closes #13217.
Background
Spack provides the ability to enable/disable parallel builds through two options: package
paralleland configurationbuild_jobs. This PR changes the algorithm to allow multiple, simultaneous processes to coordinate the installation of the same spec (and specs with overlapping dependencies.).The
parallel(boolean) property sets the default for its package though the value can be overridden in theinstallmethod.Spack's current parallel builds are limited to build tools supporting
jobsarguments (e.g.,Makefiles). The number of jobs actually used is calculated asmin(config:build_jobs, # cores, 16), which can be overridden in the package or on the command line (i.e.,spack install -j <# jobs>).This PR adds support for distributed (single- and multi-node) parallel builds. The goals of this work include improving the efficiency of installing packages with many dependencies and reducing the repetition associated with concurrent installations of (dependency) packages.
Approach
File System Locks
Coordination between concurrent installs of overlapping packages to a Spack instance is accomplished through bottom-up dependency DAG processing and file system locks. The runs can be a combination of interactive and batch processes affecting the same file system. Exclusive prefix locks are required to install a package while shared prefix locks are required to check if the package is installed.
Failures are communicated through a separate exclusive prefix failure lock, for concurrent processes, combined with a persistent store, for separate, related build processes. The resulting file contains the failing spec to facilitate manual debugging.
Priority Queue
Management of dependency builds changed from reliance on recursion to use of a priority queue where the priority of a spec is based on the number of its remaining uninstalled dependencies.
Using a queue required a change to dependency build exception handling with the most visible issue being that the
installmethod must install something in the prefix. Consequently, packages can no longer get away with an install method consisting ofpass, for example.Caveats
Built-in Package's Provider Cache
Update: The fix has been merged into this PR.
This PR does not address contention related to the initial build of built-ins provider cache, which is performed on an as-needed basis as part ofspack install. Until that issue is addressed (in a separate PR), it is recommended that you ensure the cache, which can be found in$HOME/.spack/cache, exists before attemptingspack installfrom more than one process. The cache can be created by runningspack spec <spec>from a single process before starting the installs.Concretizing Environments
Update: The fix, from #14621 , has been merged into this PR as of commit
032745b.Distributed builds in environments encounterNo such file or directory: '/<env>/.spack.lock.tmp'\n==> Installing environment /<env>errors when attempting to runspack install [-j<#>] &in parallel. This has been tracked down toEnvironment.write()not being thread-safe.Requested Spec Failures
There appears to be a failure notification timing issue between processes should the requested spec fail to install. This results in each process taking a turn at attempting to install the final spec.
TODO
spack install <spec>callsinstall: passmethods with file creation since post-installsanity_check_prefixwill otherwise error out withInstall failed .. Nothing was installed!bin/demo-locks.pydef install(..): passto "install" something (i.e., onlyapple-libunwind)- [ ] Update install docs