32 lines
1.2 KiB
Rust
32 lines
1.2 KiB
Rust
use coremem::Driver;
|
|
use coremem::geom::Index;
|
|
use coremem::mat::{Ferroxcube3R1MH, IsoConductorOr, GenericMaterial};
|
|
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
|
|
use criterion::{BenchmarkId, criterion_group, criterion_main, Criterion};
|
|
|
|
|
|
pub fn bench_step_spirv(c: &mut Criterion) {
|
|
type Mat = GenericMaterial<f32>;
|
|
for size in &[10, 20, 40, 80, 160] {
|
|
let sim = SpirvSim::<f32, Mat, WgpuBackend>::new(Index::new(*size, *size, *size), 1e-5);
|
|
c.bench_with_input(BenchmarkId::new("Driver::step_spirv", size), &sim, |b, sim| {
|
|
let mut driver = Driver::new(sim.clone());
|
|
b.iter(|| driver.step())
|
|
});
|
|
}
|
|
}
|
|
|
|
pub fn bench_step_spirv_iso_3r1(c: &mut Criterion) {
|
|
type Mat = IsoConductorOr<f32, Ferroxcube3R1MH>;
|
|
for size in &[10, 20, 40, 80, 160] {
|
|
let sim = SpirvSim::<f32, Mat, WgpuBackend>::new(Index::new(*size, *size, *size), 1e-5);
|
|
c.bench_with_input(BenchmarkId::new("Driver::spirv_ISO3R1", size), &sim, |b, sim| {
|
|
let mut driver = Driver::new(sim.clone());
|
|
b.iter(|| driver.step())
|
|
});
|
|
}
|
|
}
|
|
|
|
criterion_group!(benches, bench_step_spirv, bench_step_spirv_iso_3r1);
|
|
criterion_main!(benches);
|