From 754fc45f95991f32d7c916da3a8936849645db37 Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 2 Oct 2023 11:35:52 +0200 Subject: [PATCH] Rename method of `OutputObserver` from `process_kernel_output` to `process_output` --- kernel_tuner/accuracy.py | 4 ++-- kernel_tuner/core.py | 3 +-- kernel_tuner/observers/observer.py | 2 +- kernel_tuner/observers/powersensor.py | 2 +- kernel_tuner/runners/sequential.py | 1 + 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel_tuner/accuracy.py b/kernel_tuner/accuracy.py index 34598276f..1a24fef13 100644 --- a/kernel_tuner/accuracy.py +++ b/kernel_tuner/accuracy.py @@ -4,7 +4,7 @@ import logging import re -from .observers import OutputObserver +from kernel_tuner.observers import OutputObserver class Tunable(UserDict): @@ -283,7 +283,7 @@ def __init__(self, metric=None, key="error", *, atol=1e-8): self.metric = metric self.result = None - def process_kernel_output(self, answers, outputs): + def process_output(self, answers, outputs): errors = [] for answer, output in zip(answers, outputs): diff --git a/kernel_tuner/core.py b/kernel_tuner/core.py index 41e19f741..1a7be0562 100644 --- a/kernel_tuner/core.py +++ b/kernel_tuner/core.py @@ -6,7 +6,6 @@ import re import numpy as np -from kernel_tuner.accuracy import Tunable try: import cupy as cp @@ -423,7 +422,7 @@ def check_kernel_output(self, func, gpu_args, instance, answer, atol, verify, ve # Call the output observers for obs in self.output_observers: - obs.process_kernel_output(answer, result_host) + obs.process_output(answer, result_host) # There are three scenarios: # - if there is a custom verify function, call that. diff --git a/kernel_tuner/observers/observer.py b/kernel_tuner/observers/observer.py index 056a64a6a..493de94f8 100644 --- a/kernel_tuner/observers/observer.py +++ b/kernel_tuner/observers/observer.py @@ -51,7 +51,7 @@ class OutputObserver(BenchmarkObserver): """Observer that can verify or measure something about the output produced by a kernel.""" @abstractmethod - def process_kernel_output(self, answer, output): + def process_output(self, answer, output): """method will be called once before benchmarking of a single kernel configuration. The arguments provided are the `answer` as passed `tune_kernel` and the `output` produced by the kernel """ diff --git a/kernel_tuner/observers/powersensor.py b/kernel_tuner/observers/powersensor.py index 33ff979e2..6d07e8977 100644 --- a/kernel_tuner/observers/powersensor.py +++ b/kernel_tuner/observers/powersensor.py @@ -52,7 +52,7 @@ def after_finish(self): self.results["ps_energy"].append(ps_measured_e) if "ps_power" in self.observables: ps_measured_t = ( - end_state.time_at_read - self.begin_state.time_at_read + end_state.time_at_read - self.begin_state.time_at_read ) # seconds self.results["ps_power"].append(ps_measured_e / ps_measured_t) # Watt diff --git a/kernel_tuner/runners/sequential.py b/kernel_tuner/runners/sequential.py index 2b0362930..352a8321e 100644 --- a/kernel_tuner/runners/sequential.py +++ b/kernel_tuner/runners/sequential.py @@ -92,6 +92,7 @@ def run(self, parameter_space, tuning_options): warmup_time = 1e3 * (perf_counter() - warmup_time) result = self.dev.compile_and_benchmark(self.kernel_source, self.gpu_args, params, self.kernel_options, tuning_options) + params.update(result) if tuning_options.objective in result and isinstance(result[tuning_options.objective], ErrorConfig):