Skip to content
Snippets Groups Projects
Commit 4a89ac27 authored by Akash Kothari's avatar Akash Kothari
Browse files

Automating runtime tuning benchmark runs

parent af5f9762
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,11 @@ from os import path
import sys
temp_file_name = "temp.txt"
pred_binary_suffix = "_pred_loop_wrapperapi_linked"
rt_binary_suffix = "_loop_wrapperapi_linked"
max_num_runs = 20
def max_num_configs (config_file):
num_configs = 0
......@@ -41,22 +46,24 @@ def read_and_write_config (config_file, config_num, temp_file):
f.write(config)
if __name__ == "__main__":
def predictive_tuning_exec():
num_args = len(sys.argv)
binary_files = list()
bench_dir = sys.argv[1]
bench_dir = sys.argv[2]
print(bench_dir)
arg = 2
arg = 3
while arg < num_args:
binary_files.append(sys.argv[arg])
arg = arg + 1
for dnn_name in binary_files:
binary_dir = bench_dir + "/" + dnn_name
binary_name = binary_dir + pred_binary_suffix
pred_dir = binary_dir + "/predictive"
config_file = pred_dir + "/" + dnn_name + ".txt"
temp_file = pred_dir + "/" + temp_file_name
print("binary_dir: " + binary_dir)
print("binary name: " + binary_name)
print("pred_dir: " + pred_dir)
print("config_file: " + config_file)
print("temp_file: " + temp_file)
......@@ -64,8 +71,55 @@ if __name__ == "__main__":
max_configs = max_num_configs(config_file)
while config_num < max_configs:
read_and_write_config(config_file, config_num, temp_file)
exec_command = binary_dir + " " + temp_file
exec_command = binary_name
print(exec_command)
os.system(exec_command)
config_num = config_num + 1
def runtime_tuning_exec():
num_args = len(sys.argv)
binary_files = list()
bench_dir = sys.argv[2]
print(bench_dir)
arg = 3
while arg < num_args:
binary_files.append(sys.argv[arg])
arg = arg + 1
for dnn_name in binary_files:
binary_dir = bench_dir + "/" + dnn_name
binary_name = binary_dir + rt_binary_suffix
conf_dir = binary_dir + "/data"
print("binary_dir: " + binary_dir)
print("binary name: " + binary_name)
run = 0
while run < max_num_runs:
exec_command = binary_name
print(exec_command)
os.system(exec_command)
exec_command = "/home/nvidia/poll 13"
print(exec_command)
os.system(exec_command)
exec_command = "mv " + conf_dir + "/profile_info_0.txt " + conf_dir + "/profile_info_out-run-" + str(run) + ".txt"
print(exec_command)
os.system(exec_command)
run = run + 1
exec_command = "rm -rf " + conf_dir + "/run_data"
print(exec_command)
os.system(exec_command)
exec_command = "mkdir " + conf_dir + "/run_data"
print(exec_command)
os.system(exec_command)
if __name__ == "__main__":
if sys.argv[1] == "--runtime_tuning":
runtime_tuning_exec()
elif sys.argv[1] == "--predictive_tuning":
predictive_tuning_exec()
else:
print("Error: Use --runtime_tuning or --predictive_tuning flags!")
sys.exit()
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