Skip to content
Snippets Groups Projects
Commit 9e890e90 authored by Elizabeth's avatar Elizabeth
Browse files

Fixed bug in time/energy storage

parent 6b290187
No related branches found
No related tags found
No related merge requests found
...@@ -126,13 +126,9 @@ class TableGenerator: ...@@ -126,13 +126,9 @@ class TableGenerator:
# Don't need to copy the file over --> can use the original file as a reference # Don't need to copy the file over --> can use the original file as a reference
soc_operations_file = open(soc_operations_file_name, "r") soc_operations_file = open(soc_operations_file_name, "r")
table_file = open(self.__table_filename, "w") table_file = open(table_file_path, "w")
# Read header line to get layer name and # operations in layer
# Get ops in each layer using the dict
# TODO possible for operations in the same layer to not have the same # of cols? # TODO possible for operations in the same layer to not have the same # of cols?
# Need to store a list of all 2nd level dict keys we go through!
# at the very end --> then generate the header and write everything in
curr_line = soc_operations_file.readline().strip() curr_line = soc_operations_file.readline().strip()
...@@ -140,7 +136,7 @@ class TableGenerator: ...@@ -140,7 +136,7 @@ class TableGenerator:
# First line is always the layers line (#layer_name,num_ops) # First line is always the layers line (#layer_name,num_ops)
layer_name, num_ops = self.__parse_layer_info_line(curr_line) layer_name, num_ops = self.__parse_layer_info_line(curr_line)
print("FIRST LINE", layer_name, num_ops) print("FIRST LINE", layer_name, num_ops)
# Get each operation in the layer # Get each operation in the layer
ops_in_layer = [] ops_in_layer = []
header = ["**", layer_name, str(num_ops), "_"] header = ["**", layer_name, str(num_ops), "_"]
...@@ -154,7 +150,7 @@ class TableGenerator: ...@@ -154,7 +150,7 @@ class TableGenerator:
# Iterate through time/energy data for each approx type # Iterate through time/energy data for each approx type
for approx_type in operation_data: for approx_type in operation_data:
curr_op.append(operation_data[approx_type]["time"]) curr_op.append(operation_data[approx_type]["time"])
curr_op.append(operation_data[approx_type]["time"]) curr_op.append(operation_data[approx_type]["energy"])
# CRITICAL ASSUMPTION: All ops within a layer have the same # cols # CRITICAL ASSUMPTION: All ops within a layer have the same # cols
# Only fill out the header once for the layer # Only fill out the header once for the layer
...@@ -164,10 +160,9 @@ class TableGenerator: ...@@ -164,10 +160,9 @@ class TableGenerator:
ops_in_layer.append(' '.join(curr_op)) ops_in_layer.append(' '.join(curr_op))
# Getting all operation rows and then writing everything because # Getting all operation rows and then writing everything because
# calls to write() are slow (memory vs time tradeoff) # calls to write() are slow (memory vs time tradeoff)
#print("%s" % ' '.join(header)) print("%s" % ' '.join(header))
#print("%s" % '\n'.join(ops_in_layer)) print("%s" % '\n'.join(ops_in_layer))
table_file.write("%s\n" % ' '.join(header)) table_file.write("%s\n%s\n" % (' '.join(header), '\n'.join(ops_in_layer)))
table_file.write("%s\n" % '\n'.join(ops_in_layer))
curr_line = soc_operations_file.readline().strip() curr_line = soc_operations_file.readline().strip()
......
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