Skip to content

Commit

Permalink
added check_and_retrive strategy option
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloLurati committed Jun 10, 2024
1 parent acaaeb1 commit 63d9f65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kernel_tuner/runners/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def run(self, parameter_space, tuning_options):
return results

def config_in_cache(self, x_int, tuning_options):
if self.cache_manager:
if self.cache_manager and tuning_options.strategy_options['check_and_retrieve']:
return ray.get(self.cache_manager.check_and_retrieve.remote(x_int))
elif tuning_options.cache and x_int in tuning_options.cache:
return tuning_options.cache[x_int]
Expand Down
1 change: 1 addition & 0 deletions kernel_tuner/strategies/brute_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
def tune(searchspace: Searchspace, runner, tuning_options):

if isinstance(runner, ParallelRunner):
tuning_options.strategy_options['check_and_retrieve'] = False
cache_manager = CacheManager.remote(tuning_options.cache, tuning_options.cachefile)
return runner.run(parameter_space=searchspace.sorted_list(), tuning_options=tuning_options, cache_manager=cache_manager)
else:
Expand Down
1 change: 1 addition & 0 deletions kernel_tuner/strategies/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def tune(searchspace: Searchspace, runner, tuning_options, cache_manager=None, a
if 'bayes_opt' in ensemble: # All strategies start from a random sample except for BO
tuning_options.strategy_options["samplingmethod"] = 'random'
tuning_options.strategy_options["max_fevals"] = options.get("max_fevals", 100 * ensemble_size)
tuning_options.strategy_options['check_and_retrieve'] = True

if num_devices < ensemble_size:
warnings.warn("Number of devices is less than the number of strategies in the ensemble. Some strategies will wait until devices are available.", UserWarning)
Expand Down

0 comments on commit 63d9f65

Please sign in to comment.