Skip to content

Commit

Permalink
Merge pull request #2668 from vvbandeira/fix-at-option
Browse files Browse the repository at this point in the history
ci: fix AT CI setup logic
  • Loading branch information
vvbandeira authored Jan 9, 2025
2 parents e75e078 + f04d42f commit 62177da
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 58 deletions.
47 changes: 47 additions & 0 deletions flow/test/test_autotuner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# run the commands in ORFS root dir
echo "[INFO FLW-0029] Installing dependencies in virtual environment."
cd ../
./tools/AutoTuner/installer.sh
. ./tools/AutoTuner/setup.sh

# remove dashes and capitalize platform name
PLATFORM=${PLATFORM//-/}
# convert to uppercase
PLATFORM=${PLATFORM^^}

echo "Running Autotuner smoke tune test"
python3 -m unittest tools.AutoTuner.test.smoke_test_tune.${PLATFORM}TuneSmokeTest.test_tune

echo "Running Autotuner smoke sweep test"
python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep

echo "Running Autotuner smoke tests for --sample and --iteration."
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)"
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
fi

echo "Running Autotuner smoke algorithm & evaluation test"
python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval

# run this test last (because it modifies current path)
echo "Running Autotuner remote test"
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
# Get the directory of the current script
script_dir="$(dirname "${BASH_SOURCE[0]}")"
cd "$script_dir"/../../
latest_image=$(./etc/DockerTag.sh -dev)
echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env
cd ./tools/AutoTuner
docker compose up --wait
docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \
python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \
--config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1"
docker compose down -v --remove-orphans
fi

exit $ret
87 changes: 29 additions & 58 deletions flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,69 +76,40 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then
$__make power 2>&1 | tee -a "$LOG_FILE"
ret=$(( ret + $? ))
fi
set -x

# Run Autotuner CI specifically for gcd on selected platforms.
if [ -z "${RUN_AUTOTUNER+x}" ]; then
RUN_AUTOTUNER=0
echo "RUN_AUTOTUNER not set, disable AT test."
RUN_AUTOTUNER="false"
fi
case $DESIGN_NAME in
"gcd")
RUN_AUTOTUNER=1
;;
esac
case $PLATFORM in
"asap7" | "sky130hd" | "ihp-sg13g2" )
# Keep RUN_AUTOTUNER enabled only for these platforms
;;
*)
RUN_AUTOTUNER=0
;;
esac

if [ $RUN_AUTOTUNER -eq 1 ]; then
# run the commands in ORFS root dir
echo "[INFO FLW-0029] Installing dependencies in virtual environment."
cd ../
./tools/AutoTuner/installer.sh
. ./tools/AutoTuner/setup.sh

# remove dashes and capitalize platform name
PLATFORM=${PLATFORM//-/}
# convert to uppercase
PLATFORM=${PLATFORM^^}

echo "Running Autotuner smoke tune test"
python3 -m unittest tools.AutoTuner.test.smoke_test_tune.${PLATFORM}TuneSmokeTest.test_tune

echo "Running Autotuner smoke sweep test"
python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep

echo "Running Autotuner smoke tests for --sample and --iteration."
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)"
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
fi

echo "Running Autotuner smoke algorithm & evaluation test"
python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval

# run this test last (because it modifies current path)
echo "Running Autotuner remote test"
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
# Get the directory of the current script
script_dir="$(dirname "${BASH_SOURCE[0]}")"
cd "$script_dir"/../../
latest_image=$(./etc/DockerTag.sh -dev)
echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env
cd ./tools/AutoTuner
docker compose up --wait
docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \
python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \
--config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1"
docker compose down -v --remove-orphans
fi
if [ "${RUN_AUTOTUNER}" == "true" ]; then
case $DESIGN_NAME in
"gcd")
# Keep RUN_AUTOTUNER enabled only for these designs
;;
"*")
echo "Disable AT test for design ${DESIGN_NAME}."
RUN_AUTOTUNER="false"
;;
esac
case $PLATFORM in
"asap7" | "sky130hd" | "ihp-sg13g2" )
# Keep RUN_AUTOTUNER enabled only for these platforms
;;
*)
echo "Disable AT test for platform ${PLATFORM}."
RUN_AUTOTUNER="false"
;;
esac
fi

if [ "${RUN_AUTOTUNER}" == "true" ]; then
set +x
echo "Start AutoTuner test."
./test/test_autotuner.sh
set -x
fi

exit $ret

0 comments on commit 62177da

Please sign in to comment.