Skip to content

Commit f6f315b

Browse files
committed
add initial scaffold
Signed-off-by: Jack Luar <[email protected]>
1 parent 461ad79 commit f6f315b

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

tools/AutoTuner/src/autotuner/distributed.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,19 @@ def parse_arguments():
271271
" FLOW_VARIANT and to set the Ray log destination.",
272272
)
273273
parser.add_argument(
274-
"--timeout",
274+
"--timeout_per_trial",
275275
type=float,
276276
metavar="<float>",
277277
default=None,
278278
help="Time limit (in hours) for each trial run. Default is no limit.",
279279
)
280+
parser.add_argument(
281+
"--timeout",
282+
type=float,
283+
metavar="<float>",
284+
default=None,
285+
help="Time limit (in hours) for the whole Autotuning process.",
286+
)
280287
tune_parser.add_argument(
281288
"--resume",
282289
action="store_true",
@@ -397,12 +404,19 @@ def parse_arguments():
397404
)
398405

399406
# Workload
407+
# parser.add_argument(
408+
# "--jobs",
409+
# type=int,
410+
# metavar="<int>",
411+
# default=int(np.floor(cpu_count() / 2)),
412+
# help="Max number of concurrent jobs.",
413+
# )
400414
parser.add_argument(
401-
"--jobs",
415+
"--cpu_budget",
402416
type=int,
403417
metavar="<int>",
404418
default=int(np.floor(cpu_count() / 2)),
405-
help="Max number of concurrent jobs.",
419+
help="Number of cpus to be used per hour.",
406420
)
407421
parser.add_argument(
408422
"--openroad_threads",
@@ -460,10 +474,18 @@ def parse_arguments():
460474
args.experiment = f"{args.mode}-{id}"
461475
else:
462476
args.experiment += f"-{args.mode}"
477+
args.experiment += f"-{args.mode}-{DATE}"
463478

479+
# Convert time to seconds
480+
if args.timeout_per_trial is not None:
481+
args.timeout_per_trial = round(args.timeout_per_trial * 3600)
464482
if args.timeout is not None:
465483
args.timeout = round(args.timeout * 3600)
466484

485+
# Calculate jobs
486+
jobs = int(args.cpu_budget / args.resources_per_trial)
487+
args["jobs"] = jobs
488+
467489
return args
468490

469491

@@ -619,6 +641,7 @@ def main():
619641
name=args.experiment,
620642
metric=METRIC,
621643
mode="min",
644+
time_budget_s=args.timeout,
622645
num_samples=args.samples,
623646
fail_fast=False,
624647
local_dir=LOCAL_DIR,

0 commit comments

Comments
 (0)