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: ...@@ -32,9 +32,21 @@ The instruction below will do a sweep run on each of the following networks:
- NCF_rec - NCF_rec
- Resnet_50_v1 - 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 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 1. CMA
```bash ```bash
# cd optimization_algo/scripts # cd optimization_algo/scripts
...@@ -44,7 +56,7 @@ To get optimization result with ...@@ -44,7 +56,7 @@ To get optimization result with
2. Brute Force 2. Brute Force
```bash ```bash
# cd optimization_algo/scripts # cd optimization_algo/scripts
# ./sweep_nets_.sh # ./sweep_nets_brute.sh
``` ```
#### Custom topologies #### Custom topologies
......
...@@ -40,7 +40,7 @@ class brute_force(object): ...@@ -40,7 +40,7 @@ class brute_force(object):
def parse_topology_file(self): def parse_topology_file(self):
layers = [] layers = []
with open(self.topology_file, 'r') as f: with open(pc.TOPOLOGIES_PATH+self.topology_file, 'r') as f:
next(f) next(f)
for line in f: for line in f:
elems = line.strip().split(',') elems = line.strip().split(',')
...@@ -53,7 +53,7 @@ class brute_force(object): ...@@ -53,7 +53,7 @@ class brute_force(object):
def parse_data_set_file(self, path_to_data_csv): def parse_data_set_file(self, path_to_data_csv):
first = True first = True
target_idx = 2 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: for line in f:
elems = line.strip().split(',') elems = line.strip().split(',')
# #print(elems) # #print(elems)
...@@ -151,7 +151,7 @@ class brute_force(object): ...@@ -151,7 +151,7 @@ class brute_force(object):
print("Throughtput Ratio:", (1/max_latency)/(1/full_latency[full_max_idx])) print("Throughtput Ratio:", (1/max_latency)/(1/full_latency[full_max_idx]))
print("Latency increase:", (max_latency*self.k)/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 = 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]) 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 csvFile.close
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
declare -a layers=(46 27 10 58 8 8 8 53) declare -a layers=(46 27 10 58 8 8 8 53)
declare -a max_partitions=(7 7 7 7 7 7 7 7) 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 net=$1
for partitions in `seq 2 ${max_partitions[$i]}`; for partitions in `seq 2 ${max_partitions[$i]}`;
do do
...@@ -12,7 +14,7 @@ do ...@@ -12,7 +14,7 @@ do
for target in DRAM_cycle; for target in DRAM_cycle;
do do
echo $net $partitions $target echo $net $partitions $target
python3 brute_force_approach.py \ python3 ../approaches/brute_force_approach.py \
${net} \ ${net} \
${partitions} \ ${partitions} \
${res_unit} \ ${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