fix platform errors
This commit is contained in:
@@ -116,7 +116,6 @@ def build_criteria_names(costs, tuples):
|
||||
"""Construct an ordered mapping from criteria names to costs."""
|
||||
# pull optimization criteria names out of the solution
|
||||
priorities_names = []
|
||||
costs = costs[28:] # first 28 are high-priority error avoiding criteria
|
||||
|
||||
num_fixed = 0
|
||||
for pred, args in tuples:
|
||||
@@ -126,10 +125,6 @@ def build_criteria_names(costs, tuples):
|
||||
priority, name = args[:2]
|
||||
priority = int(priority)
|
||||
|
||||
if priority >= 1000:
|
||||
# We don't print the error-avoiding criteria
|
||||
continue
|
||||
|
||||
# add the priority of this opt criterion and its name
|
||||
priorities_names.append((priority, name))
|
||||
|
||||
@@ -145,7 +140,10 @@ def build_criteria_names(costs, tuples):
|
||||
# sort the criteria by priority
|
||||
priorities_names = sorted(priorities_names, reverse=True)
|
||||
|
||||
assert len(priorities_names) == len(costs), "Wrong number of optimization criteria!"
|
||||
# We only have opt-criterion values for non-error types
|
||||
# error type criteria are excluded (they come first)
|
||||
error_criteria = len(costs) - len(priorities_names)
|
||||
costs = costs[error_criteria:]
|
||||
|
||||
# split list into three parts: build criteria, fixed criteria, non-build criteria
|
||||
num_criteria = len(priorities_names)
|
||||
@@ -540,7 +538,7 @@ def fact(self, head):
|
||||
# Only functions relevant for constructing good error messages are
|
||||
# assumptions, and only when using cores.
|
||||
choice = self.cores and symbol.name in self.assumption_names
|
||||
choice = False
|
||||
# choice = False
|
||||
self.backend.add_rule([atom], [], choice=choice)
|
||||
if choice:
|
||||
self.assumptions.append(atom)
|
||||
@@ -2061,6 +2059,13 @@ def compiler_os_mismatch(self, pkg, compiler, version, os):
|
||||
msg = "%s compiler %s@%s incompatible with os %s" % (pkg, compiler, version, os)
|
||||
raise spack.error.SpackError(msg)
|
||||
|
||||
def no_platform(self, pkg):
|
||||
raise spack.error.SpackError("No satisfiable platform found for %s" % pkg)
|
||||
|
||||
def multiple_platforms(self, pkg, platform1, platform2):
|
||||
msg = "%s requires incompatible platforms %s and %s" % (pkg, platform1, platform2)
|
||||
raise spack.error.SpackError(msg)
|
||||
|
||||
def variant_value(self, pkg, name, value):
|
||||
# FIXME: is there a way not to special case 'dev_path' everywhere?
|
||||
if name == 'dev_path':
|
||||
|
||||
@@ -15,7 +15,17 @@
|
||||
%:- not 1 { version(Package, _) } 1, node(Package).
|
||||
|
||||
% each node must have a single platform, os and target
|
||||
:- not 1 { node_platform(Package, _) } 1, node(Package), internal_error("A node must have exactly one platform").
|
||||
%:- not 1 { node_platform(Package, _) } 1, node(Package), internal_error("A node must have exactly one platform").
|
||||
no_platform(Package)
|
||||
:- node(Package),
|
||||
C = #count{ Platform : node_platform(Package, Platform)},
|
||||
C < 1.
|
||||
multiple_platforms(Package, Platform1, Platform2)
|
||||
:- node(Package),
|
||||
node_platform(Package, Platform1),
|
||||
node_platform(Package, Platform2),
|
||||
Platform1 < Platform2.
|
||||
|
||||
:- not 1 { node_os(Package, _) } 1, node(Package).
|
||||
:- not 1 { node_target(Package, _) } 1, node(Package).
|
||||
|
||||
@@ -989,118 +999,96 @@ build_priority(Package, 0) :- node(Package), not optimize_for_reuse().
|
||||
% Some errors are handled as rules instead of constraints because
|
||||
% it allows us to explain why something failed. Here we optimize
|
||||
% HEAVILY against the facts generated by those rules.
|
||||
opt_criterion(1000, "errors").
|
||||
#minimize{ 0@1000: #true }.
|
||||
#minimize{ 1000@1000,Msg: conflict_triggered(Msg) }.
|
||||
|
||||
opt_criterion(1001, "errors").
|
||||
#minimize{ 0@1001: #true }.
|
||||
#minimize{ 1000@1001,Package,Variant,Value1,Value2: multiple_values_sv_variant(Package, Variant, Value1, Value2) }.
|
||||
|
||||
opt_criterion(1002, "errors").
|
||||
#minimize{ 0@1002: #true }.
|
||||
#minimize{ 1000@1002,Package,Variant: no_variant_value(Package, Variant) }.
|
||||
|
||||
opt_criterion(1003, "errors").
|
||||
#minimize{ 0@1003: #true }.
|
||||
#minimize{ 1000@1003,Package,Variant,Value: invalid_variant_value(Package, Variant, Value) }.
|
||||
|
||||
opt_criterion(1004, "errors").
|
||||
#minimize{ 0@1004: #true }.
|
||||
#minimize{ 1000@1004,Package : no_version(Package) }.
|
||||
|
||||
opt_criterion(1005, "errors").
|
||||
#minimize{ 0@1005: #true }.
|
||||
#minimize{ 1000@1005,Package,Version1,Version2 : versions_conflict(Package, Version1, Version2) }.
|
||||
|
||||
opt_criterion(1006, "errors").
|
||||
#minimize{ 0@1006: #true }.
|
||||
#minimize{ 1000@1006,Package,Constraint : version_unsatisfiable(Package, Constraint) }.
|
||||
|
||||
opt_criterion(1007, "errors").
|
||||
#minimize{ 0@1007: #true }.
|
||||
#minimize{ 1000@1007,Package : unnecessary(Package) }.
|
||||
|
||||
opt_criterion(1008, "errors").
|
||||
#minimize{ 0@1008: #true }.
|
||||
#minimize{ 1000@1008,Package1,Package2 : cyclic_dependency(Package1, Package2) }.
|
||||
|
||||
opt_criterion(1009, "errors").
|
||||
#minimize{ 0@1009: #true }.
|
||||
#minimize{ 1000@1009,Virtual : no_provider(Virtual) }.
|
||||
|
||||
opt_criterion(1010, "errors").
|
||||
#minimize{ 0@1010: #true }.
|
||||
#minimize{ 1000@1010,Virtual,Package1,Package2 : multiple_providers(Virtual, Package1, Package2) }.
|
||||
|
||||
opt_criterion(1011, "errors").
|
||||
#minimize{ 0@1011: #true }.
|
||||
#minimize{ 1000@1011,Package : invalid_external_spec(Package) }.
|
||||
|
||||
opt_criterion(1012, "errors").
|
||||
#minimize{ 0@1012: #true }.
|
||||
#minimize{ 1000@1012,Package,Variant : inactive_variant_set(Package, Variant) }.
|
||||
|
||||
opt_criterion(1013, "errors").
|
||||
#minimize{ 0@1013: #true }.
|
||||
#minimize{ 1000@1013,Package,Variant,Value1,Value2 : disjoint_variant_values(Package, Variant, Value1, Value2) }.
|
||||
|
||||
opt_criterion(1014, "errors").
|
||||
#minimize{ 0@1014: #true }.
|
||||
#minimize{ 1000@1014,Package,Variant,Value : variant_none_and_other(Package, Variant, Value) }.
|
||||
|
||||
opt_criterion(1015, "errors").
|
||||
#minimize{ 0@1015: #true }.
|
||||
#minimize{ 1000@1015,Package : no_os(Package) }.
|
||||
|
||||
opt_criterion(1016, "errors").
|
||||
#minimize{ 0@1016: #true }.
|
||||
#minimize{ 1000@1016,Package,OS1,OS2 : multiple_os(Package, OS1, OS2) }.
|
||||
|
||||
opt_criterion(1017, "errors").
|
||||
#minimize{ 0@1017: #true }.
|
||||
#minimize{ 1000@1017,Package,OS : os_not_buildable(Package, OS) }.
|
||||
|
||||
opt_criterion(1018, "errors").
|
||||
#minimize{ 0@1018: #true }.
|
||||
#minimize{ 1000@1018,Package,Dependency,POS,DOS : os_incompatible(Package, Dependency, POS, DOS) }.
|
||||
|
||||
opt_criterion(1019, "errors").
|
||||
#minimize{ 0@1019: #true }.
|
||||
#minimize{ 1000@1019,Package : no_target(Package) }.
|
||||
|
||||
opt_criterion(1020, "errors").
|
||||
#minimize{ 0@1020: #true }.
|
||||
#minimize{ 1000@1020,Package,Target1, Target2 : multiple_targets(Package, Target1, Target2) }.
|
||||
|
||||
opt_criterion(1021, "errors").
|
||||
#minimize{ 0@1021: #true }.
|
||||
#minimize{ 1000@1021,Package,Target,Constraint : target_unsatisfiable(Package, Target, Constraint) }.
|
||||
|
||||
opt_criterion(1022, "errors").
|
||||
#minimize{ 0@1022: #true }.
|
||||
#minimize{ 1000@1022,Package,Dependency : target_incompatible(Package, Dependency) }.
|
||||
|
||||
opt_criterion(1023, "errors").
|
||||
#minimize{ 0@1023: #true }.
|
||||
#minimize{ 1000@1023,Package,Target,Compiler,Version : compiler_target_mismatch(Package, Target, Compiler, Version) }.
|
||||
|
||||
opt_criterion(1024, "errors").
|
||||
#minimize{ 0@1024: #true }.
|
||||
#minimize{ 1000@1024,Package,Target : invalid_target(Package, Target) }.
|
||||
|
||||
opt_criterion(1025, "errors").
|
||||
#minimize{ 0@1025: #true }.
|
||||
#minimize{ 1000@1025,Package : no_compiler_version(Package) }.
|
||||
|
||||
opt_criterion(1026, "errors").
|
||||
#minimize{ 0@1026: #true }.
|
||||
#minimize{ 1000@1026,Package,Compiler1,Version1,Compiler2,Version2 : multiple_compiler_versions(Package, Compiler1, Version1, Compiler2, Version2) }.
|
||||
|
||||
opt_criterion(1027, "errors").
|
||||
#minimize{ 0@1027: #true }.
|
||||
#minimize{ 1000@1027,Package,Compiler,Version,OS : compiler_os_mismatch(Package, Compiler, Version, OS) }.
|
||||
|
||||
#minimize{ 0@1028: #true }.
|
||||
#minimize{ 1000@1028,Package : no_platform(Package) }.
|
||||
|
||||
#minimize{ 0@1029: #true }.
|
||||
#minimize{ 1000@1029,Package,Platform1,Platform2 : multiple_platforms(Package, Platform1, Platform2) }.
|
||||
|
||||
%-----------------------------------------------------------------------------
|
||||
% How to optimize the spec (high to low priority)
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
@@ -64,5 +64,7 @@
|
||||
#show no_compiler_version/1.
|
||||
#show multiple_compiler_versions/5.
|
||||
#show compiler_os_mismatch/4.
|
||||
#show no_platform/1.
|
||||
#show multiple_platforms/3.
|
||||
|
||||
% debug
|
||||
|
||||
Reference in New Issue
Block a user