Skip to content
Snippets Groups Projects
Commit 41ad2b90 authored by Elizabeth's avatar Elizabeth
Browse files

Fixed bug in results file generator

parent bd1f0938
No related branches found
No related tags found
No related merge requests found
...@@ -248,7 +248,6 @@ def run_simulations(config_filename): ...@@ -248,7 +248,6 @@ def run_simulations(config_filename):
prev_layer = curr_layer prev_layer = curr_layer
config_count += 1 config_count += 1
print("\n") print("\n")
config_count += 1 # because we're storing the count and not the index
config_file.close() config_file.close()
...@@ -257,10 +256,8 @@ def display_results(results_filename): ...@@ -257,10 +256,8 @@ def display_results(results_filename):
attributes_to_print = [results_time_key, results_energy_key] attributes_to_print = [results_time_key, results_energy_key]
for attribute in attributes_to_print: for attribute in attributes_to_print:
attribute_data = [] # Store as list and then write to file once bc syscalls are slow results_file.write("%s\n" % attribute)
attribute_data.append(attribute) results_file.write("Configuration,Total,Improvement\n")
attribute_data.append("Configuration,Total,Improvement") # header
baseline_val = aggregate_results[attribute][0] baseline_val = aggregate_results[attribute][0]
print(baseline_val) print(baseline_val)
...@@ -268,18 +265,15 @@ def display_results(results_filename): ...@@ -268,18 +265,15 @@ def display_results(results_filename):
best_result = None best_result = None
for config_ind in range(config_count): for config_ind in range(config_count):
config_data = ["c%d" % config_ind] results_file.write("c%d" % config_ind)
time_or_energy_val = aggregate_results[attribute][config_ind] time_or_energy_val = aggregate_results[attribute][config_ind]
config_data.append(str(time_or_energy_val)) results_file.write(",%f" % time_or_energy_val)
config_data.append(str(baseline_val / (time_or_energy_val + 0.0001))) results_file.write(",%f\n" % (baseline_val / (time_or_energy_val + 0.0001)))
attribute_data.append(','.join(config_data))
if not best_result or time_or_energy_val < best_result: if not best_result or time_or_energy_val < best_result:
best_result = time_or_energy_val best_result = time_or_energy_val
best_config = config_ind best_config = config_ind
attribute_data.append("c%d,%d" % (best_config, aggregate_results[attribute][best_config])) results_file.write("\nc%d,%f\n\n" % (best_config, aggregate_results[attribute][best_config]))
attribute_data.append("") # To add an additional new line
results_file.write('\n'.join(attribute_data))
results_file.close() results_file.close()
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment