diff --git a/flow/test/test_helper.sh b/flow/test/test_helper.sh index 36e1c78257..96379309eb 100755 --- a/flow/test/test_helper.sh +++ b/flow/test/test_helper.sh @@ -111,9 +111,15 @@ if [ $RUN_AUTOTUNER -eq 1 ]; then echo "Running Autotuner smoke sweep test" python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep - echo "Running Autotuner ref file test (only once)" if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then + echo "Running the following tests once." + + echo "Running Autotuner ref file test" python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files + + echo "Running Autotuner plotting utility test" + folder_name=$(ls -dt ./flow/logs/asap7/gcd/test-tune* | head -n 1) + python3 tools/AutoTuner/src/autotuner/utils/plot.py --results_dir=$folder_name fi echo "Running Autotuner smoke algorithm & evaluation test" diff --git a/tools/AutoTuner/src/autotuner/utils/plot.py b/tools/AutoTuner/src/autotuner/utils/plot.py index bf45b7cdeb..3ba4dc5aa3 100644 --- a/tools/AutoTuner/src/autotuner/utils/plot.py +++ b/tools/AutoTuner/src/autotuner/utils/plot.py @@ -4,9 +4,11 @@ import pandas as pd import matplotlib.pyplot as plt import re +import os import argparse AT_REGEX = r"variant-AutoTunerBase-([\w-]+)-\w+" +IMG_DIR = "images" def load_dir(dir: str) -> pd.DataFrame: @@ -83,6 +85,8 @@ def plot(df: pd.DataFrame, key: str): def main(results_dir: str): + # Default: saves to /images. Change the IMG_DIR above. + os.makedirs(IMG_DIR, exist_ok=True) df = load_dir(results_dir) df = preprocess(df) keys = ["qor", "runtime", "clk_period", "worst_slack"] @@ -93,7 +97,10 @@ def main(results_dir: str): if __name__ == "__main__": parser = argparse.ArgumentParser(description="Plot AutoTuner results.") parser.add_argument( - "results_dir", type=str, help="Directory containing the results.", required=True + "--results_dir", + type=str, + help="Directory containing the results.", + required=True, ) args = parser.parse_args() main(args.results_dir)