Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
dff99ab6
Commit
dff99ab6
authored
5 years ago
by
Elizabeth
Browse files
Options
Downloads
Patches
Plain Diff
Fixed errors when writing configuration
parent
26fca261
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/soc_simulator/src/driver_new_config.py
+17
-15
17 additions, 15 deletions
llvm/projects/soc_simulator/src/driver_new_config.py
with
17 additions
and
15 deletions
llvm/projects/soc_simulator/src/driver_new_config.py
+
17
−
15
View file @
dff99ab6
...
...
@@ -181,17 +181,19 @@ class Driver:
line
=
config_file
.
readline
().
strip
()
while
line
!=
"
-----
"
:
layer_as_lst
=
line
.
split
(
'
'
)
layer_results
=
[]
# Skip softmax
if
line
.
find
(
"
softmax
"
)
!=
-
1
:
layer_results
.
append
((
0
,
0
,
'
'
.
join
(
layer_as_lst
[
2
:])))
curr_conf_results
.
append
((
layer_as_lst
[
1
],
layer_results
))
line
=
config_file
.
readline
().
strip
()
continue
layer_as_lst
=
line
.
split
(
'
'
)
layer_ind
=
int
(
layer_as_lst
[
0
])
-
1
layer_table_data
=
self
.
__tensor_layers
[
layer_ind
]
layer_name
=
layer_table_data
[
"
Name
"
]
layer_results
=
[]
if
Driver
.
is_promise
(
layer_as_lst
[
1
]):
print
(
"
Running layer %s on PROMISE
"
%
layer_name
)
curr_layer
=
Driver
.
PrecisionTypes
.
PROMISE
...
...
@@ -206,7 +208,7 @@ class Driver:
time
,
energy
=
self
.
__run_promise_simulation
(
param_val
,
layer_table_data
)
total_time
+=
time
total_energy
+=
energy
layer_results
.
append
((
total_time
,
total_energy
,
'
'
.
join
(
layer_as_lst
[
1
:])))
layer_results
.
append
((
total_time
,
total_energy
,
'
'
.
join
(
layer_as_lst
[
2
:])))
elif
Driver
.
is_gpu
(
layer_as_lst
[
1
]):
print
(
"
Running layer %s on the GPU
"
%
layer_name
)
...
...
@@ -247,7 +249,7 @@ class Driver:
line
=
config_file
.
readline
().
strip
()
prev_layer
=
curr_layer
curr_conf_results
.
append
(
layer_results
)
curr_conf_results
.
append
(
(
layer_as_lst
[
1
],
layer_results
)
)
self
.
__conf_results
.
append
(
(
first_line
,
curr_conf_results
)
)
line
=
config_file
.
readline
().
strip
()
...
...
@@ -375,12 +377,15 @@ class Driver:
new_header
=
[
conf_name
]
new_header
.
append
(
repr
(
time_speedup
))
new_header
.
append
(
repr
(
energy_speedup
))
new_header
.
append
(
first_line_lst
[
-
1
])
new_header
.
append
(
first_line_lst
[
-
2
])
new_header
.
append
(
repr
(
abs
(
float
(
first_line_lst
[
-
2
])
)))
new_header
.
append
(
repr
(
abs
(
float
(
first_line_lst
[
-
1
])
)))
conf_str
.
append
(
'
'
.
join
(
new_header
))
for
ind
,
layer
in
enumerate
(
layers
):
for
ind
,
(
hardware
,
layer
)
in
enumerate
(
layers
):
print
(
layer
)
layer_lst
=
[
str
(
ind
+
1
)]
layer_lst
.
append
(
hardware
)
print
(
layer_lst
)
for
op_time
,
op_energy
,
tensor_op
in
layer
:
layer_lst
.
append
(
tensor_op
)
conf_str
.
append
(
'
'
.
join
(
layer_lst
))
...
...
@@ -392,7 +397,8 @@ class Driver:
def
get_baseline_times_energies
(
conf
):
curr_time
=
curr_energy
=
0
for
layer
in
conf
[
1
]:
print
(
"
RESULTS:
"
,
conf
[
1
])
for
hardware
,
layer
in
conf
[
1
]:
for
op_time
,
op_energy
,
tensor_op
in
layer
:
curr_time
+=
op_time
curr_energy
+=
op_energy
...
...
@@ -403,7 +409,7 @@ class Driver:
final_conf
=
[]
# List (conf) of lists (layers) of tuples (operation data)
for
layer_ind
,
layer
in
enumerate
(
curr_conf
[
1
]):
for
layer_ind
,
(
hardware
,
layer
)
in
enumerate
(
curr_conf
[
1
]):
final_conf_layer
=
[]
for
tensor_ind
,
(
op_time
,
op_energy
,
tensor_op
)
in
enumerate
(
layer
):
...
...
@@ -433,23 +439,19 @@ class Driver:
conf_index
=
0
print
(
"
RESULTS
"
)
#print(self.__conf_results)
for
line
in
config_file
:
if
line
.
startswith
(
"
conf
"
):
orig_line_lst
=
line
.
split
(
'
'
)
conf_name
=
orig_line_lst
[
0
]
if
not
baseline_conf
:
baseline_conf
=
self
.
__conf_results
[
conf_index
]
#conf_name]
baseline_total_time
,
baseline_total_energy
=
get_baseline_times_energies
(
baseline_conf
)
results_file
.
write
(
"
%s
%s
\n
"
%
(
repr
(
baseline_total_time
)
,
repr
(
baseline_total_energy
)))
# write baseline time to top of file
results_file
.
write
(
"
%s
\n
"
%
repr
(
baseline_total_time
)
)
write_conf_to_file
(
conf_name
,
baseline_conf
,
1
,
1
)
else
:
curr_conf
=
self
.
__conf_results
[
conf_index
]
#conf_name]
final_time
,
final_energy
=
get_baseline_times_energies
(
curr_conf
)
#final_time, final_energy, curr_conf = get_final_times_energies_conf(curr_conf)
#assert(final_time <= baseline_total_time)
#assert(final_energy <= baseline_total_energy)
#write_conf_to_file(conf_name, curr_conf, final_time, final_energy)
write_conf_to_file
(
conf_name
,
curr_conf
,
baseline_total_time
/
final_time
,
baseline_total_energy
/
final_energy
)
conf_index
+=
1
results_file
.
close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment