Trait cubecl_runtime::benchmark::Benchmark

source ·
pub trait Benchmark {
    type Args: Clone;

    // Required methods
    fn prepare(&self) -> Self::Args;
    fn execute(&self, args: Self::Args);
    fn name(&self) -> String;
    fn sync(&self);

    // Provided methods
    fn num_samples(&self) -> usize { ... }
    fn options(&self) -> Option<String> { ... }
    fn shapes(&self) -> Vec<Vec<usize>> { ... }
    fn run(&self) -> BenchmarkDurations { ... }
}
Expand description

Benchmark trait.

Required Associated Types§

source

type Args: Clone

Benchmark arguments.

Required Methods§

source

fn prepare(&self) -> Self::Args

Prepare the benchmark, run anything that is essential for the benchmark, but shouldn’t count as included in the duration.

§Notes

This should not include warmup, the benchmark will be run at least one time without measuring the execution time.

source

fn execute(&self, args: Self::Args)

Execute the benchmark and returns the time it took to complete.

source

fn name(&self) -> String

Name of the benchmark, should be short and it should match the name defined in the crate Cargo.toml

source

fn sync(&self)

Wait for computed to be over

Provided Methods§

source

fn num_samples(&self) -> usize

Number of samples per run required to have a statistical significance.

source

fn options(&self) -> Option<String>

The options passed to the benchmark.

source

fn shapes(&self) -> Vec<Vec<usize>>

Shapes dimensions

source

fn run(&self) -> BenchmarkDurations

Run the benchmark a number of times.

Implementors§

source§

impl<S: ComputeServer, C: ComputeChannel<S>, Out> Benchmark for TuneBenchmark<S, C, Out>

§

type Args = Box<dyn AutotuneOperation<Out>>