Skip to content

Commit 77676c8

Browse files
committed
Support for time-based cutoff with T1 format
1 parent 2d24ae9 commit 77676c8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel_tuner/interface.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,14 @@ def tune_kernel_T1(
891891
strategy_options[attribute["Name"]] = attribute["Value"]
892892
if "Budget" in inputs:
893893
budget = inputs["Budget"][0]
894-
assert budget["Type"] == "ConfigurationCount"
895894
if strategy_options is None:
896895
strategy_options = {}
897-
strategy_options["max_fevals"] = budget["BudgetValue"]
896+
if budget["Type"] == "ConfigurationCount":
897+
strategy_options["max_fevals"] = budget["BudgetValue"]
898+
elif budget["Type"] == "TuningDuration":
899+
strategy_options["time_limit"] = budget["BudgetValue"] # both are in seconds
900+
else:
901+
raise NotImplementedError(f"Budget type in {budget} is not supported")
898902

899903
# set the cache path
900904
if cache_filepath is None and "SimulationInput" in kernelspec:
@@ -971,7 +975,6 @@ def tune_kernel_T1(
971975
raise NotImplementedError(f"Conversion for this type of argument has not yet been implemented: {arg}")
972976

973977
# tune with the converted inputs
974-
# TODO get_t4_results calls once available in T1
975978
results, env = tune_kernel(
976979
kernel_name,
977980
kernel_source,

0 commit comments

Comments
 (0)