Skip to content

Commit 312b11b

Browse files
msimbergalbestro
andauthored
Concretizer duplicates strategy (#269)
Based on top of #268. It's easiest to only look at the unique commit for this PR: 3ed904a. This is the second change I need to be able to concretize `rccl-tests` with `llvm-amdgpu` as the compiler. This adds a configuration option to control the `concretizer:duplicates:strategy` configuration option. For `rccl-tests` I need to set the option to `full`, instead of the default `minimal`. Unfortunately I can't really explain why this is required. The docs explain a bit what the different options do: https://spack.readthedocs.io/en/latest/build_settings.html. ``` duplicates: # "none": allows a single node for any package in the DAG. # "minimal": allows the duplication of 'build-tools' nodes only # (e.g. py-setuptools, cmake etc.) # "full" (experimental): allows separation of the entire build-tool stack (e.g. the entire "cmake" subDAG) ``` I've asked for feedback on the spack slack: https://spackpm.slack.com/archives/C059JUS9T38/p1761907568615009. In the meantime I'm going to assume that this will be needed. I don't quite like that this is another ad-hoc spack configuration option exposed in the config. It'd be nice to just have a `concretizer` section exposed in `environments.yaml`, but that's a breaking change (`unify` is not nested under `concretizer`). Alternatively, perhaps it should be possible to supply a completely separate spack configuration that can be used to override anything, without having to add support for every single configuration option explicitly. --------- Co-authored-by: Alberto Invernizzi <9337627+albestro@users.noreply.github.com>
1 parent 43e843b commit 312b11b

6 files changed

Lines changed: 31 additions & 0 deletions

File tree

docs/recipes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ prgenv-gnu:
103103
network: # ... network configuration
104104
deprecated: # ... whether to allow usage of deprecated packages or not
105105
unify: # ... configure Spack concretizer
106+
duplicates: # ... configure how the concretizer should handle duplicates
106107
specs: # ... list of packages to install
107108
variants: # ... variants to apply to packages (e.g. +mpi)
108109
packages: # ... list of external packages to use
@@ -277,6 +278,16 @@ cuda-env:
277278
!!! warning
278279
Stackinator does not support "spec matrices", and likely won't, because they use multiple compiler toolchains in a manner that is contrary to the Stackinator "keep it simple" principle.
279280

281+
The `duplicates:strategy` field [controls how the concretiser handles duplicates](https://spack.readthedocs.io/en/latest/build_settings.html).
282+
The default strategy is `minimal` which is typically the right choice.
283+
In mixed compiler environments, `minimal` can sometimes be insufficient to allow concretization.
284+
`full` slightly relaxes the constraints that Spack imposes on the environment which can allow concretization.
285+
286+
!!! warning
287+
The `full` strategy is still experimental and may produce surprising concretizations.
288+
In particular, the concretiser will more happily mix compilers using the `full` strategy.
289+
Please check the concretization when using this strategy to make sure it looks as you'd expect.
290+
280291
### Packages
281292

282293
To specify external packages that should be used instead of building them, use the `packages` field.

stackinator/recipe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def __init__(self, args):
145145
"compiler": ["gcc"],
146146
"network": {"mpi": None, "specs": None},
147147
"unify": True,
148+
"duplicates": {"strategy": "minimal"},
148149
"deprecated": False,
149150
"specs": ["squashfs"],
150151
"views": {},

stackinator/schema/environments.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@
4646
"enum": ["when_possible", true, false],
4747
"default": true
4848
},
49+
"duplicates": {
50+
"type": "object",
51+
"required": ["strategy"],
52+
"additionalProperties": false,
53+
"properties": {
54+
"strategy": {
55+
"enum": ["minimal", "full", "none"]
56+
}
57+
},
58+
"default": {
59+
"strategy": "minimal"
60+
}
61+
},
4962
"compiler": {
5063
"type": "array",
5164
"items": {

stackinator/templates/environments.spack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ spack:
77
concretizer:
88
unify: {{ config.unify }}
99
reuse: false
10+
duplicates:
11+
strategy: {{ config.duplicates.strategy }}
1012
specs:
1113
{% for spec in config.specs %}
1214
- '{{ spec }}'

unittests/test_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def test_environments_yaml(yaml_path):
160160

161161
# test defaults were set correctly
162162
assert env["unify"] == True # noqa: E712
163+
assert env["duplicates"]["strategy"] == "minimal"
163164
assert env["packages"] == []
164165
assert env["variants"] == []
165166
assert env["network"] == {"mpi": None, "specs": None}
@@ -179,6 +180,7 @@ def test_environments_yaml(yaml_path):
179180

180181
# test defaults were set correctly
181182
assert env["unify"] == "when_possible"
183+
assert env["duplicates"]["strategy"] == "full"
182184
assert env["packages"] == ["perl", "git"]
183185
assert env["variants"] == ["+mpi", "+cuda"]
184186
assert env["views"] == {"default": None}

unittests/yaml/environments.full.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
full-env:
22
compiler: [gcc]
33
unify: when_possible
4+
duplicates:
5+
strategy: full
46
specs:
57
- osu-micro-benchmarks@5.9
68
- hdf5 +mpi

0 commit comments

Comments
 (0)