-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Cherry-picking virtual dependencies #35322
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
Cherry-picking virtual dependencies #35322
Conversation
|
Hi @alalazo! I noticed that the following package(s) don't yet have maintainers:
Are you interested in adopting any of these package(s)? If so, simply add the following to the package class: maintainers = ["alalazo"]If not, could you contact the developers of this package and see if they are interested? You can quickly see who has worked on a package with $ spack blame openblasThank you for your help! Please don't add maintainers without their consent. You don't have to be a Spack expert or package developer in order to be a "maintainer," it just gives us a list of users willing to review PRs or debug issues relating to this package. A package can have multiple maintainers; just add a list of GitHub handles of anyone who wants to volunteer. |
502e8ec to
a97ae9a
Compare
8471718 to
d9bf846
Compare
3902ec3 to
3da64e2
Compare
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
d8ae02c to
6ad4286
Compare
6ad4286 to
f5eb6ac
Compare
3da64e2 to
3ac92ab
Compare
|
Hello. I tried this PR with the following spec: cp2k@master +dlaf +libxc +libint +spglib build_system=cmake ^[virtuals=blas,lapack,scalapack,mkl]
intel-mkl@2020.4.304 threads=openmp ^fftw ^cray-mpichIt returned this error, which is very cryptic: That is, no error messages are actually printed for However, by removing cp2k@master +dlaf +libxc +libint +spglib build_system=cmake ^[virtuals=blas,lapack,scalapack]
intel-mkl@2020.4.304 threads=openmp ^fftw ^cray-mpichThis is a really neat and useful feature. |
|
@RMeli Thanks for the feedback! Error messages are a pain point when working with ASP, we'll try to improve them considerably for v0.21 (so roughly going to November 2023) 🙂 |
eae15ce to
6893fc1
Compare
@tgamblin ☝️ |
With the new semantic, lujit and lualang must be provided together by these specs.
6893fc1 to
cc60cef
Compare
tgamblin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went over the rest of the code here and it LGTM.
This PR makes it possible to select only a subset of virtual dependencies from a spec that _may_ provide more. To select providers, a syntax to specify edge attributes is introduced:
```
hdf5 ^[virtuals=mpi] mpich
```
With that syntax we can concretize specs like:
```console
$ spack spec strumpack ^[virtuals=mpi] intel-parallel-studio+mkl ^[virtuals=lapack] openblas
```
On `develop` this would currently fail with:
```console
$ spack spec strumpack ^intel-parallel-studio+mkl ^openblas
==> Error: Spec cannot include multiple providers for virtual 'blas'
Requested 'intel-parallel-studio' and 'openblas'
```
In package recipes, virtual specs that are declared in the same `provides` directive need to be provided _together_. This means that e.g. `openblas`, which has:
```python
provides("blas", "lapack")
```
needs to provide both `lapack` and `blas` when requested to provide at least one of them.
## Additional notes
This capability is needed to model compilers. Assuming that languages are treated like virtual dependencies, we might want e.g. to use LLVM to compile C/C++ and Gnu GCC to compile Fortran. This can be accomplished by the following[^1]:
```
hdf5 ^[virtuals=c,cxx] llvm ^[virtuals=fortran] gcc
```
[^1]: We plan to add some syntactic sugar around this syntax, and reuse the `%` sigil to avoid having a lot of boilerplate around compilers.
Modifications:
- [x] Add syntax to interact with edge attributes from spec literals
- [x] Add concretization logic to be able to cherry-pick virtual dependencies
- [x] Extend semantic of the `provides` directive to express when virtuals need to be provided together
- [x] Add unit-tests and documentation
This PR makes it possible to select only a subset of virtual dependencies from a spec that _may_ provide more. To select providers, a syntax to specify edge attributes is introduced:
```
hdf5 ^[virtuals=mpi] mpich
```
With that syntax we can concretize specs like:
```console
$ spack spec strumpack ^[virtuals=mpi] intel-parallel-studio+mkl ^[virtuals=lapack] openblas
```
On `develop` this would currently fail with:
```console
$ spack spec strumpack ^intel-parallel-studio+mkl ^openblas
==> Error: Spec cannot include multiple providers for virtual 'blas'
Requested 'intel-parallel-studio' and 'openblas'
```
In package recipes, virtual specs that are declared in the same `provides` directive need to be provided _together_. This means that e.g. `openblas`, which has:
```python
provides("blas", "lapack")
```
needs to provide both `lapack` and `blas` when requested to provide at least one of them.
## Additional notes
This capability is needed to model compilers. Assuming that languages are treated like virtual dependencies, we might want e.g. to use LLVM to compile C/C++ and Gnu GCC to compile Fortran. This can be accomplished by the following[^1]:
```
hdf5 ^[virtuals=c,cxx] llvm ^[virtuals=fortran] gcc
```
[^1]: We plan to add some syntactic sugar around this syntax, and reuse the `%` sigil to avoid having a lot of boilerplate around compilers.
Modifications:
- [x] Add syntax to interact with edge attributes from spec literals
- [x] Add concretization logic to be able to cherry-pick virtual dependencies
- [x] Extend semantic of the `provides` directive to express when virtuals need to be provided together
- [x] Add unit-tests and documentation
depends on #39508
fixes #15443
This PR makes it possible to select only a subset of virtual dependencies from a spec that may provide more. To select providers, a syntax to specify edge attributes is introduced:
With that syntax we can concretize specs like:
$ spack spec strumpack ^[virtuals=mpi] intel-parallel-studio+mkl ^[virtuals=lapack] openblasand get this concrete DAG:
On
developthis would currently fail with:In package recipes, virtual specs that are declared in the same
providesdirective need to be provided together. This means that e.g.openblas, which has:needs to provide both
lapackandblaswhen requested to provide at least one of them.Additional notes
This capability is needed to model compilers. Assuming that languages are treated like virtual dependencies, we might want e.g. to use LLVM to compile C/C++ and Gnu GCC to compile Fortran. This can be accomplished by the following1:
Modifications:
providesdirective to express when virtuals need to be provided togetherFootnotes
We plan to add some syntactic sugar around this syntax, and reuse the
%sigil to avoid having a lot of boilerplate around compilers. ↩