Skip to content

Commit 26a6ca0

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

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
@@ -292,26 +292,23 @@ def openroad(
292292
base_dir,
293293
parameters,
294294
flow_variant,
295-
path="",
296295
install_path=None,
297296
):
298297
"""
299298
Run OpenROAD-flow-scripts with a given set of parameters.
300299
"""
301300
# Make sure path ends in a slash, i.e., is a folder
302301
flow_variant = f"{args.experiment}/{flow_variant}"
303-
if path != "":
304-
log_path = f"{path}/{flow_variant}/"
305-
report_path = log_path.replace("logs", "reports")
306-
run_command(args, f"mkdir -p {log_path}")
307-
run_command(args, f"mkdir -p {report_path}")
308-
else:
309-
log_path = os.path.abspath(
310-
os.path.join(base_dir, f"flow/logs/{args.platform}/{args.design}")
311-
)
312-
report_path = os.path.abspath(
313-
os.path.join(base_dir, f"flow/reports/{args.platform}/{args.design}")
302+
log_path = os.path.abspath(
303+
os.path.join(base_dir, f"flow/logs/{args.platform}/{args.design}", flow_variant)
304+
)
305+
report_path = os.path.abspath(
306+
os.path.join(
307+
base_dir, f"flow/reports/{args.platform}/{args.design}", flow_variant
314308
)
309+
)
310+
os.makedirs(log_path, exist_ok=True)
311+
os.makedirs(report_path, exist_ok=True)
315312

316313
if install_path is None:
317314
install_path = os.path.join(base_dir, "tools/install")
@@ -331,11 +328,11 @@ def openroad(
331328
args,
332329
make_command,
333330
timeout=args.timeout,
334-
stderr_file=f"{log_path}error-make-finish.log",
335-
stdout_file=f"{log_path}make-finish-stdout.log",
331+
stderr_file=os.path.join(log_path, "error-make-finish.log"),
332+
stdout_file=os.path.join(log_path, "make-finish-stdout.log"),
336333
)
337334

338-
metrics_file = os.path.abspath(os.path.join(report_path, "metrics.json"))
335+
metrics_file = os.path.abspath(os.path.join(log_path, "metrics.json"))
339336
metrics_command = export_command
340337
metrics_command += f"{base_dir}/flow/util/genMetrics.py -x"
341338
metrics_command += f" -v {flow_variant}"
@@ -345,8 +342,8 @@ def openroad(
345342
run_command(
346343
args,
347344
metrics_command,
348-
stderr_file=f"{log_path}error-metrics.log",
349-
stdout_file=f"{log_path}metrics-stdout.log",
345+
stderr_file=os.path.join(log_path, "error-metrics.log"),
346+
stdout_file=os.path.join(log_path, "metrics-stdout.log"),
350347
)
351348

352349
return metrics_file

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ def load_dir(dir: str) -> pd.DataFrame:
7676
params = []
7777
failed = []
7878
for params_fname in glob.glob(f"{dir}/*/params.json"):
79-
metrics_fname = params_fname.replace("params.json", "metrics.json")
79+
metrics_fname = params_fname.replace("params.json", "metrics.json").replace(
80+
"ray", "or-0"
81+
)
8082
try:
8183
with open(params_fname, "r") as f:
8284
_dict = json.load(f)

0 commit comments

Comments
 (0)