Skip to content

Commit 6f31b0c

Browse files
committed
add one call to test plot.py
Signed-off-by: luarss <[email protected]>
1 parent 8df7a85 commit 6f31b0c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

flow/test/test_helper.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,14 @@ if [[ -n "${RUN_AUTOTUNER+x}" ]] && [[ ${RUN_AUTOTUNER} -eq 1 ]]; then
9999
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration
100100

101101
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
102-
echo "Running Autotuner ref file test (only once)"
102+
echo "Running the following tests once."
103+
104+
echo "Running Autotuner ref file test"
103105
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
106+
107+
echo "Running Autotuner plotting utility test"
108+
folder_name=$(ls -dt ./flow/logs/asap7/gcd/test-tune* | head -n 1)
109+
python3 tools/AutoTuner/src/autotuner/utils/plot.py --results_dir=$folder_name
104110
fi
105111

106112
echo "Running Autotuner smoke algorithm & evaluation test"

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import pandas as pd
55
import matplotlib.pyplot as plt
66
import re
7+
import os
78
import argparse
89

910
AT_REGEX = r"variant-AutoTunerBase-([\w-]+)-\w+"
11+
IMG_DIR = "images"
1012

1113

1214
def load_dir(dir: str) -> pd.DataFrame:
@@ -83,6 +85,8 @@ def plot(df: pd.DataFrame, key: str):
8385

8486

8587
def main(results_dir: str):
88+
# Default: saves to <REPO_ROOT>/images. Change the IMG_DIR above.
89+
os.makedirs(IMG_DIR, exist_ok=True)
8690
df = load_dir(results_dir)
8791
df = preprocess(df)
8892
keys = ["qor", "runtime", "clk_period", "worst_slack"]
@@ -93,7 +97,10 @@ def main(results_dir: str):
9397
if __name__ == "__main__":
9498
parser = argparse.ArgumentParser(description="Plot AutoTuner results.")
9599
parser.add_argument(
96-
"results_dir", type=str, help="Directory containing the results.", required=True
100+
"--results_dir",
101+
type=str,
102+
help="Directory containing the results.",
103+
required=True,
97104
)
98105
args = parser.parse_args()
99106
main(args.results_dir)

0 commit comments

Comments
 (0)