summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/low-priority-provider/package.py
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-11-02 07:35:23 +0100
committerGitHub <noreply@github.com>2023-11-01 23:35:23 -0700
commit16fa3b9f077be62e62214585dee9f6dfda7f48ad (patch)
tree0a2208f08955524d0f2bad316816f5d94be580db /var/spack/repos/builtin.mock/packages/low-priority-provider/package.py
parent6cd2241e49a393d7ac32b46064a2d2f4e53f7d86 (diff)
downloadspack-16fa3b9f077be62e62214585dee9f6dfda7f48ad.tar.gz
spack-16fa3b9f077be62e62214585dee9f6dfda7f48ad.tar.bz2
spack-16fa3b9f077be62e62214585dee9f6dfda7f48ad.tar.xz
spack-16fa3b9f077be62e62214585dee9f6dfda7f48ad.zip
Cherry-picking virtual dependencies (#35322)
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
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/low-priority-provider/package.py')
-rw-r--r--var/spack/repos/builtin.mock/packages/low-priority-provider/package.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/var/spack/repos/builtin.mock/packages/low-priority-provider/package.py b/var/spack/repos/builtin.mock/packages/low-priority-provider/package.py
index 5b7bfc03c1..940dea3daf 100644
--- a/var/spack/repos/builtin.mock/packages/low-priority-provider/package.py
+++ b/var/spack/repos/builtin.mock/packages/low-priority-provider/package.py
@@ -14,5 +14,5 @@ class LowPriorityProvider(Package):
version("1.0", md5="0123456789abcdef0123456789abcdef")
- provides("lapack")
- provides("mpi")
+ # A low priority provider that provides both these specs together
+ provides("mpi", "lapack")