Skip to content

Commit 9b98009

Browse files
committed
ci: fix AT CI setup logic
Signed-off-by: Vitor Bandeira <[email protected]>
1 parent cb6e121 commit 9b98009

File tree

2 files changed

+71
-55
lines changed

2 files changed

+71
-55
lines changed

flow/test/test_autotuner.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# run the commands in ORFS root dir
2+
echo "[INFO FLW-0029] Installing dependencies in virtual environment."
3+
cd ../
4+
./tools/AutoTuner/installer.sh
5+
. ./tools/AutoTuner/setup.sh
6+
7+
# remove dashes and capitalize platform name
8+
PLATFORM=${PLATFORM//-/}
9+
# convert to uppercase
10+
PLATFORM=${PLATFORM^^}
11+
12+
echo "Running Autotuner smoke tune test"
13+
python3 -m unittest tools.AutoTuner.test.smoke_test_tune.${PLATFORM}TuneSmokeTest.test_tune
14+
15+
echo "Running Autotuner smoke sweep test"
16+
python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep
17+
18+
echo "Running Autotuner smoke tests for --sample and --iteration."
19+
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration
20+
21+
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
22+
echo "Running Autotuner ref file test (only once)"
23+
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
24+
fi
25+
26+
echo "Running Autotuner smoke algorithm & evaluation test"
27+
python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval
28+
29+
# run this test last (because it modifies current path)
30+
echo "Running Autotuner remote test"
31+
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
32+
# Get the directory of the current script
33+
script_dir="$(dirname "${BASH_SOURCE[0]}")"
34+
cd "$script_dir"/../../
35+
latest_image=$(./etc/DockerTag.sh -dev)
36+
echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env
37+
cd ./tools/AutoTuner
38+
docker compose up --wait
39+
docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \
40+
python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \
41+
--config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1"
42+
docker compose down -v --remove-orphans
43+
fi
44+
45+
exit $ret

flow/test/test_helper.sh

Lines changed: 26 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -76,69 +76,40 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then
7676
$__make power 2>&1 | tee -a "$LOG_FILE"
7777
ret=$(( ret + $? ))
7878
fi
79+
set -x
7980

8081
# Run Autotuner CI specifically for gcd on selected platforms.
8182
if [ -z "${RUN_AUTOTUNER+x}" ]; then
83+
echo "RUN_AUTOTUNER not set, disable AT test."
8284
RUN_AUTOTUNER=0
8385
fi
84-
case $DESIGN_NAME in
85-
"gcd")
86-
RUN_AUTOTUNER=1
87-
;;
88-
esac
89-
case $PLATFORM in
90-
"asap7" | "sky130hd" | "ihp-sg13g2" )
91-
# Keep RUN_AUTOTUNER enabled only for these platforms
92-
;;
93-
*)
94-
RUN_AUTOTUNER=0
95-
;;
96-
esac
9786

9887
if [ $RUN_AUTOTUNER -eq 1 ]; then
99-
# run the commands in ORFS root dir
100-
echo "[INFO FLW-0029] Installing dependencies in virtual environment."
101-
cd ../
102-
./tools/AutoTuner/installer.sh
103-
. ./tools/AutoTuner/setup.sh
104-
105-
# remove dashes and capitalize platform name
106-
PLATFORM=${PLATFORM//-/}
107-
# convert to uppercase
108-
PLATFORM=${PLATFORM^^}
109-
110-
echo "Running Autotuner smoke tune test"
111-
python3 -m unittest tools.AutoTuner.test.smoke_test_tune.${PLATFORM}TuneSmokeTest.test_tune
112-
113-
echo "Running Autotuner smoke sweep test"
114-
python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep
115-
116-
echo "Running Autotuner smoke tests for --sample and --iteration."
117-
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration
118-
119-
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
120-
echo "Running Autotuner ref file test (only once)"
121-
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
122-
fi
88+
case $DESIGN_NAME in
89+
"gcd")
90+
# Keep RUN_AUTOTUNER enabled only for these designs
91+
;;
92+
"*")
93+
echo "Disable AT test for design ${DESIGN_NAME}."
94+
RUN_AUTOTUNER=0
95+
;;
96+
esac
97+
case $PLATFORM in
98+
"asap7" | "sky130hd" | "ihp-sg13g2" )
99+
# Keep RUN_AUTOTUNER enabled only for these platforms
100+
;;
101+
*)
102+
echo "Disable AT test for platform ${PLATFORM}."
103+
RUN_AUTOTUNER=0
104+
;;
105+
esac
106+
fi
123107

124-
echo "Running Autotuner smoke algorithm & evaluation test"
125-
python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval
126-
127-
# run this test last (because it modifies current path)
128-
echo "Running Autotuner remote test"
129-
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
130-
# Get the directory of the current script
131-
script_dir="$(dirname "${BASH_SOURCE[0]}")"
132-
cd "$script_dir"/../../
133-
latest_image=$(./etc/DockerTag.sh -dev)
134-
echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env
135-
cd ./tools/AutoTuner
136-
docker compose up --wait
137-
docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \
138-
python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \
139-
--config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1"
140-
docker compose down -v --remove-orphans
141-
fi
108+
if [ $RUN_AUTOTUNER -eq 1 ]; then
109+
set +x
110+
echo "Start AutoTuner test."
111+
./test_autotuner.sh
112+
set -x
142113
fi
143114

144115
exit $ret

0 commit comments

Comments
 (0)