Skip to content

Commit 2f988b6

Browse files
committed
update --config flags
Signed-off-by: Jack Luar <[email protected]>
1 parent 8d69b7c commit 2f988b6

File tree

8 files changed

+34
-25
lines changed

8 files changed

+34
-25
lines changed

docs/user/InstructionsForAutoTuner.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ Example:
133133

134134
```shell
135135
openroad_autotuner --design gcd --platform sky130hd \
136+
tune --samples 5 \
136137
--config ../../flow/designs/sky130hd/gcd/autotuner.json \
137-
tune --samples 5
138138
```
139139
#### Sweep only
140140

@@ -144,8 +144,8 @@ Example:
144144

145145
```shell
146146
openroad_autotuner --design gcd --platform sky130hd \
147-
--config src/autotuner/distributed-sweep-example.json \
148-
sweep
147+
sweep \
148+
--config src/autotuner/distributed-sweep-example.json
149149
```
150150

151151
#### Plot images

tools/AutoTuner/src/autotuner/distributed.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
sweep
6060
"""
6161

62-
import argparse
62+
import jsonargparse
6363
import json
6464
import os
6565
import sys
@@ -260,13 +260,13 @@ def parse_arguments():
260260
"""
261261
Parse arguments from command line.
262262
"""
263-
parser = argparse.ArgumentParser()
263+
parser = jsonargparse.ArgumentParser()
264+
tune_parser = jsonargparse.ArgumentParser()
265+
sweep_parser = jsonargparse.ArgumentParser()
264266

265-
subparsers = parser.add_subparsers(
266-
help="mode of execution", dest="mode", required=True
267-
)
268-
tune_parser = subparsers.add_parser("tune")
269-
_ = subparsers.add_parser("sweep")
267+
subcommands = parser.add_subcommands(dest="mode")
268+
subcommands.add_subcommand("tune", tune_parser)
269+
subcommands.add_subcommand("sweep", sweep_parser)
270270

271271
# DUT
272272
parser.add_argument(
@@ -285,13 +285,6 @@ def parse_arguments():
285285
)
286286

287287
# Experiment Setup
288-
parser.add_argument(
289-
"--config",
290-
type=str,
291-
metavar="<path>",
292-
required=True,
293-
help="Configuration file that sets which knobs to use for Autotuning.",
294-
)
295288
parser.add_argument(
296289
"--experiment",
297290
type=str,
@@ -307,14 +300,30 @@ def parse_arguments():
307300
default=None,
308301
help="Time limit (in hours) for each trial run. Default is no limit.",
309302
)
303+
304+
# Sweep-specific
305+
sweep_parser.add_argument(
306+
"--config",
307+
type=str,
308+
metavar="<path>",
309+
required=True,
310+
help="Configuration file that sets which knobs to use for Autotuning.",
311+
)
312+
313+
# Tune-Specific
310314
tune_parser.add_argument(
311315
"--resume",
312316
action="store_true",
313317
help="Resume previous run. Note that you must also set a unique experiment\
314318
name identifier via `--experiment NAME` to be able to resume.",
315319
)
316-
317-
# ML
320+
tune_parser.add_argument(
321+
"--config",
322+
type=str,
323+
metavar="<path>",
324+
required=True,
325+
help="Configuration file that sets which knobs to use for Autotuning.",
326+
)
318327
tune_parser.add_argument(
319328
"--algorithm",
320329
type=str,

tools/AutoTuner/test/ref_file_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def setUp(self):
5959
def _execute_autotuner(self, platform, design, config_file, error_code=None):
6060
full_path = os.path.abspath(os.path.join(self._cur_dir, config_file))
6161

62-
cmd = f"{self._exec} --design {design} --platform {platform} --config {full_path} tune --samples 1"
62+
cmd = f"{self._exec} --design {design} --platform {platform} tune --samples 1 --config {full_path}"
6363

6464
out = subprocess.run(cmd, shell=True, text=True, capture_output=True)
6565
failed = out.returncode != 0

tools/AutoTuner/test/resume_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def setUp(self):
8585
f"{self.exec}"
8686
f" --design {self.design}"
8787
f" --platform {self.platform}"
88-
f" --config {self.config}"
8988
f" --jobs {self.jobs}"
9089
f" --experiment test-resume"
9190
f" tune --iterations {self.iterations} --samples {self.samples}"
91+
f" --config {self.config}"
9292
f" --resources_per_trial {res_per_trial}"
9393
f" {c}"
9494
for c in options

tools/AutoTuner/test/smoke_test_algo_eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def setUp(self):
6060
f" --design {self.design}"
6161
f" --platform {self.platform}"
6262
f" --experiment {self.experiment}"
63-
f" --config {self.config}"
6463
f" tune --samples 5"
64+
f" --config {self.config}"
6565
f" --algorithm {a} --eval {e}"
6666
f" --reference {self.reference}"
6767
for a, e in self.matrix

tools/AutoTuner/test/smoke_test_sample_iteration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def setUp(self):
5757
f" --design {self.design}"
5858
f" --platform {self.platform}"
5959
f" --experiment {self.experiment}"
60-
f" --config {self.config}"
6160
f" tune --samples {s} --iterations {i}"
61+
f" --config {self.config}"
6262
for s, i in self.matrix
6363
]
6464

tools/AutoTuner/test/smoke_test_sweep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ def setUp(self):
7171
f" --design {self.design}"
7272
f" --platform {self.platform}"
7373
f" --experiment {self.experiment}"
74-
f" --config {self.config}"
7574
f" --jobs {self.jobs}"
7675
f" sweep"
76+
f" --config {self.config}"
7777
)
7878

7979
def test_sweep(self):

tools/AutoTuner/test/smoke_test_tune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def setUp(self):
5656
f" --design {self.design}"
5757
f" --platform {self.platform}"
5858
f" --experiment {self.experiment}"
59-
f" --config {self.config}"
6059
f" tune --samples 5"
60+
f" --config {self.config}"
6161
)
6262

6363
def test_tune(self):

0 commit comments

Comments
 (0)