Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 70 additions & 0 deletions docs/user/CLIGuideAutotuner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Autotuner CLI Guide

AutoTuner may be triggered by specifying a configuration path instead of
typing every single argument one-by-one.

## Motivation of Configuration files

Why configuration files?
- Improve CLI user experience - less typing, less mistakes.
- Greatly simplify the reproducibility of experiments - share your configuration
file for easier experiment tracking!

Previously for a command like tune, you might have had to do:

```shell
openroad_autotuner --design gcd --platform sky130hd --experiment abcdef \
--verbose \
--jobs 4 --openroad_threads 16 \
tune \
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
--samples 5 --iterations 1 --algorithm hyperopt \
--resources_per_trial 1.0 --seed 42
```

With our new approach all you have to do is specify a YAML document `cli.yaml`

```yaml
---
# Common
design: gcd
platform: sky130hd
experiment: test
verbose: 0

# Workload
jobs: 4
openroad_threads: 16

# Tune-specific (set these if mode is tune)
tune:
algorithm: hyperopt
eval: default
samples: 10
iterations: 1
resources_per_trial: 1.0
reference: null
perturbation: 25
seed: 42
config: ../../flow/designs/sky130hd/gcd/autotuner.json
```

and run:

```bash
# Make sure you run this in `./tools/AutoTuner` directory.
python3 -m autotuner.distributed --yaml cli.yaml tune
```

## How to generate new config files

```bash
python3 -m autotuner.distributed --design gcd --platform sky130hd --experiment abcdef \
--verbose \
--jobs 4 --openroad_threads 16 \
--print_config \
tune \
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
--samples 5 --iterations 1 --algorithm hyperopt \
--resources_per_trial 1.0 --seed 42 > new_test.yaml
```
17 changes: 10 additions & 7 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ The `autotuner.distributed` module uses [Ray's](https://docs.ray.io/en/latest/in
fully utilize available hardware resources from a single server
configuration, on-premise or over the cloud with multiple CPUs.

For advanced users, we have provided a configuration file, please
refer to [this guide](./CLIGuideAutotuner.md).

The two modes of operation:
- `sweep`, where every possible parameter combination in the search space is tested
- `tune`, where we use Ray's Tune feature to intelligently search the space and optimize hyperparameters using one of the algorithms listed above.
Expand All @@ -124,25 +127,25 @@ The following commands should be run from `./tools/AutoTuner`.

#### Tune only

* AutoTuner: `openroad_autotuner tune -h`
* AutoTuner: `python -m autotuner.distributed tune -h`

Example:

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

* Parameter sweeping: `openroad_autotuner sweep -h`
* Parameter sweeping: `python -m autotuner.distributed sweep -h`

Example:

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

#### Plot images
Expand Down
29 changes: 29 additions & 0 deletions tools/AutoTuner/cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# Common
design: gcd
platform: sky130hd
experiment: test
timeout: null
verbose: 0

# Workload
jobs: 4
openroad_threads: 16
server: null
port: 10001

# Tune-specific
tune:
config: ../../flow/designs/sky130hd/gcd/autotuner.json
algorithm: hyperopt
eval: default
samples: 10
iterations: 1
resources_per_trial: 1.0
reference: null
perturbation: 25
seed: 42

# Sweep-specific
sweep:
config: ./src/autotuner/distributed-sweep-example.json
1 change: 1 addition & 0 deletions tools/AutoTuner/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ SQLAlchemy==1.4.17
urllib3>=1.26.17
matplotlib==3.10.0
pyyaml==6.0.1
jsonargparse==4.38.0
Loading