Commit 5204925b authored by Justin Borromeo's avatar Justin Borromeo
Browse files

Greedy partition sizing with bsearch results

parent ab01ec1c
...@@ -6,6 +6,7 @@ import path_constant as pc ...@@ -6,6 +6,7 @@ import path_constant as pc
import packing_penalty as pp import packing_penalty as pp
from os import makedirs from os import makedirs
from copy import deepcopy from copy import deepcopy
import csv
class cma_approach(object): class cma_approach(object):
def __init__(self, def __init__(self,
...@@ -349,7 +350,7 @@ class cma_approach(object): ...@@ -349,7 +350,7 @@ class cma_approach(object):
if self.print_to_csv: if self.print_to_csv:
with open(pc.RESULT_CSV_PATH+'cma_logmore_sq.csv', 'a') as csvFile: with open(pc.RESULT_CSV_PATH+'cma_logmore_sq.csv', 'a') as csvFile:
writer = csv.writer(csvFile, delimiter=',', lineterminator="\n") writer = csv.writer(csvFile, delimiter=',', lineterminator="\n")
writer.writerow([self.target_col,self.i,self.k, self.topology_file, 1,(1/max_latency), max_latency*self.k, 1/full_latency[full_max_idx], full_latency[full_max_idx], (1/max_latency)/(1/full_latency[full_max_idx]), (max_latency*self.k)/full_latency[full_max_idx], layer, res, self.end-self.start, self.es.sigma, self.seed_od,self.valid_sampling_percentage, self.trial, self.population_size, self.max_res_unit, self.seeding_type]) writer.writerow([self.target_col,self.i,self.k, self.topology_file, 1, (1/max_latency), max_latency*self.k, 1/full_latency[full_max_idx], full_latency[full_max_idx], (1/max_latency)/(1/full_latency[full_max_idx]), (max_latency*self.k)/full_latency[full_max_idx], layer, res, self.end-self.start, self.es.sigma, self.seed_od,self.valid_sampling_percentage, self.trial, self.population_size, self.max_res_unit, self.seeding_type])
csvFile.close csvFile.close
if self.valid_sampling_percentage > 0: if self.valid_sampling_percentage > 0:
...@@ -369,6 +370,17 @@ class cma_approach(object): ...@@ -369,6 +370,17 @@ class cma_approach(object):
percentage_wasted = 100 * (bin_area - packed_area) / bin_area percentage_wasted = 100 * (bin_area - packed_area) / bin_area
consumed_area = 0 consumed_area = 0
pp.printPNG(res, self.max_pack_size, directory_path + pngFileName) pp.printPNG(res, self.max_pack_size, directory_path + pngFileName)
with open(pc.RESULT_CSV_PATH+'cma_bsearch_sq.csv', 'a') as csvFile:
writer = csv.writer(csvFile, delimiter=',', lineterminator="\n")
writer.writerow([self.k, # number of partitions
self.topology_file, # topology
1/max_latency, # throughput
max_latency, # maximum latency
self.max_res_unit, # number of DSP48 units
pngFileName # output file
])
result = [self.target_col,self.i,self.k, self.topology_file, 1,(1/max_latency), max_latency*self.k, 1/full_latency[full_max_idx], full_latency[full_max_idx], (1/max_latency)/(1/full_latency[full_max_idx]), (max_latency*self.k)/full_latency[full_max_idx], layer, res, self.end-self.start, self.es.sigma, self.seed_od,self.valid_sampling_percentage, self.trial, self.population_size, self.max_res_unit, self.seeding_type] result = [self.target_col,self.i,self.k, self.topology_file, 1,(1/max_latency), max_latency*self.k, 1/full_latency[full_max_idx], full_latency[full_max_idx], (1/max_latency)/(1/full_latency[full_max_idx]), (max_latency*self.k)/full_latency[full_max_idx], layer, res, self.end-self.start, self.es.sigma, self.seed_od,self.valid_sampling_percentage, self.trial, self.population_size, self.max_res_unit, self.seeding_type]
return True, result return True, result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment