From 42d8bfedcfd6711e408859d6c21f917b9052094c Mon Sep 17 00:00:00 2001 From: Floris-Jan Willemsen Date: Mon, 9 Oct 2023 15:38:40 +0200 Subject: [PATCH] The best found configuration is now added to the envs dictionary returned from tune_kernel --- kernel_tuner/interface.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel_tuner/interface.py b/kernel_tuner/interface.py index 087a26f59..6545a76bd 100644 --- a/kernel_tuner/interface.py +++ b/kernel_tuner/interface.py @@ -677,14 +677,16 @@ def tune_kernel( env = runner.get_environment(tuning_options) # finished iterating over search space - if not device_options.quiet: - if results: # checks if results is not empty - best_config = util.get_best_config(results, objective, objective_higher_is_better) + if results: # checks if results is not empty + best_config = util.get_best_config(results, objective, objective_higher_is_better) + # add the best configuration to env + env['best_config'] = best_config + if not device_options.quiet: units = getattr(runner, "units", None) print("best performing configuration:") util.print_config_output(tune_params, best_config, device_options.quiet, metrics, units) - else: - print("no results to report") + elif not device_options.quiet: + print("no results to report") if cache: util.close_cache(cache)