Skip to content
Snippets Groups Projects
Commit 5a4018cd authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Adding Promise Tuning in Autotuner script

parent ef418393
No related branches found
No related tags found
No related merge requests found
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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment