Skip to content

Commit 1d26640

Browse files
author
MohamedElgammal
committed
Fixing the generated vtr_flow.sh scripts
1 parent 4218cad commit 1d26640

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

vtr_flow/scripts/flow_script_template.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ VTR_MEMORY_ESTIMATE_HUMAN_READABLE="{human_readable_memory}"
1515

1616
#The IO redirection occurs in a sub-shell,
1717
#so we need to exit it with the correct code
18-
exit \$?
18+
exit $?
1919

2020
}} |& tee vtr_flow.out
2121
#End I/O redirection
@@ -24,4 +24,4 @@ VTR_MEMORY_ESTIMATE_HUMAN_READABLE="{human_readable_memory}"
2424
#To get the correct exit status we need to exit with the
2525
#status of the first element in the pipeline (i.e. the real
2626
#command run above)
27-
exit \${{PIPESTATUS[0]}}
27+
exit ${{PIPESTATUS[0]}}

vtr_flow/scripts/python_libs/vtr/task.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,7 @@ def create_job(
462462
# determine spacing for nice output
463463
num_spaces_before = int((longest_name - len(config.task_name))) + 8
464464
num_spaces_after = int((longest_arch_circuit - len(work_dir + "/{}".format(param_string))))
465-
cmd += [
466-
"-name",
467-
"{}:{}{}/{}{}".format(
468-
config.task_name,
469-
" " * num_spaces_before,
470-
work_dir,
471-
param_string,
472-
" " * num_spaces_after,
473-
),
474-
]
475-
476-
cmd += ["-temp_dir", run_dir + "/{}".format(param_string)]
465+
477466
expected_min_w = ret_expected_min_w(circuit, arch, golden_results, param)
478467
expected_min_w = (
479468
int(expected_min_w * args.minw_hint_factor)
@@ -514,6 +503,7 @@ def create_job(
514503
]
515504
current_qor_parse_command.insert(0, run_dir + "/{}".format(load_script_param(param)))
516505
current_cmd = cmd.copy()
506+
current_cmd += ["-temp_dir", run_dir + "/{}".format(param_string)]
517507
if param_string != "common":
518508
current_cmd += param.split(" ")
519509
return Job(

vtr_flow/scripts/run_vtr_task.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pathlib import Path
88
from pathlib import PurePath
99
import sys
10+
import os
1011
import argparse
1112
import textwrap
1213
import subprocess
@@ -367,6 +368,15 @@ def create_run_script(args, job, work_dir):
367368
if memory_estimate < 0:
368369
memory_estimate = 0
369370

371+
separator = ' '
372+
command_options_list = job.run_command()
373+
'''
374+
index = command_options_list.index('-name')
375+
del command_options_list[index]
376+
del command_options_list[index]
377+
'''
378+
command_options = separator.join(command_options_list)
379+
370380
human_readable_runtime_est = format_human_readable_time(runtime_estimate)
371381
human_readable_memory_est = format_human_readable_memory(memory_estimate)
372382
Path(work_dir).mkdir(parents=True)
@@ -382,12 +392,14 @@ def create_run_script(args, job, work_dir):
382392
estimated_memory=memory_estimate,
383393
human_readable_time=human_readable_runtime_est,
384394
human_readable_memory=human_readable_memory_est,
385-
script=args.script,
386-
command=job.run_command(),
395+
script=str(paths.run_vtr_flow_path),
396+
command=command_options,
387397
),
388398
file=out_file,
389399
end="",
390400
)
401+
402+
os.system('chmod +x ' + str(run_script_file))
391403
return str(run_script_file)
392404

393405

@@ -397,7 +409,12 @@ def ret_expected_runtime(job, work_dir):
397409
golden_results = load_parse_results(
398410
str(Path(work_dir).parent.parent.parent.parent / "config/golden_results.txt")
399411
)
412+
400413
metrics = golden_results.metrics(job.arch(), job.circuit(), job.script_params())
414+
if metrics == None:
415+
metrics = golden_results.metrics(job.arch(), job.circuit(), "common")
416+
#print(metrics)
417+
401418
if "vtr_flow_elapsed_time" in metrics:
402419
seconds = float(metrics["vtr_flow_elapsed_time"])
403420
return seconds
@@ -410,6 +427,9 @@ def ret_expected_memory(job, work_dir):
410427
str(Path(work_dir).parent.parent.parent.parent / "config/golden_results.txt")
411428
)
412429
metrics = golden_results.metrics(job.arch(), job.circuit(), job.script_params())
430+
if metrics == None:
431+
metrics = golden_results.metrics(job.arch(), job.circuit(), "common")
432+
413433
for metric in ["max_odin_mem", "max_abc_mem", "max_ace_mem", "max_vpr_mem"]:
414434
if metric in metrics and int(metrics[metric]) > memory_kib:
415435
memory_kib = int(metrics[metric])

0 commit comments

Comments
 (0)