Skip to content

Commit 62177da

Browse files
authored
Merge pull request #2668 from vvbandeira/fix-at-option
ci: fix AT CI setup logic
2 parents e75e078 + f04d42f commit 62177da

2 files changed

Lines changed: 76 additions & 58 deletions

File tree

‎flow/test/test_autotuner.sh‎

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

‎flow/test/test_helper.sh‎

Lines changed: 29 additions & 58 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
82-
RUN_AUTOTUNER=0
83+
echo "RUN_AUTOTUNER not set, disable AT test."
84+
RUN_AUTOTUNER="false"
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
97-
98-
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
12386

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
87+
if [ "${RUN_AUTOTUNER}" == "true" ]; then
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="false"
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="false"
104+
;;
105+
esac
106+
fi
107+
108+
if [ "${RUN_AUTOTUNER}" == "true" ]; then
109+
set +x
110+
echo "Start AutoTuner test."
111+
./test/test_autotuner.sh
112+
set -x
142113
fi
143114

144115
exit $ret

0 commit comments

Comments
 (0)