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
......
......@@ -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