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
5a4018cd
Commit
5a4018cd
authored
6 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding Promise Tuning in Autotuner script
parent
ef418393
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/hpvm-tensor-rt/bin/run_autotuner.py
+170
-0
170 additions, 0 deletions
llvm/projects/hpvm-tensor-rt/bin/run_autotuner.py
with
170 additions
and
0 deletions
llvm/projects/hpvm-tensor-rt/bin/run_autotuner.py
0 → 100644
+
170
−
0
View file @
5a4018cd
import
subprocess
class
Benchmark
:
def
__init__
(
self
):
self
.
tuner_binary
=
""
self
.
promise_binary
=
""
self
.
tuner_accuracy
=
0
self
.
promise_accuracy
=
0
self
.
num_flags
=
0
self
.
num_layers
=
0
self
.
autotuner_runs
=
0
self
.
error_range_1
=
0
self
.
error_range_2
=
0
self
.
result_dir_1
=
""
self
.
result_dir_2
=
""
self
.
promise_result_dir_1
=
""
self
.
promise_result_dir_2
=
""
bench_tuner_data
=
{}
Alexnet1
=
Benchmark
()
Alexnet1
.
tuner_binary
=
"
alexnet_cifar10_tuner
"
Alexnet1
.
promise_binary
=
"
alexnet_promise_quant
"
Alexnet1
.
num_flags
=
21
Alexnet1
.
num_layers
=
6
Alexnet1
.
error_range_1
=
9
Alexnet1
.
error_range_2
=
12
Alexnet1
.
result_dir_1
=
"
tuner_results/alexnet_cifar10/loss_1/batch1
"
Alexnet1
.
result_dir_2
=
"
tuner_results/alexnet_cifar10/loss_2/batch1
"
Alexnet1
.
tensor_desc_file
=
"
tuner_results/alexnet_cifar10/alexnet_tensors.txt
"
Alexnet1
.
autotuner_runs
=
1000
Alexnet1
.
tuner_accuracy
=
78.9
Alexnet1
.
promise_accuracy
=
79.16
bench_tuner_data
[
"
alexnet_cifar10
"
]
=
Alexnet1
Alexnet2
=
Benchmark
()
Alexnet2
.
tuner_binary
=
"
alexnet2_cifar10_tuner
"
Alexnet2
.
promise_binary
=
"
alexnet2_promise
"
Alexnet2
.
num_flags
=
23
Alexnet2
.
num_layers
=
7
Alexnet2
.
error_range_1
=
9
Alexnet2
.
error_range_2
=
11
Alexnet2
.
result_dir_1
=
"
tuner_results/alexnet2_cifar10/loss_1/batch1
"
Alexnet2
.
result_dir_2
=
"
tuner_results/alexnet2_cifar10/loss_2/batch1
"
Alexnet1
.
tensor_desc_file
=
"
tuner_results/alexnet2_cifar10/alexnet2_tensors.txt
"
Alexnet2
.
autotuner_runs
=
1000
Alexnet2
.
tuner_accuracy
=
84.63
Alexnet2
.
promise_accuracy
=
85.09
bench_tuner_data
[
"
alexnet2_cifar10
"
]
=
Alexnet2
def
runTunerBench
(
bench_name
):
Bench
=
bench_tuner_data
[
bench_name
]
tuner_cmd
=
"
python ../opentuner/autotuner/approxhpvm_tuner.py
"
tuner_cmd
+=
"
--test-limit
"
tuner_cmd
+=
str
(
Bench
.
autotuner_runs
)
tuner_cmd
+=
"
--binary ./
"
tuner_cmd
+=
Bench
.
tuner_binary
tuner_cmd
+=
"
--num-flags
"
tuner_cmd
+=
str
(
Bench
.
num_flags
)
tuner_cmd
+=
"
--error-range
"
tuner_cmd
+=
str
(
Bench
.
error_range_2
)
tuner_cmd
+=
"
--result-dir
"
tuner_cmd
+=
Bench
.
result_dir_2
tuner_cmd
+=
"
--accuracy
"
tuner_cmd
+=
str
(
Bench
.
tuner_accuracy
-
1.90
)
print
tuner_cmd
p
=
subprocess
.
Popen
(
tuner_cmd
,
shell
=
True
)
p
.
wait
()
tuner_cmd
=
"
python ../opentuner/autotuner/approxhpvm_tuner.py
"
tuner_cmd
+=
"
--test-limit
"
tuner_cmd
+=
str
(
Bench
.
autotuner_runs
)
tuner_cmd
+=
"
--binary ./
"
tuner_cmd
+=
Bench
.
tuner_binary
tuner_cmd
+=
"
--num-flags
"
tuner_cmd
+=
str
(
Bench
.
num_flags
)
tuner_cmd
+=
"
--error-range
"
tuner_cmd
+=
str
(
Bench
.
error_range_1
)
tuner_cmd
+=
"
--result-dir
"
tuner_cmd
+=
Bench
.
result_dir_1
tuner_cmd
+=
"
--accuracy
"
tuner_cmd
+=
str
(
Bench
.
tuner_accuracy
-
0.95
)
print
tuner_cmd
p
=
subprocess
.
Popen
(
tuner_cmd
,
shell
=
True
)
p
.
wait
()
def
runAutotuner
():
#runTunerBench("alexnet_cifar10")
runTunerBench
(
"
alexnet2_cifar10
"
)
def
runPromiseBench
(
bench_name
):
Bench
=
bench_tuner_data
[
bench_name
]
tuner_cmd
=
"
python ../opentuner/autotuner/promise_tuner2.py
"
tuner_cmd
+=
"
--test-limit
"
tuner_cmd
+=
str
(
Bench
.
autotuner_runs
)
tuner_cmd
+=
"
--binary ./
"
tuner_cmd
+=
Bench
.
promise_binary
tuner_cmd
+=
"
--num-flags
"
tuner_cmd
+=
str
(
Bench
.
num_layers
)
tuner_cmd
+=
"
--error-range
"
tuner_cmd
+=
str
(
10
)
tuner_cmd
+=
"
--result-dir
"
tuner_cmd
+=
Bench
.
result_dir_2
+
"
/promise_tuner/
"
tuner_cmd
+=
"
--accuracy
"
tuner_cmd
+=
str
(
Bench
.
promise_accuracy
-
1.90
)
tuner_cmd
+=
"
--layer-file
"
tuner_cmd
+=
Bench
.
tensor_desc_file
tuner_cmd
+=
"
--gpu-layers 1
"
print
tuner_cmd
p
=
subprocess
.
Popen
(
tuner_cmd
,
shell
=
True
)
p
.
wait
()
tuner_cmd
=
"
python ../opentuner/autotuner/promise_tuner2.py
"
tuner_cmd
+=
"
--test-limit
"
tuner_cmd
+=
str
(
Bench
.
autotuner_runs
)
tuner_cmd
+=
"
--binary ./
"
tuner_cmd
+=
Bench
.
promise_binary
tuner_cmd
+=
"
--num-flags
"
tuner_cmd
+=
str
(
Bench
.
num_layers
)
tuner_cmd
+=
"
--error-range
"
tuner_cmd
+=
str
(
10
)
tuner_cmd
+=
"
--result-dir
"
tuner_cmd
+=
Bench
.
result_dir_1
+
"
/promise_tuner/
"
tuner_cmd
+=
"
--accuracy
"
tuner_cmd
+=
str
(
Bench
.
promise_accuracy
-
0.95
)
tuner_cmd
+=
"
--layer-file
"
tuner_cmd
+=
Bench
.
tensor_desc_file
tuner_cmd
+=
"
--gpu-layers 1
"
print
tuner_cmd
p
=
subprocess
.
Popen
(
tuner_cmd
,
shell
=
True
)
p
.
wait
()
def
runPromiseTuner
():
runPromiseBench
(
"
alexnet_cifar10
"
)
runPromiseBench
(
"
alexnet2_cifar10
"
)
if
__name__
==
"
__main__
"
:
#runAutotuner()
runPromiseTuner
()
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