Files
fdtd-coremem/crates/coremem/benches/driver.rs
colin 859a7f8b18 rename FullyGenericMaterial -> GenericMaterial
this naming was an artifact from the separate CPU/GPU material implementations.
2022-12-07 09:46:33 +00:00

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);