solver: do not punish explicitly requested compiler mismatches (#30074)
This commit is contained in:
parent
258edf7dac
commit
52cc798948
2 changed files with 29 additions and 1 deletions
|
@ -44,6 +44,8 @@ node_flag_set(Package, Flag, Value) :- attr("node_flag_set", Package, Flag, Val
|
||||||
|
|
||||||
node_compiler_version_set(Package, Compiler, Version)
|
node_compiler_version_set(Package, Compiler, Version)
|
||||||
:- attr("node_compiler_version_set", Package, Compiler, Version).
|
:- attr("node_compiler_version_set", Package, Compiler, Version).
|
||||||
|
node_compiler_set(Package, Compiler)
|
||||||
|
:- attr("node_compiler_set", Package, Compiler).
|
||||||
|
|
||||||
variant_default_value_from_cli(Package, Variant, Value)
|
variant_default_value_from_cli(Package, Variant, Value)
|
||||||
:- attr("variant_default_value_from_cli", Package, Variant, Value).
|
:- attr("variant_default_value_from_cli", Package, Variant, Value).
|
||||||
|
@ -1011,6 +1013,12 @@ compiler_match(Package, Dependency)
|
||||||
|
|
||||||
compiler_mismatch(Package, Dependency)
|
compiler_mismatch(Package, Dependency)
|
||||||
:- depends_on(Package, Dependency),
|
:- depends_on(Package, Dependency),
|
||||||
|
not node_compiler_set(Dependency, _),
|
||||||
|
not compiler_match(Package, Dependency).
|
||||||
|
|
||||||
|
compiler_mismatch_required(Package, Dependency)
|
||||||
|
:- depends_on(Package, Dependency),
|
||||||
|
node_compiler_set(Dependency, _),
|
||||||
not compiler_match(Package, Dependency).
|
not compiler_match(Package, Dependency).
|
||||||
|
|
||||||
#defined node_compiler_set/2.
|
#defined node_compiler_set/2.
|
||||||
|
@ -1282,7 +1290,7 @@ opt_criterion(45, "preferred providers (non-roots)").
|
||||||
}.
|
}.
|
||||||
|
|
||||||
% Try to minimize the number of compiler mismatches in the DAG.
|
% Try to minimize the number of compiler mismatches in the DAG.
|
||||||
opt_criterion(40, "compiler mismatches").
|
opt_criterion(40, "compiler mismatches that are not from CLI").
|
||||||
#minimize{ 0@240: #true }.
|
#minimize{ 0@240: #true }.
|
||||||
#minimize{ 0@40: #true }.
|
#minimize{ 0@40: #true }.
|
||||||
#minimize{
|
#minimize{
|
||||||
|
@ -1291,6 +1299,15 @@ opt_criterion(40, "compiler mismatches").
|
||||||
build_priority(Package, Priority)
|
build_priority(Package, Priority)
|
||||||
}.
|
}.
|
||||||
|
|
||||||
|
opt_criterion(39, "compiler mismatches that are not from CLI").
|
||||||
|
#minimize{ 0@239: #true }.
|
||||||
|
#minimize{ 0@39: #true }.
|
||||||
|
#minimize{
|
||||||
|
1@39+Priority,Package,Dependency
|
||||||
|
: compiler_mismatch_required(Package, Dependency),
|
||||||
|
build_priority(Package, Priority)
|
||||||
|
}.
|
||||||
|
|
||||||
% Try to minimize the number of compiler mismatches in the DAG.
|
% Try to minimize the number of compiler mismatches in the DAG.
|
||||||
opt_criterion(35, "OS mismatches").
|
opt_criterion(35, "OS mismatches").
|
||||||
#minimize{ 0@235: #true }.
|
#minimize{ 0@235: #true }.
|
||||||
|
|
|
@ -352,6 +352,17 @@ def test_concretize_propagate_compiler_flag_not_passed_to_dependent(self):
|
||||||
assert set(spec.compiler_flags["cflags"]) == set(["-g"])
|
assert set(spec.compiler_flags["cflags"]) == set(["-g"])
|
||||||
assert spec.satisfies("^openblas cflags='-O3'")
|
assert spec.satisfies("^openblas cflags='-O3'")
|
||||||
|
|
||||||
|
def test_mixing_compilers_only_affects_subdag(self):
|
||||||
|
spack.config.set("packages:all:compiler", ["clang", "gcc"])
|
||||||
|
spec = Spec("dt-diamond%gcc ^dt-diamond-bottom%clang").concretized()
|
||||||
|
for dep in spec.traverse():
|
||||||
|
assert ("%clang" in dep) == (dep.name == "dt-diamond-bottom")
|
||||||
|
|
||||||
|
def test_compiler_inherited_upwards(self):
|
||||||
|
spec = Spec("dt-diamond ^dt-diamond-bottom%clang").concretized()
|
||||||
|
for dep in spec.traverse():
|
||||||
|
assert "%clang" in dep
|
||||||
|
|
||||||
def test_architecture_inheritance(self):
|
def test_architecture_inheritance(self):
|
||||||
"""test_architecture_inheritance is likely to fail with an
|
"""test_architecture_inheritance is likely to fail with an
|
||||||
UnavailableCompilerVersionError if the architecture is concretized
|
UnavailableCompilerVersionError if the architecture is concretized
|
||||||
|
|
Loading…
Reference in a new issue