Skip to content

Commit

Permalink
Merge bfb95a1 into 50a2ed7
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Aug 6, 2019
2 parents 50a2ed7 + bfb95a1 commit e368b37
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions pacman/operations/algorithm_reports/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,28 +747,48 @@ def generate_comparison_router_report(
progress = ProgressBar(
routing_tables.routing_tables,
"Generating comparison of router table report")
total_uncompressed = 0
total_compressed = 0
max_compressed = 0
uncompressed_for_max = None
for table in progress.over(routing_tables.routing_tables):
_write_one_router_table_comparison(
f, table, compressed_routing_tables)
x = table.x
y = table.y
compressed_table = compressed_routing_tables.\
get_routing_table_for_chip(x, y)
n_entries_uncompressed = table.number_of_entries
total_uncompressed += n_entries_uncompressed
n_entries_compressed = compressed_table.number_of_entries
total_compressed += n_entries_compressed
ratio = ((n_entries_uncompressed - n_entries_compressed) /
float(n_entries_uncompressed))
f.write(
"Uncompressed table at {}:{} has {} entries "
"whereas compressed table has {} entries. "
"This is a decrease of {} %\n".format(
x, y, n_entries_uncompressed, n_entries_compressed,
ratio * 100))
if max_compressed < n_entries_compressed:
max_compressed = n_entries_compressed
uncompressed_for_max = n_entries_uncompressed
ratio = ((total_uncompressed - total_compressed) /
float(total_uncompressed))
f.write(
"Total has {} entries whereas compressed tables "
"have {} entries. This is an average decrease of {} %\n "
"".format(
total_uncompressed, total_compressed, ratio * 100))
ratio = ((uncompressed_for_max - max_compressed) /
float(uncompressed_for_max))
f.write(
"Worst has {} entries whereas compressed tables "
"have {} entries. This is a decrease of {} %\n ".format(
uncompressed_for_max, max_compressed, ratio * 100))
except IOError:
logger.exception("Generate_router_comparison_reports: Can't open file"
" {} for writing.", file_name)


def _write_one_router_table_comparison(f, table, compressed_tables):
x = table.x
y = table.y
compressed_table = compressed_tables.get_routing_table_for_chip(x, y)
n_entries_uncompressed = table.number_of_entries
n_entries_compressed = compressed_table.number_of_entries
ratio = ((n_entries_uncompressed - n_entries_compressed) /
float(n_entries_uncompressed))
f.write(
"Uncompressed table at {}:{} has {} entries whereas compressed table "
"has {} entries. This is a decrease of {} %\n".format(
x, y, n_entries_uncompressed, n_entries_compressed, ratio * 100))


def _reduce_route_value(processors_ids, link_ids):
value = 0
for link in link_ids:
Expand Down

0 comments on commit e368b37

Please sign in to comment.