Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autotuner] CI Smoke Test - Tune & Sweep #2042

Merged
merged 33 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a0d8f68
scaffold for smoke tests
luarss Jun 1, 2024
cbb739d
working smoke test for tune
luarss Jun 2, 2024
a570fbd
Woring smoke test tune
luarss Jun 2, 2024
ec4d7d7
Fix smoke tests
luarss Jun 5, 2024
b9c8a75
Remove python packaging code/docs
luarss Jun 5, 2024
4896ca4
Add CI integration
luarss Jun 5, 2024
9d91286
remove blocked platforms for security scan
luarss Jun 5, 2024
10ab035
Add dependency install to test (will remove later once PR merged)
luarss Jun 6, 2024
a8f00e3
fix platform upper case
luarss Jun 7, 2024
929f4c0
address comments
luarss Jun 13, 2024
1515977
fix gcd unstable and genreport
luarss Jun 13, 2024
c7caaf3
hotfix for autotuner report files
luarss Jun 16, 2024
f3f7834
add ihp gcd params
luarss Jun 24, 2024
04b156f
fix comments
luarss Jul 13, 2024
fc25ef9
fix doc clarity comments
luarss Jul 23, 2024
e869d70
Update flow/test/test_helper.sh
vvbandeira Jul 23, 2024
ea7bd88
Update flow/test/test_helper.sh
vvbandeira Jul 23, 2024
1e4204c
Update tools/AutoTuner/setup.sh
vvbandeira Jul 23, 2024
4cab7e1
fix black
luarss Aug 6, 2024
fa5bf3c
no need cd ../
luarss Aug 7, 2024
3f2c53d
Fix chmod x issues
luarss Aug 9, 2024
1ee2829
add debug print
luarss Aug 9, 2024
003f0d0
test copy tools/AutoTuner
luarss Aug 10, 2024
73f600c
slimmer gitignore and add test_xx functions for the base class
luarss Sep 1, 2024
5458ba5
Update docker/Dockerfile.builder
vvbandeira Sep 1, 2024
97b1ec2
fix py syntax and dockerfile
luarss Sep 2, 2024
b885f3e
ci: bump version
Sep 2, 2024
e854383
revert Dockerfile and fix installer
luarss Sep 2, 2024
ad2f451
revert Dockerfile and change installer to use py3
luarss Sep 2, 2024
7250930
No more cd during installer, standardise setup script and add gitignore
luarss Sep 2, 2024
9eadabb
source setup script
luarss Sep 2, 2024
8335a2e
add PATH to export
luarss Sep 3, 2024
fb24101
Apply suggestions from code review
vvbandeira Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ COPY --link flow/platforms flow/platforms
COPY --link flow/util flow/util
COPY --link flow/scripts flow/scripts
COPY --link flow/designs flow/designs
COPY --link tools/AutoTuner tools/AutoTuner

COPY --link --from=orfs-builder-base /OpenROAD-flow-scripts/tools/install tools/install
COPY --link \
Expand Down
25 changes: 16 additions & 9 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@ User-defined coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) o

## Setting up AutoTuner

To setup AutoTuner, make sure you have a virtual environment set up with
Python 3.9.X. There are plenty of ways to do this, we recommend using
[Miniconda](https://docs.conda.io/en/latest/miniconda.html),
which is a free minimal installer for the package manager `conda`.
We have provided two convenience scripts, `./install.sh` and `./setup.sh`
that works in Python3.8 for installation and configuration of AutoTuner,
as shown below:

```shell
# set up conda environment
conda create -n autotuner_env python=3.9
conda activate autotuner_env
# Install prerequisites
./tools/AutoTuner/install.sh

# install requirements
pip install -r ./tools/AutoTuner/requirements.txt
# Start virtual environment
./tools/AutoTuner/setup.sh
```

## Input JSON structure
Expand Down Expand Up @@ -198,6 +196,15 @@ We show three different views possible at the end, namely: `Table View`, `Scatte
![Parallel Coordinate View](../images/Autotuner_best_parameter_view.webp)
<p style="text-align: center;">Parallel Coordinate View (best run is in green)</p>

## Testing framework

Assuming the virtual environment is setup at `./tools/AutoTuner/autotuner_env`:

```
./tools/AutoTuner/setup.sh
python3 ./tools/AutoTuner/test/smoke_test_sweep.py
python3 ./tools/AutoTuner/test/smoke_test_tune.py
```

## Citation

Expand Down
2 changes: 1 addition & 1 deletion flow/designs/asap7/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_SDC_CLK_PERIOD": {
"type": "float",
"minmax": [
50,
300,
1000
],
"step": 0
Expand Down
10 changes: 5 additions & 5 deletions flow/designs/ihp-sg13g2/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"_SDC_CLK_PERIOD": {
"type": "float",
"minmax": [
1.0,
4.3647
7.0,
12.0
],
"step": 0
},
Expand Down Expand Up @@ -52,23 +52,23 @@
"type": "float",
"minmax": [
0.1,
0.7
0.3
],
"step": 0
},
"PLACE_DENSITY_LB_ADDON": {
"type": "float",
"minmax": [
0.0,
0.99
0.1
],
"step": 0
},
"_PINS_DISTANCE": {
"type": "int",
"minmax": [
1,
4
1
],
"step": 1
},
Expand Down
1 change: 1 addition & 0 deletions flow/designs/sky130hd/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@
"step": 0
}
}

35 changes: 35 additions & 0 deletions flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,39 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then
ret=$(( ret + $? ))
fi

# Run Autotuner CI specifically for gcd on selected platforms.
RUN_AUTOTUNER=0
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
# change directory to the root of the repo
echo "Install and starting venv"
cd ../
./tools/AutoTuner/installer.sh
. ./tools/AutoTuner/setup.sh

# remove dashes
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
fi

exit $ret
4 changes: 3 additions & 1 deletion flow/util/genReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def write_summary():

for log_dir, dirs, files in sorted(os.walk(LOGS_FOLDER, topdown=False)):
dir_list = log_dir.split(os.sep)
if len(dir_list) != 4:
# Handles autotuner folders, which do not have `report.log` natively.
# TODO: Can we log something for autotuner?
if len(dir_list) != 4 or "test-" in dir_list[-1]:
continue
report_dir = log_dir.replace(LOGS_FOLDER, REPORTS_FOLDER)

Expand Down
2 changes: 1 addition & 1 deletion jenkins/public_nightly.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('[email protected].0') _
@Library('[email protected].1') _

node {

Expand Down
2 changes: 1 addition & 1 deletion jenkins/public_tests_all.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('[email protected].0') _
@Library('[email protected].1') _

node {

Expand Down
11 changes: 10 additions & 1 deletion tools/AutoTuner/.gitignore
luarss marked this conversation as resolved.
Show resolved Hide resolved
luarss marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# Autotuner specific
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*.egg-info/

# Jupyter Notebook
.ipynb_checkpoints

# Autotuner env
autotuner_env
Loading
Loading