Skip to content

Commit

Permalink
Merge pull request #2487 from antmicro/eszpot/autotuner-refactoring
Browse files Browse the repository at this point in the history
Refactor AutoTuner as Python module
  • Loading branch information
vvbandeira authored Jan 29, 2025
2 parents 38048dd + dc6be33 commit 97497e0
Show file tree
Hide file tree
Showing 11 changed files with 784 additions and 665 deletions.
26 changes: 12 additions & 14 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ We have provided two convenience scripts, `./installer.sh` and `./setup.sh`
that works in Python3.8 for installation and configuration of AutoTuner,
as shown below:

```{note}
Make sure you run the following commands in the ORFS root directory.
```

```shell
# Install prerequisites
./tools/AutoTuner/installer.sh
Expand Down Expand Up @@ -104,7 +100,7 @@ For Global Routing parameters that are set on `fastroute.tcl` you can use:

### General Information

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
The `autotuner.distributed` module uses [Ray's](https://docs.ray.io/en/latest/index.html) job scheduling and management to
fully utilize available hardware resources from a single server
configuration, on-premise or over the cloud with multiple CPUs.

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

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

```{note}
The following commands should be run from `./tools/AutoTuner`.
```

#### Tune only

* AutoTuner: `python3 distributed.py tune -h`
* AutoTuner: `python3 -m autotuner.distributed tune -h`

Example:

```shell
python3 distributed.py --design gcd --platform sky130hd \
--config ../../../../flow/designs/sky130hd/gcd/autotuner.json \
python3 -m autotuner.distributed --design gcd --platform sky130hd \
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
tune --samples 5
```
#### Sweep only

* Parameter sweeping: `python3 distributed.py sweep -h`
* Parameter sweeping: `python3 -m autotuner.distributed sweep -h`

Example:

```shell
python3 distributed.py --design gcd --platform sky130hd \
--config distributed-sweep-example.json \
python3 -m autotuner.distributed --design gcd --platform sky130hd \
--config src/autotuner/distributed-sweep-example.json \
sweep
```

Expand Down
2 changes: 1 addition & 1 deletion tools/AutoTuner/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ script_dir="$(dirname "${BASH_SOURCE[0]}")"
venv_name="autotuner_env"
python3 -m venv "$script_dir/$venv_name"
source "$script_dir/$venv_name/bin/activate"
pip3 install -U -r $script_dir/requirements.txt
pip3 install -e "$script_dir"
deactivate
28 changes: 28 additions & 0 deletions tools/AutoTuner/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[project]
name = "autotuner"
version = "0.0.1"
description = "This project provides a set of tools for tuning OpenROAD-flow-scripts parameter without user interference."
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD 3-Clause",
]
readme = "README.md"
requires-python = ">= 3.8"
dynamic = ["dependencies", "optional-dependencies"]

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }
optional-dependencies.dev = { file = ["requirements-dev.txt"] }

[build-system]
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src/"]
include = [
"autotuner*",
]

[tool.setuptools]
include-package-data = true
1 change: 1 addition & 0 deletions tools/AutoTuner/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
black
4 changes: 4 additions & 0 deletions tools/AutoTuner/src/autotuner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
AutoTuner module integrating Ray Tune and Vizier framework
for ORFS parameters optimization.
"""
Loading

0 comments on commit 97497e0

Please sign in to comment.