-
Notifications
You must be signed in to change notification settings - Fork 413
/
tune_benchmark.rs
44 lines (34 loc) · 982 Bytes
/
tune_benchmark.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use burn_common::benchmark::Benchmark;
use crate::channel::ComputeChannel;
use crate::client::ComputeClient;
use crate::server::ComputeServer;
use super::AutotuneOperation;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
/// A benchmark that runs on server handles
#[derive(new)]
pub struct TuneBenchmark<S: ComputeServer, C> {
operation: Box<dyn AutotuneOperation>,
client: ComputeClient<S, C>,
}
impl<S: ComputeServer, C: ComputeChannel<S>> Benchmark for TuneBenchmark<S, C> {
type Args = Box<dyn AutotuneOperation>;
fn prepare(&self) -> Self::Args {
self.operation.clone()
}
fn num_samples(&self) -> usize {
10
}
fn execute(&self, operation: Self::Args) {
AutotuneOperation::execute(operation);
}
fn name(&self) -> String {
"autotune".to_string()
}
fn backend_config_name(&self) -> Option<String> {
None
}
fn sync(&self) {
self.client.sync();
}
}