From 33ac2b0175f3e57bca4638302ef0ff4cebdde4d8 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Mon, 6 Nov 2017 21:59:45 +0100 Subject: Improved the way the database defaults are computed --- scripts/database/database/bests.py | 10 +++++----- scripts/database/database/defaults.py | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/database/database/bests.py b/scripts/database/database/bests.py index c924efde..8ea8b48a 100644 --- a/scripts/database/database/bests.py +++ b/scripts/database/database/bests.py @@ -38,17 +38,17 @@ def get_relative_bests(name, common_results, common_parameters, verbose=False): """Retrieves the parameters with the relative best execution time over different devices""" # Helper function - def argmax(iterable): - return max(enumerate(iterable), key=lambda x: x[1])[0] + def argmin(iterable): + return min(enumerate(iterable), key=lambda x: x[1])[0] # Computes the sum of the execution times over the different devices performance_sums = [] for parameters in common_parameters: - performance_sum = sum([r["relative_performance"] for r in common_results if r["parameters"] == parameters]) + performance_sum = sum([r["relative_time"] for r in common_results if r["parameters"] == parameters]) performance_sums.append(performance_sum) - # Retrieves the entry with the highest performance - best_index = argmax(performance_sums) + # Retrieves the entry with the lowest time + best_index = argmin(performance_sums) best_performance = performance_sums[best_index] best_parameters = common_parameters[best_index] diff --git a/scripts/database/database/defaults.py b/scripts/database/database/defaults.py index 6042c374..d9e58253 100644 --- a/scripts/database/database/defaults.py +++ b/scripts/database/database/defaults.py @@ -62,7 +62,7 @@ def add_default_sections(database, grouping, verbose, values_dict, condition, en assert len(group) > 0 if condition(group[0]): - # Stores all the section's data + # Stores all the section's data default_section = {} for attribute in group[0].keys(): if attribute != "results" and attribute != "group_identifier": @@ -180,7 +180,8 @@ def get_common_best_parameters(group, group_identifier, verbose, enable_warning) assert len(section["results"]) > 0 minimum_time = min([result["time"] for result in section["results"]]) for result in section["results"]: - result["relative_performance"] = minimum_time / result["time"] + base_line = minimum_time if section["kernel"] != "gemm_kernel_selection" else 1.0 + result["relative_time"] = result["time"] / base_line # Determine which parameters are available for all devices common_parameters = get_parameter_names(group[0]) # Parameters of the first section -- cgit v1.2.3