fix excludes with bcast

This commit is contained in:
Gregory Becker 2023-03-23 10:27:43 -07:00
parent c8c025215d
commit 788ad561bd

View File

@ -199,28 +199,33 @@ def _expand_matrix_constraints(matrix_config):
flat_combo = [constraint for constraint_list in combo for constraint in constraint_list]
flat_combo = [Spec(x) for x in flat_combo]
test_spec = flat_combo[0].copy()
for constraint in flat_combo[1:]:
test_spec.constrain(constraint)
# Abstract variants don't have normal satisfaction semantics
# Convert all variants to concrete types.
# This method is best effort, so all existing variants will be
# converted before any error is raised.
# Catch exceptions because we want to be able to operate on
# abstract specs without needing package information
try:
spack.variant.substitute_abstract_variants(test_spec)
except spack.variant.UnknownVariantError:
pass
if any(test_spec.satisfies(x) for x in excludes):
continue
# If no broadcast, this is [(,)].
# It will run once, as required, and apply no constraints
for broadcast_combo in broadcast_constraints:
final_combo = [_apply_broadcast(spec.copy(), broadcast_combo) for spec in flat_combo]
# Check whether final spec is excluded
# requires constructing a spec from constraints
test_spec = final_combo[0].copy()
for constraint in final_combo[1:]:
test_spec.constrain(constraint)
# Abstract variants don't have normal satisfaction semantics
# Convert all variants to concrete types.
# This method is best effort, so all existing variants will be
# converted before any error is raised.
# Catch exceptions because we want to be able to operate on
# abstract specs without needing package information
try:
spack.variant.substitute_abstract_variants(test_spec)
except spack.variant.UnknownVariantError:
pass
# actual exclusion check is here
if any(test_spec.satisfies(e) for e in excludes):
continue
# Apply sigil if applicable
if sigil:
final_combo[0] = Spec(sigil + str(final_combo[0]))