-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Environments: matrix of optional variants #32893
Description
Summary
I would like to be able to create a Spack Environment with all possible values of a set of variants. Not all packages in the environment will have these variants, and some will have these variants recursively. Basically, I want something like:
spack:
packages:
all:
matrix:
- requires: +A~B
- requires: ~A+B
- requires: +A+B
- requires: ~A~B
specs:
- C
- D
- EWhere +A and +B will be toggled one and off for C, D, and E, even if those packages don't have those variants, even if their dependencies also have those same variants.
Rationale
I'm working on creating a CI stack for ML packages: #31592
I would like to be able to test at least 3 variations:
~rocm+cuda cuda_arch=...~cuda+rocm amdgpu_target=...~cuda~rocm
At the moment, it seems like the only way to do this is to copy-n-paste the entire stack 3 times and change a single line. With this approach, 90% of the packages will be built twice with an identical spec since it isn't possible to reuse installations across stacks.
Description
I would like to be able to do something like:
spack:
packages:
all:
matrix:
- ~rocm+cuda cuda_arch=...
- ~cuda+rocm amdgpu_target=...
- ~cuda~rocmAlternatively, something like:
spack:
definitions:
- packages:
- py-torch
- py-tensorflow
- variants:
- +cuda
- +rocm
- ~cuda~rocm
specs:
- matrix:
- [$packages]
- [$variants]However, this doesn't work because not all packages in the list have those variants, and those variants won't be forwarded down the DAG. The only other alternative is to manually concretize every package in each DAG, get a list of all packages with those variants, and manually set the entire dep tree on each line myself. Nothing like a good ol':
spack:
specs:
- py-horovod ~rocm+cuda cuda_arch=... ^py-tensorflow ~rocm+cuda cuda_arch=... ^py-torch ~rocm+cuda cuda_arch=... ...
- py-horovod ~cuda+rocm amdgpu_target=... ^py-tensorflow ~cuda+rocm amdgpu_target=... ^py-torch ~cuda+rocm amdgpu_target=... ...
- py-horovod ~cuda~rocm ^py-tensorflow ~cuda~rocm ^py-torch ~cuda~rocm ...
...Additional information
General information
- I have run
spack --versionand reported the version of Spack - I have searched the issues of this repo and believe this is not a duplicate
Metadata
Metadata
Assignees
Labels
Type
Projects
Status