Skip to content

Commit c1b447c

Browse files
committed
Raise an exception if the time budget is exceeded before the actual tuning starts
1 parent b1c8240 commit c1b447c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

kernel_tuner/interface.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,13 @@ def tune_kernel(
683683
print(f"Searchspace has {searchspace.size} configurations after restrictions.")
684684

685685
# register the times and raise an exception if the budget is exceeded
686-
tuning_options["startup_time"] = perf_counter() - start_overhead_time
687-
if tuning_options["startup_time"] > tuning_options["time_limit"]:
688-
raise RuntimeError(
689-
f"The startup time of the tuning process ({tuning_options["startup_time"]} seconds) has exceeded the time limit ({tuning_options["time_limit"]} seconds). "
690-
"Please increase the time limit or decrease the size of the search space."
691-
)
686+
if "time_limit" in tuning_options:
687+
tuning_options["startup_time"] = perf_counter() - start_overhead_time
688+
if tuning_options["startup_time"] > tuning_options["time_limit"]:
689+
raise RuntimeError(
690+
f"The startup time of the tuning process ({tuning_options["startup_time"]} seconds) has exceeded the time limit ({tuning_options["time_limit"]} seconds). "
691+
"Please increase the time limit or decrease the size of the search space."
692+
)
692693
tuning_options["start_time"] = perf_counter()
693694

694695
# call the strategy to execute the tuning process

0 commit comments

Comments
 (0)