Skip to content
Merged
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
37 changes: 26 additions & 11 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,28 @@ The order of the parameters matter. Arguments `--design`, `--platform` and
The following commands should be run from `./tools/AutoTuner`.
```

#### Tune only

* AutoTuner: `openroad_autotuner tune -h`
#### Tune only

Example:

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

* Parameter sweeping: `openroad_autotuner sweep -h`
#### Sweep only

Example:

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

#### Plot images
Expand All @@ -159,6 +160,19 @@ The graph will show the progression of one metric (see list below) over the exec
python3 utils/plot.py --results_dir <your-autotuner-result-path>
```

#### Work Directory

Use `--work-dir` to specify a writable directory for outputs. This is passed to ORFS as `WORK_HOME`.

```shell
python3 -m autotuner.distributed \
--design gcd \
--platform sky130hd \
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
--work-dir /tmp/autotuner123 \
tune --samples 5
```

### Google Cloud Platform (GCP) distribution with Ray

GCP Setup Tutorial coming soon.
Expand All @@ -171,6 +185,7 @@ GCP Setup Tutorial coming soon.
| `--platform` | Name of the platform for Autotuning. ||
| `--config` | Configuration file that sets which knobs to use for Autotuning. ||
| `--experiment` | Experiment name. This parameter is used to prefix the FLOW_VARIANT and to set the Ray log destination.| test |
| `--work-dir` | Work directory for outputs (passed to ORFS as WORK_HOME). | Installation directory |
| `--git_clean` | Clean binaries and build files. **WARNING**: may lose previous data. ||
| `--git_clone` | Force new git clone. **WARNING**: may lose previous data. ||
| `--git_clone_args` | Additional git clone arguments. ||
Expand Down
16 changes: 15 additions & 1 deletion tools/AutoTuner/src/autotuner/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
ORFS_FLOW_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../../../../flow")
)
# Path to the WORK_HOME directory
WORK_HOME = None
# Global variable for args
args = None

Expand Down Expand Up @@ -409,6 +411,13 @@ def parse_arguments():
default=10001,
help="The port of Ray server to connect.",
)
parser.add_argument(
"--work-dir",
type=str,
metavar="<path>",
default=None,
help="Work directory for outputs (passed to ORFS as WORK_HOME).",
)

parser.add_argument(
"-v",
Expand Down Expand Up @@ -612,9 +621,14 @@ def sweep():


def main():
global args, SDC_ORIGINAL, FR_ORIGINAL, LOCAL_DIR, INSTALL_PATH, ORFS_FLOW_DIR, config_dict, reference, best_params
global args, SDC_ORIGINAL, FR_ORIGINAL, LOCAL_DIR, INSTALL_PATH, ORFS_FLOW_DIR, WORK_HOME, config_dict, reference, best_params
args = parse_arguments()

# Set WORK_HOME from --work-dir argument
WORK_HOME = args.work_dir
if WORK_HOME:
print(f"[INFO TUN-0040] Work directory (WORK_HOME): {WORK_HOME}")

# Read config and original files before handling where to run in case we
# need to upload the files.
config_dict, SDC_ORIGINAL, FR_ORIGINAL = read_config(
Expand Down
3 changes: 3 additions & 0 deletions tools/AutoTuner/src/autotuner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ def openroad(
make_command += f"make -C {base_dir}/flow DESIGN_CONFIG=designs/"
make_command += f"{args.platform}/{args.design}/config.mk"
make_command += f" PLATFORM={args.platform}"
work_home = getattr(args, "work_dir", None)
if work_home is not None:
make_command += f" WORK_HOME={work_home}"
make_command += f" FLOW_VARIANT={flow_variant} {parameters}"
make_command += " EQUIVALENCE_CHECK=0"
make_command += f" NUM_CORES={args.openroad_threads} SHELL=bash"
Expand Down