Installer: rewire spliced specs via RewireTask#39136
Installer: rewire spliced specs via RewireTask#39136becker33 merged 48 commits intospack:developfrom
Conversation
|
In case this rebase goes bad, the last commit before I attempted to rebase was |
4cde3f7 to
5e37abc
Compare
|
TODO list:
|
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: isort, black, flake8, mypy
==> Modified files
lib/spack/spack/binary_distribution.py
lib/spack/spack/config.py
lib/spack/spack/environment/environment.py
lib/spack/spack/installer.py
lib/spack/spack/rewiring.py
lib/spack/spack/schema/concretizer.py
lib/spack/spack/schema/merged.py
lib/spack/spack/schema/splice.py
lib/spack/spack/solver/asp.py
lib/spack/spack/spec.py
lib/spack/spack/test/bindist.py
lib/spack/spack/test/buildtask.py
lib/spack/spack/test/concretize.py
lib/spack/spack/test/conftest.py
lib/spack/spack/test/installer.py
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/concretize.py
All done! ✨ 🍰 ✨
1 file reformatted, 14 files left unchanged.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
Success: no issues found in 586 source files
mypy checks were clean
==> spack style checks were clean
I've updated the branch with style fixes. But it looks like I'm not able to push to your branch. 😭️ Did you check Allow edits from maintainers when you opened the PR? |
4f4608c to
800451a
Compare
|
[Adding here based on 2023-09-27 telcon discussion]
|
|
Can there be a human readable description of what this PR is doing? |
bd8bdb8 to
77da5ce
Compare
tldahlgren
left a comment
There was a problem hiding this comment.
Very preliminary/minor feedback.
f8cd521 to
c6823aa
Compare
Co-authored-by: Todd Gamblin <[email protected]>
|
|
||
| spec = spack.spec.Spec("hdf5 ^zmpi").concretized() | ||
|
|
||
| assert spec.satisfies(f"^mpich/{mpich_spec.dag_hash()}") |
There was a problem hiding this comment.
I'll submit a one line fix for this, but I think mpich dag hash is not an invariant when transitive=False. This test just happen to pass because currently mpich in the mock repository has no dependency, so I guess both transitive and non-transitive are behaving the same.
| # The one spec is mpileaks | ||
| for _, spec in e2.concretized_specs(): | ||
| assert spec.spliced | ||
| assert spec["mpi"].satisfies(zmpi) |
There was a problem hiding this comment.
I think even this assertion is not an invariant. If the original zmpi had a build dependency (in the mock repo it doesn't), then the replacement zmpi wouldn't have it - and that changes the hash of the node.
This PR allows users to configure explicit splicing replacement of an abstract spec in the concretizer.
concretizer:
splice:
explicit:
- target: mpi
replacement: mpich/abcdef
transitive: true
This config block would mean "for any spec that concretizes to use mpi, splice in mpich/abcdef in place of the mpi it would naturally concretize to use. See spack#20262, spack#26873, spack#27919, and spack#46382 for PRs enabling splicing in the Spec object. This PR will be the first place the splice method is used in a user-facing manner. See https://spack.readthedocs.io/en/latest/spack.html#spack.spec.Spec.splice for more information on splicing.
This will allow users to reuse generic public binaries while splicing in the performant local mpi implementation on their system.
In the config file, the target may be any abstract spec. The replacement must be a spec that includes an abstract hash `/abcdef`. The transitive key is optional, defaulting to true if left out.
Two important items to note:
1. When writing explicit splice config, the user is in charge of ensuring that the replacement specs they use are binary compatible with whatever targets they replace. In practice, this will likely require either specific knowledge of what packages will be installed by the user's workflow, or somewhat more specific abstract "target" specs for splicing, to ensure binary compatibility.
2. Explicit splices can cause the output of the concretizer not to satisfy the input. For example, using the config above and consider a package in a binary cache `hdf5/xyzabc` that depends on mvapich2. Then the command `spack install hdf5/xyzabc` will instead install the result of splicing `mpich/abcdef` into `hdf5/xyzabc` in place of whatever mvapich2 spec it previously depended on. When this occurs, a warning message is printed `Warning: explicit splice configuration has caused the the concretized spec {concrete_spec} not to satisfy the input spec {input_spec}".
Highlighted technical details of implementation:
1. This PR required modifying the installer to have two separate types of Tasks, `RewireTask` and `BuildTask`. Spliced specs are queued as `RewireTask` and standard specs are queued as `BuildTask`. Each spliced spec retains a pointer to its build_spec for provenance. If a RewireTask is dequeued and the associated `build_spec` is neither available in the install_tree nor from a binary cache, the RewireTask is requeued with a new dependency on a BuildTask for the build_spec, and BuildTasks are queued for the build spec and its dependencies.
2. Relocation is modified so that a spack binary can be simultaneously installed and rewired. This ensures that installing the build_spec is not necessary when splicing from a binary cache.
3. The splicing model is modified to more accurately represent build dependencies -- that is, spliced specs do not have build dependencies, as spliced specs are never built. Their build_specs retain the build dependencies, as they may be built as part of installing the spliced spec.
4. There were vestiges of the compiler bootstrapping logic that were not removed in spack#46237 because I asked alalazo to leave them in to avoid making the rebase for this PR harder than it needed to be. Those last remains are removed in this PR.
Co-authored-by: Nathan Hanford <[email protected]>
Co-authored-by: Gregory Becker <[email protected]>
Co-authored-by: Tamara Dahlgren <[email protected]>
This PR allows users to configure explicit splicing replacement of an abstract spec in the concretizer.
This config block would mean "for any spec that concretizes to use mpi, splice in
mpich/abcdefin place of the mpi it would naturally concretize to use. See #20262, #26873, #27919, and #46382 for PRs enabling splicing in the Spec object. This PR will be the first place the splice method is used in a user-facing manner. See https://spack.readthedocs.io/en/latest/spack.html#spack.spec.Spec.splice for more information on splicing.This will allow users to reuse generic public binaries while splicing in the performant local mpi implementation on their system.
In the config file, the
targetmay be any abstract spec. Thereplacementmust be a spec that includes an abstract hash/abcdef. Thetransitivekey is optional, defaulting totrueif left out.Two important items to note:
hdf5/xyzabcthat depends on mvapich2. Then the commandspack install hdf5/xyzabcwill instead install the result of splicingmpich/abcdefintohdf5/xyzabcin place of whatever mvapich2 spec it previously depended on. When this occurs, a warning message is printed `Warning: explicit splice configuration has caused the the concretized spec {concrete_spec} not to satisfy the input spec {input_spec}".Highlighted technical details of implementation:
RewireTaskandBuildTask. Spliced specs are queued asRewireTaskand standard specs are queued asBuildTask. Each spliced spec retains a pointer to itsbuild_specfor provenance. If aRewireTaskis dequeued and the associatedbuild_specis neither available in the install_tree nor from a binary cache, theRewireTaskis requeued with a new dependency on a BuildTask for the build_spec, andBuildTasks are queued for the build spec and its dependencies.build_specis not necessary when splicing from a binary cache.config:install_missing_compilers#46237 because I asked @alalazo to leave them in to avoid making the rebase for this PR harder than it needed to be. Those last remains are removed in this PR.