Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
watcag-public
fpga-syspart
Commits
d5d06703
Commit
d5d06703
authored
Nov 07, 2019
by
LongChan
Browse files
fix brute force
parent
6a554713
Changes
4
Show whitespace changes
Inline
Side-by-side
README.md
View file @
d5d06703
...
...
@@ -32,9 +32,21 @@ The instruction below will do a sweep run on each of the following networks:
-
NCF_rec
-
Resnet_50_v1
To
ru
n individual
To
obtai
n 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
...
...
optimization_algo/approaches/brute_force_approach.py
View file @
d5d06703
...
...
@@ -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
...
...
optimization_algo/resulting_csv/bruteforce.csv
View file @
d5d06703
optimization_algo/scripts/brute_force_parallel.sh
View file @
d5d06703
...
...
@@ -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
}
\
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment