Commit d5d06703 authored by LongChan's avatar LongChan
Browse files

fix brute force

parent 6a554713
......@@ -32,9 +32,21 @@ The instruction below will do a sweep run on each of the following networks:
- NCF_rec
- Resnet_50_v1
To run individual
To obtain individual optimization result for a specific network and a specfic number of partition, please refer to the section below.
To get optimization result with
1. CMA-es
```bash
# cd optimization_algo/scripts
# ./sweep_nets_cma.sh
```
1. GA
```bash
# cd optimization_algo/scripts
# ./sweep_nets_cma.sh
```
1. CMA
```bash
# cd optimization_algo/scripts
......@@ -44,7 +56,7 @@ To get optimization result with
2. Brute Force
```bash
# cd optimization_algo/scripts
# ./sweep_nets_.sh
# ./sweep_nets_brute.sh
```
#### Custom topologies
......
......@@ -40,7 +40,7 @@ class brute_force(object):
def parse_topology_file(self):
layers = []
with open(self.topology_file, 'r') as f:
with open(pc.TOPOLOGIES_PATH+self.topology_file, 'r') as f:
next(f)
for line in f:
elems = line.strip().split(',')
......@@ -53,7 +53,7 @@ class brute_force(object):
def parse_data_set_file(self, path_to_data_csv):
first = True
target_idx = 2
with open(path_to_data_csv, 'r') as f:
with open(pc.DATA_SOURCE_PATH+path_to_data_csv, 'r') as f:
for line in f:
elems = line.strip().split(',')
# #print(elems)
......@@ -151,7 +151,7 @@ class brute_force(object):
print("Throughtput Ratio:", (1/max_latency)/(1/full_latency[full_max_idx]))
print("Latency increase:", (max_latency*self.k)/full_latency[full_max_idx])
with open('bruteforce.csv', 'a') as csvFile:
with open(pc.RESULT_CSV_PATH+'bruteforce.csv', 'a') as csvFile:
writer = csv.writer(csvFile, delimiter=',', lineterminator="\n")
writer.writerow([self.target_col,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.max_res_unit])
csvFile.close
......
......@@ -73,4 +73,4 @@ DRAM_cycle,3,resnet_50_v1.csv,1,4.087420106264748e-07,7339593,1.4298863111692853
DRAM_cycle,4,resnet_50_v1.csv,1,5.277404108248002e-07,7579484,1.4298863111692853e-07,6993563,3.6907858107491225,1.083780041732662,"[['Conv1', 'CB2a_1', 'CB2a_2', 'CB2a_3', 'CB2s', 'IB2b_1', 'IB2b_2', 'IB2b_3', 'IB2c_1', 'IB2c_2'], ['IB2c_3', 'CB3a_1', 'CB3a_2', 'CB3a_3', 'CB3s', 'IB3b_1', 'IB3b_2', 'IB3b_3', 'IB3c_1', 'IB3c_2', 'IB3c_3', 'IB3d_1', 'IB3d_2', 'IB3d_3', 'CB4a_1', 'CB4a_2', 'CB4a_3', 'CB4s', 'IB4b_1'], ['IB4b_2', 'IB4b_3', 'IB4c_1', 'IB4c_2', 'IB4c_3', 'IB4d_1', 'IB4d_2', 'IB4d_3', 'IB4e_1', 'IB4e_2', 'IB4e_3', 'IB4f_1', 'IB4f_2', 'IB4f_3', 'CB5a_1', 'CB5a_2', 'CB5a_3'], ['CB5s', 'IB5b_1', 'IB5b_2', 'IB5b_3', 'IB5c_1', 'IB5c_2', 'IB5c_3', 'FC6']]","[192, 256, 256, 256]",464.60842990875244,960
DRAM_cycle,5,resnet_50_v1.csv,1,6.295219347475334e-07,7942535,1.4298863111692853e-07,6993563,4.402601310538763,1.135692207248294,"[['Conv1', 'CB2a_1', 'CB2a_2', 'CB2a_3', 'CB2s', 'IB2b_1', 'IB2b_2', 'IB2b_3'], ['IB2c_1', 'IB2c_2', 'IB2c_3', 'CB3a_1', 'CB3a_2', 'CB3a_3', 'CB3s', 'IB3b_1', 'IB3b_2', 'IB3b_3', 'IB3c_1', 'IB3c_2'], ['IB3c_3', 'IB3d_1', 'IB3d_2', 'IB3d_3', 'CB4a_1', 'CB4a_2', 'CB4a_3', 'CB4s', 'IB4b_1', 'IB4b_2', 'IB4b_3', 'IB4c_1', 'IB4c_2', 'IB4c_3', 'IB4d_1', 'IB4d_2', 'IB4d_3'], ['IB4e_1', 'IB4e_2', 'IB4e_3', 'IB4f_1', 'IB4f_2', 'IB4f_3', 'CB5a_1', 'CB5a_2', 'CB5a_3', 'CB5s', 'IB5b_1'], ['IB5b_2', 'IB5b_3', 'IB5c_1', 'IB5c_2', 'IB5c_3', 'FC6']]","[86, 171, 319, 256, 128]",5737.337114095688,960
DRAM_cycle,6,resnet_50_v1.csv,1,7.256198970780738e-07,8268792,1.4298863111692853e-07,6993563,5.074668464269025,1.1823432490706096,"[['Conv1', 'CB2a_1', 'CB2a_2', 'CB2a_3', 'CB2s', 'IB2b_1', 'IB2b_2'], ['IB2b_3', 'IB2c_1', 'IB2c_2', 'IB2c_3', 'CB3a_1', 'CB3a_2', 'CB3a_3', 'CB3s', 'IB3b_1', 'IB3b_2'], ['IB3b_3', 'IB3c_1', 'IB3c_2', 'IB3c_3', 'IB3d_1', 'IB3d_2', 'IB3d_3', 'CB4a_1', 'CB4a_2', 'CB4a_3', 'CB4s', 'IB4b_1'], ['IB4b_2', 'IB4b_3', 'IB4c_1', 'IB4c_2', 'IB4c_3', 'IB4d_1', 'IB4d_2', 'IB4d_3', 'IB4e_1', 'IB4e_2', 'IB4e_3', 'IB4f_1', 'IB4f_2', 'IB4f_3', 'CB5a_1'], ['CB5a_2', 'CB5a_3', 'CB5s', 'IB5b_1', 'IB5b_2'], ['IB5b_3', 'IB5c_1', 'IB5c_2', 'IB5c_3', 'FC6']]","[86, 233, 128, 256, 171, 86]",42041.326051712036,960
DRAM_cycle,7,resnet_50_v1.csv,1,8.114248620577734e-07,8626800,1.4298863111692853e-07,6993563,5.6747508925673475,1.233534322919519,"[['Conv1', 'CB2a_1', 'CB2a_2', 'CB2a_3', 'CB2s', 'IB2b_1'], ['IB2b_2', 'IB2b_3', 'IB2c_1', 'IB2c_2', 'IB2c_3', 'CB3a_1'], ['CB3a_2', 'CB3a_3', 'CB3s', 'IB3b_1', 'IB3b_2', 'IB3b_3', 'IB3c_1', 'IB3c_2', 'IB3c_3', 'IB3d_1', 'IB3d_2'], ['IB3d_3', 'CB4a_1', 'CB4a_2', 'CB4a_3', 'CB4s', 'IB4b_1', 'IB4b_2', 'IB4b_3', 'IB4c_1', 'IB4c_2', 'IB4c_3', 'IB4d_1', 'IB4d_2'], ['IB4d_3', 'IB4e_1', 'IB4e_2', 'IB4e_3', 'IB4f_1', 'IB4f_2', 'IB4f_3', 'CB5a_1', 'CB5a_2'], ['CB5a_3', 'CB5s', 'IB5b_1', 'IB5b_2'], ['IB5b_3', 'IB5c_1', 'IB5c_2', 'IB5c_3', 'FC6']]","[64, 64, 174, 256, 171, 103, 128]",294675.27332925797,960
DRAM_cycle,7,resnet_50_v1.csv,1,8.114248620577734e-07,8626800,1.4298863111692853e-07,6993563,5.6747508925673475,1.233534322919519,"[['Conv1', 'CB2a_1', 'CB2a_2', 'CB2a_3', 'CB2s', 'IB2b_1'], ['IB2b_2', 'IB2b_3', 'IB2c_1', 'IB2c_2', 'IB2c_3', 'CB3a_1'], ['CB3a_2', 'CB3a_3', 'CB3s', 'IB3b_1', 'IB3b_2', 'IB3b_3', 'IB3c_1', 'IB3c_2', 'IB3c_3', 'IB3d_1', 'IB3d_2'], ['IB3d_3', 'CB4a_1', 'CB4a_2', 'CB4a_3', 'CB4s', 'IB4b_1', 'IB4b_2', 'IB4b_3', 'IB4c_1', 'IB4c_2', 'IB4c_3', 'IB4d_1', 'IB4d_2'], ['IB4d_3', 'IB4e_1', 'IB4e_2', 'IB4e_3', 'IB4f_1', 'IB4f_2', 'IB4f_3', 'CB5a_1', 'CB5a_2'], ['CB5a_3', 'CB5s', 'IB5b_1', 'IB5b_2'], ['IB5b_3', 'IB5c_1', 'IB5c_2', 'IB5c_3', 'FC6']]","[64, 64, 174, 256, 171, 103, 128]",294675.27332925797,960
\ No newline at end of file
......@@ -4,6 +4,8 @@
declare -a layers=(46 27 10 58 8 8 8 53)
declare -a max_partitions=(7 7 7 7 7 7 7 7)
# this script is designed to be use
# with tmux to use multi-processing
net=$1
for partitions in `seq 2 ${max_partitions[$i]}`;
do
......@@ -12,7 +14,7 @@ do
for target in DRAM_cycle;
do
echo $net $partitions $target
python3 brute_force_approach.py \
python3 ../approaches/brute_force_approach.py \
${net} \
${partitions} \
${res_unit} \
......
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