Skip to content

Commit 97497e0

Browse files
authored
Merge pull request #2487 from antmicro/eszpot/autotuner-refactoring
Refactor AutoTuner as Python module
2 parents 38048dd + dc6be33 commit 97497e0

File tree

11 files changed

+784
-665
lines changed

11 files changed

+784
-665
lines changed

docs/user/InstructionsForAutoTuner.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ We have provided two convenience scripts, `./installer.sh` and `./setup.sh`
2727
that works in Python3.8 for installation and configuration of AutoTuner,
2828
as shown below:
2929

30-
```{note}
31-
Make sure you run the following commands in the ORFS root directory.
32-
```
33-
3430
```shell
3531
# Install prerequisites
3632
./tools/AutoTuner/installer.sh
@@ -104,7 +100,7 @@ For Global Routing parameters that are set on `fastroute.tcl` you can use:
104100

105101
### General Information
106102

107-
The `distributed.py` script located in `./tools/AutoTuner/src/autotuner` uses [Ray's](https://docs.ray.io/en/latest/index.html) job scheduling and management to
103+
The `autotuner.distributed` module uses [Ray's](https://docs.ray.io/en/latest/index.html) job scheduling and management to
108104
fully utilize available hardware resources from a single server
109105
configuration, on-premise or over the cloud with multiple CPUs.
110106

@@ -115,35 +111,37 @@ The two modes of operation:
115111
The `sweep` mode is useful when we want to isolate or test a single or very few
116112
parameters. On the other hand, `tune` is more suitable for finding
117113
the best combination of a complex and large number of flow
118-
parameters. Both modes rely on user-specified search space that is
119-
defined by a `.json` file, they use the same syntax and format,
120-
though some features may not be available for sweeping.
114+
parameters.
121115

122116
```{note}
123117
The order of the parameters matter. Arguments `--design`, `--platform` and
124118
`--config` are always required and should precede *mode*.
125119
```
126120

121+
```{note}
122+
The following commands should be run from `./tools/AutoTuner`.
123+
```
124+
127125
#### Tune only
128126

129-
* AutoTuner: `python3 distributed.py tune -h`
127+
* AutoTuner: `python3 -m autotuner.distributed tune -h`
130128

131129
Example:
132130

133131
```shell
134-
python3 distributed.py --design gcd --platform sky130hd \
135-
--config ../../../../flow/designs/sky130hd/gcd/autotuner.json \
132+
python3 -m autotuner.distributed --design gcd --platform sky130hd \
133+
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
136134
tune --samples 5
137135
```
138136
#### Sweep only
139137

140-
* Parameter sweeping: `python3 distributed.py sweep -h`
138+
* Parameter sweeping: `python3 -m autotuner.distributed sweep -h`
141139

142140
Example:
143141

144142
```shell
145-
python3 distributed.py --design gcd --platform sky130hd \
146-
--config distributed-sweep-example.json \
143+
python3 -m autotuner.distributed --design gcd --platform sky130hd \
144+
--config src/autotuner/distributed-sweep-example.json \
147145
sweep
148146
```
149147

tools/AutoTuner/installer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ script_dir="$(dirname "${BASH_SOURCE[0]}")"
77
venv_name="autotuner_env"
88
python3 -m venv "$script_dir/$venv_name"
99
source "$script_dir/$venv_name/bin/activate"
10-
pip3 install -U -r $script_dir/requirements.txt
10+
pip3 install -e "$script_dir"
1111
deactivate

tools/AutoTuner/pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[project]
2+
name = "autotuner"
3+
version = "0.0.1"
4+
description = "This project provides a set of tools for tuning OpenROAD-flow-scripts parameter without user interference."
5+
classifiers = [
6+
"Programming Language :: Python :: 3",
7+
"License :: OSI Approved :: BSD 3-Clause",
8+
]
9+
readme = "README.md"
10+
requires-python = ">= 3.8"
11+
dynamic = ["dependencies", "optional-dependencies"]
12+
13+
[tool.setuptools.dynamic]
14+
dependencies = { file = ["requirements.txt"] }
15+
optional-dependencies.dev = { file = ["requirements-dev.txt"] }
16+
17+
[build-system]
18+
requires = ["setuptools", "setuptools_scm"]
19+
build-backend = "setuptools.build_meta"
20+
21+
[tool.setuptools.packages.find]
22+
where = ["src/"]
23+
include = [
24+
"autotuner*",
25+
]
26+
27+
[tool.setuptools]
28+
include-package-data = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
black
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
AutoTuner module integrating Ray Tune and Vizier framework
3+
for ORFS parameters optimization.
4+
"""

0 commit comments

Comments
 (0)