Skip to content

Commit

Permalink
fix(autotuner): consider result validity in plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrothenberger committed Oct 23, 2024
1 parent 75017e3 commit a0dbd6a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions discopop_library/EmpiricalAutotuning/Autotuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_unique_configuration_id() -> int:

def run(arguments: AutotunerArguments) -> None:
logger.info("Starting discopop autotuner.")
debug_stats: List[Tuple[List[SUGGESTION_ID], float, int, str]] = []
debug_stats: List[Tuple[List[SUGGESTION_ID], float, int, bool, str]] = []
statistics_graph = StatisticsGraph()
statistics_step_num = 0

Expand All @@ -57,6 +57,7 @@ def run(arguments: AutotunerArguments) -> None:
[],
cast(ExecutionResult, reference_configuration.execution_result).runtime,
cast(ExecutionResult, reference_configuration.execution_result).return_code,
cast(ExecutionResult, reference_configuration.execution_result).result_valid,
reference_configuration.root_path,
)
)
Expand Down Expand Up @@ -149,6 +150,7 @@ def run(arguments: AutotunerArguments) -> None:
current_config,
cast(ExecutionResult, tmp_config.execution_result).runtime,
cast(ExecutionResult, tmp_config.execution_result).return_code,
cast(ExecutionResult, tmp_config.execution_result).result_valid,
tmp_config.root_path,
)
)
Expand Down Expand Up @@ -231,10 +233,20 @@ def run(arguments: AutotunerArguments) -> None:

# show debug stats
stats_str = "Configuration measurements:\n"
stats_str += "[time]\t[applied suggestions]\t[return code]\t[path]\n"
for stats in sorted(debug_stats, key=lambda x: x[1], reverse=True):
stats_str += "[time]\t[applied suggestions]\t[return code]\t[result valid]\t[path]\n"
for stats in sorted(debug_stats, key=lambda x: (x[1]), reverse=True):
stats_str += (
str(round(stats[1], 3)) + "s" + "\t" + str(stats[0]) + "\t" + str(stats[2]) + "\t" + str(stats[3]) + "\n"
str(round(stats[1], 3))
+ "s"
+ "\t"
+ str(stats[0])
+ "\t"
+ str(stats[2])
+ "\t"
+ str(stats[3])
+ "\t"
+ str(stats[4])
+ "\n"
)
logger.info(stats_str)

Expand All @@ -255,6 +267,8 @@ def run(arguments: AutotunerArguments) -> None:
for stats in sorted(debug_stats, key=lambda x: x[1], reverse=False):
if str(stats[2]) != "0":
continue
if stats[3] == False: # skip invalid results
continue
f.write(str(stats[0]) + "; " + str(round(stats[1], 3)) + "; " + str(stats[2]) + ";" + "\n")
break

Expand Down

0 comments on commit a0dbd6a

Please sign in to comment.