Skip to content

Commit

Permalink
add one call to test plot.py
Browse files Browse the repository at this point in the history
Signed-off-by: luarss <jluar@precisioninno.com>
  • Loading branch information
luarss committed Dec 24, 2024
1 parent 8df7a85 commit 6f31b0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ if [[ -n "${RUN_AUTOTUNER+x}" ]] && [[ ${RUN_AUTOTUNER} -eq 1 ]]; then
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration

if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
echo "Running Autotuner ref file test (only once)"
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"
Expand Down
9 changes: 8 additions & 1 deletion tools/AutoTuner/src/autotuner/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -83,6 +85,8 @@ def plot(df: pd.DataFrame, key: str):


def main(results_dir: str):
# Default: saves to <REPO_ROOT>/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"]
Expand All @@ -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)

0 comments on commit 6f31b0c

Please sign in to comment.