Skip to content

Commit 0ea2309

Browse files
luarssvvbandeira
andauthored
[Docs] Autotuner update (#1319)
* add installation instruction for autotuner * autotuner pics * update sweeping tuning writeup * update protobuf req * add tensorboard * update py 3.9 * docs: fix link Signed-off-by: luarss <[email protected]> Signed-off-by: Vitor Bandeira <[email protected]> Co-authored-by: Vitor Bandeira <[email protected]>
1 parent a6a728c commit 0ea2309

File tree

6 files changed

+65
-24
lines changed

6 files changed

+65
-24
lines changed
74.8 KB
Loading
106 KB
Loading
65.5 KB
Loading

docs/user/InstructionsForAutoTuner.md

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,31 @@ AutoTuner contains top-level Python script for ORFS, each of which implements a
1818
* Tree Parzen Estimator + Covariance Matrix Adaptation Evolution Strategy ([Optuna](https://optuna.org/))
1919
* Evolutionary Algorithm ([Nevergrad](https://github.com/facebookresearch/nevergrad))
2020

21-
User-settable coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) of three objectives to set the direction of tuning are written in the script. Each coefficient is expressed as a global variable at the `get_ppa` function in `PPAImprov` class in the script (`coeff_perform`, `coeff_power`, `coeff_area`). Efforts to optimize each of the objectives are proportional to the specified coefficients.
21+
User-defined coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) of three objectives to set the direction of tuning are written in the script. Each coefficient is expressed as a global variable at the `get_ppa` function in `PPAImprov` class in the script (`coeff_perform`, `coeff_power`, `coeff_area`). Efforts to optimize each of the objectives are proportional to the specified coefficients.
2222

2323

24+
## Setting up AutoTuner
25+
26+
To setup AutoTuner, make sure you have a virtual environment set up with
27+
Python 3.9.X. There are plenty of ways to do this, we recommend using
28+
[Miniconda](https://docs.conda.io/en/latest/miniconda.html),
29+
which is a free minimal installer for the package manager `conda`.
30+
31+
```shell
32+
# set up conda environment
33+
conda create -n autotuner_env python=3.9
34+
conda activate autotuner_env
35+
36+
# install requirements
37+
pip install -r ./tools/AutoTuner/requirements.txt
38+
```
39+
2440
## Input JSON structure
2541

26-
Sample JSON file for sky130hd aes design: [[link]](https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/master/flow/designs/sky130hd/aes/autotuner.json)
42+
Sample JSON [file](https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/master/flow/designs/sky130hd/aes/autotuner.json) for Sky130HD `aes` design:
43+
44+
Alternatively, here is a minimal example to get started:
2745

28-
Simple Example:
2946
```json
3047
{
3148
"_SDC_FILE_PATH": "constraint.sdc",
@@ -70,8 +87,7 @@ For SDC you can use:
7087
- I/O delay. This will create a copy of `_SDC_FILE_PATH` and modify the I/O delay.
7188

7289

73-
74-
For FastRoute you can use:
90+
For Global Routing parameters that are set on `fastroute.tcl` you can use:
7591

7692
* `_FR_FILE_PATH`
7793
- Path relative to the current JSON file to the `fastroute.tcl` file.
@@ -83,21 +99,30 @@ For FastRoute you can use:
8399
- Global route random seed. This will create a copy of `_FR_FILE_PATH` and modify the global route random seed.
84100

85101

86-
87-
88102
## How to use
89103

90104
### General Information
91105

92-
`distributed.py` scripts handles sweeping and tuning of ORFS parameters.
93-
94-
For both sweep and tune modes <mode>:
95-
```shell
96-
python3 distributed.py -h
106+
The `distributed.py` script uses Ray's job scheduling and management to
107+
fully utilize available hardware resources from a single server
108+
configuration, on-premies or over the cloud with multiple CPUs.
109+
The two modes of operation: `sweep`, where every possible parameter
110+
combination in the search space is tested; and `tune`, where we use
111+
Ray's Tune feature to intelligently search the space and optimize
112+
hyperparameters using one of the algorithms listed above. The `sweep`
113+
mode is useful when we want to isolate or test a single or very few
114+
parameters. On the other hand, `tune` is more suitable for finding
115+
the best combination of a complex and large number of flow
116+
parameters. Both modes rely on user-specified search space that is
117+
defined by a `.json` file, they use the same syntax and format,
118+
though some features may not be available for sweeping.
119+
120+
```{note}
121+
The order of the parameters matter. Arguments `--design`, `--platform` and
122+
`--config` are always required and should precede <mode>.
97123
```
98124

99-
Note: the order of the parameters matter. Arguments `--design`, `--platform` and
100-
`--config` are always required and should precede <mode>.
125+
#### Tune only
101126

102127
* AutoTuner: `python3 distributed.py tune -h`
103128

@@ -108,7 +133,7 @@ python3 distributed.py --design gcd --platform sky130hd \
108133
--config ../designs/sky130hd/gcd/autotuner.json \
109134
tune
110135
```
111-
136+
#### Sweep only
112137

113138
* Parameter sweeping: `python3 distributed.py sweep -h`
114139

@@ -120,12 +145,6 @@ python3 distributed.py --design gcd --platform sky130hd \
120145
sweep
121146
```
122147

123-
124-
### Google Cloud Platform (GCP) distribution with Ray.
125-
126-
GCP Setup Tutorial coming soon.
127-
128-
129148
### List of input arguments
130149
| Argument | Description |
131150
|-------------------------------|-------------------------------------------------------------------------------------------------------|
@@ -153,8 +172,8 @@ GCP Setup Tutorial coming soon.
153172
| `--jobs` | Max number of concurrent jobs. |
154173
| `--openroad_threads` | Max number of threads usable. |
155174
| `--server` | The address of Ray server to connect. |
156-
| `--port` | Tbe port of Ray server to connect. |
157-
| `-v` or `--verbose` | Verbosity Level. [0: Only ray status, 1: print stderr, 2: also print training stdout |
175+
| `--port` | The port of Ray server to connect. |
176+
| `-v` or `--verbose` | Verbosity Level. [0: Only ray status, 1: print stderr, 2: also print training stdout. |
158177
| | |
159178
### GUI
160179

@@ -163,6 +182,18 @@ You could find the "Best config found" on the screen.
163182

164183
To use TensorBoard GUI, run `tensorboard --logdir=./<logpath>`. While TensorBoard is running, you can open the webpage `http://localhost:6006/` to see the GUI.
165184

185+
We show three different views possible at the end, namely: `Table View`, `Scatter Plot Matrix View` and `Parallel Coordinate View`.
186+
187+
![Table View](../images/Autotuner_Table_view.webp)
188+
<p style="text-align: center;">Table View</p>
189+
190+
![Scatter Plot Matrix View](../images/Autotuner_scatter_plot_matrix_view.webp)
191+
<p style="text-align: center;">Scatter Plot Matrix View</p>
192+
193+
![Parallel Coordinate View](../images/Autotuner_best_parameter_view.webp)
194+
<p style="text-align: center;">Parallel Coordinate View (best run is in green)</p>
195+
196+
166197
## Citation
167198

168199
Please cite the following paper.

tools/AutoTuner/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Kubernetes Engine (i.e., GKE) and the required support infrastructure to
55
enable AutoTuner to work properly. The documentation is intended to users
66
with some familiarity with Google Cloud or other cloud services. For
77
more details on how to use AutoTuner see the main documentation page
8-
[here](https://openroad.readthedocs.io/en/latest/user/InstructionsForAutoTuner.html).
8+
[here](https://openroad-flow-scripts.readthedocs.io/en/latest/user/InstructionsForAutoTuner.html).
99

1010
## How to use this document
1111

tools/AutoTuner/requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ray[default,tune]==1.11.0
2+
ax-platform
3+
hyperopt
4+
nevergrad
5+
optuna
6+
pandas
7+
colorama==0.4.4
8+
bayesian-optimization==1.4.0
9+
tensorboard==2.13.3
10+
protobuf==3.20.1

0 commit comments

Comments
 (0)