Commit 92805833 authored by Justin Borromeo's avatar Justin Borromeo
Browse files

.

parent e5bba5ce
......@@ -4,7 +4,7 @@ from os import cpu_count
import time
import path_constant as pc
import packing_penalty as pp
import csv
class cma_approach(object):
def __init__(self,
# data path
......@@ -162,19 +162,18 @@ class cma_approach(object):
def eva_hybird_sq(self, layer):
res = [self.res_step] * self.k
latencies = []
while sum([r*r for r in res]) < self.max_res_unit:
done = False
while sum([r*r for r in res]) < self.max_res_unit and not done:
latencies, max_idx = self.find_max_latency(layer, res)
res[max_idx] += self.res_step
if (sum([r*r for r in res])) > self.max_res_unit:
res[max_idx] -= self.res_step
done = True
# for i in range(0, int(self.max_res_unit/self.res_step - self.k*self.res_step)):
# latencies, max_idx = self.find_max_latency(layer, res)
# res[max_idx] += self.res_step
if pp.packingPenalty(res, self.max_pack_size):
return latencies[max_idx], latencies, res, layer
return self.penalty_offest, latencies, res, layer
return latencies[max_idx], latencies, res, layer
def evaluation_top_level(self, in_val):
pid, sampling = in_val
......@@ -331,10 +330,22 @@ class cma_approach(object):
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
with open(pc.RESULT_CSV_PATH+'cma_unconstrained_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
"no_png" # output file
])
"""
if self.valid_sampling_percentage > 0:
pngFileName = str(self.topology_file.replace(".csv", "")) + "_k=" + str(self.k) + "_max=" + str(self.max_res_unit) + "_packSize=" + str(self.max_pack_size) + ".png"
pp.printPNG(res, self.max_pack_size, pngFileName)
"""
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
......
......@@ -5,14 +5,14 @@ import path_constant as pc
import cma_approach_square_size as ap
nets = [
# ('FasterRCNN', 46, 23),
# ('mobilenet', 27, 14),
# ('yolo_tiny', 10, 9),
('FasterRCNN', 46, 23),
('mobilenet', 27, 14),
('yolo_tiny', 10, 9),
('googlenet', 58, 29),
# ('alexnet', 8, 8),
# ('AlphaGoZero', 8, 8),
# ('ncf_rec', 8, 8),
# ('resnet_50_v1', 53, 27)
('alexnet', 8, 8),
('AlphaGoZero', 8, 8),
('ncf_rec', 8, 8),
('resnet_50_v1', 53, 27)
]
max_res_sizes = [
......
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