Skip to content

Commit 6b6a8be

Browse files
committed
fix file path in plot, refactor openroad util to populate paths correctly
Signed-off-by: Jack Luar <[email protected]>
1 parent 10122b9 commit 6b6a8be

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

tools/AutoTuner/src/autotuner/utils.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,26 +257,23 @@ def openroad(
257257
base_dir,
258258
parameters,
259259
flow_variant,
260-
path="",
261260
install_path=None,
262261
):
263262
"""
264263
Run OpenROAD-flow-scripts with a given set of parameters.
265264
"""
266265
# Make sure path ends in a slash, i.e., is a folder
267266
flow_variant = f"{args.experiment}/{flow_variant}"
268-
if path != "":
269-
log_path = f"{path}/{flow_variant}/"
270-
report_path = log_path.replace("logs", "reports")
271-
run_command(args, f"mkdir -p {log_path}")
272-
run_command(args, f"mkdir -p {report_path}")
273-
else:
274-
log_path = os.path.abspath(
275-
os.path.join(base_dir, f"flow/logs/{args.platform}/{args.design}")
276-
)
277-
report_path = os.path.abspath(
278-
os.path.join(base_dir, f"flow/reports/{args.platform}/{args.design}")
267+
log_path = os.path.abspath(
268+
os.path.join(base_dir, f"flow/logs/{args.platform}/{args.design}", flow_variant)
269+
)
270+
report_path = os.path.abspath(
271+
os.path.join(
272+
base_dir, f"flow/reports/{args.platform}/{args.design}", flow_variant
279273
)
274+
)
275+
os.makedirs(log_path, exist_ok=True)
276+
os.makedirs(report_path, exist_ok=True)
280277

281278
if install_path is None:
282279
install_path = os.path.join(base_dir, "tools/install")
@@ -296,11 +293,11 @@ def openroad(
296293
args,
297294
make_command,
298295
timeout=args.timeout,
299-
stderr_file=f"{log_path}error-make-finish.log",
300-
stdout_file=f"{log_path}make-finish-stdout.log",
296+
stderr_file=os.path.join(log_path, "error-make-finish.log"),
297+
stdout_file=os.path.join(log_path, "make-finish-stdout.log"),
301298
)
302299

303-
metrics_file = os.path.abspath(os.path.join(report_path, "metrics.json"))
300+
metrics_file = os.path.abspath(os.path.join(log_path, "metrics.json"))
304301
metrics_command = export_command
305302
metrics_command += f"{base_dir}/flow/util/genMetrics.py -x"
306303
metrics_command += f" -v {flow_variant}"
@@ -310,8 +307,8 @@ def openroad(
310307
run_command(
311308
args,
312309
metrics_command,
313-
stderr_file=f"{log_path}error-metrics.log",
314-
stdout_file=f"{log_path}metrics-stdout.log",
310+
stderr_file=os.path.join(log_path, "error-metrics.log"),
311+
stdout_file=os.path.join(log_path, "metrics-stdout.log"),
315312
)
316313

317314
return metrics_file

tools/AutoTuner/src/autotuner/utils/plot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def load_dir(dir: str) -> pd.DataFrame:
4141
params = []
4242
failed = []
4343
for params_fname in glob.glob(f"{dir}/*/params.json"):
44-
metrics_fname = params_fname.replace("params.json", "metrics.json")
44+
metrics_fname = params_fname.replace("params.json", "metrics.json").replace(
45+
"ray", "or-0"
46+
)
4547
try:
4648
with open(params_fname, "r") as f:
4749
_dict = json.load(f)

0 commit comments

Comments
 (0)