Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autotuner] Plotting utility + test #2394

Merged
merged 15 commits into from
Feb 5, 2025
Prev Previous commit
Next Next commit
print all files at the end of load_dir
Signed-off-by: Jack Luar <[email protected]>
luarss committed Jan 30, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit fdc3626424adc0e25f0058635a16e12787103c90
13 changes: 8 additions & 5 deletions tools/AutoTuner/src/autotuner/utils/plot.py
Original file line number Diff line number Diff line change
@@ -17,24 +17,27 @@ def load_dir(dir: str) -> pd.DataFrame:

# Concatenate params.json & metrics.json file
params = []
for fname in glob.glob(f"{dir}/*/params.json"):
failed = []
for params_fname in glob.glob(f"{dir}/*/params.json"):
try:
with open(fname, "r") as f:
with open(params_fname, "r") as f:
_dict = json.load(f)
_dict["trial_id"] = re.search(AT_REGEX, fname).group(1)
with open(fname.replace("params.json", "metrics.json"), "r") as f:
_dict["trial_id"] = re.search(AT_REGEX, params_fname).group(1)
metrics_fname = params_fname.replace("params.json", "metrics.json")
with open(metrics_fname, "r") as f:
metrics = json.load(f)
ws = metrics["finish"]["timing__setup__ws"]
metrics["worst_slack"] = ws
_dict.update(metrics)
params.append(_dict)
except Exception as e:
print(f"Error in {fname}: {e}")
failed.append(metrics_fname)
continue
tmp_df = pd.DataFrame(params)

# Merge all dataframe
df = df.merge(tmp_df, on="trial_id")
print(f"Failed to load {len(failed)} files:\n{'\n'.join(failed)}")
return df