summaryrefslogtreecommitdiff
path: root/scripts/database
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-11-06 21:59:45 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-11-06 21:59:45 +0100
commit33ac2b0175f3e57bca4638302ef0ff4cebdde4d8 (patch)
tree128617120cc6e2d2c67a3cc83c5ee4c3c6ac80d6 /scripts/database
parent34a33b54cf6c395468ba230057b3c9e1dada9fb7 (diff)
Improved the way the database defaults are computed
Diffstat (limited to 'scripts/database')
-rw-r--r--scripts/database/database/bests.py10
-rw-r--r--scripts/database/database/defaults.py5
2 files changed, 8 insertions, 7 deletions
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