Add benching of matrix creation
This commit is contained in:
parent
d00e7b3fb1
commit
3671ba5e1f
|
@ -69,5 +69,48 @@ fn performance_benchmark(c: &mut Criterion) {
|
||||||
group.finish();
|
group.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "sparse")]
|
||||||
|
fn sparse_creation(c: &mut Criterion) {
|
||||||
|
let mut group = c.benchmark_group("MaxwellSystem");
|
||||||
|
group.sample_size(25);
|
||||||
|
let w = 40;
|
||||||
|
let h = 26;
|
||||||
|
group.bench_function("create_rhs_trad4", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
let _matrix = maxwell::sparse::rhs_matrix(&SBP4, w, h);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
group.bench_function("create_rhs_upwind4", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
let _matrix = maxwell::sparse::rhs_matrix(&sbp::operators::Upwind4, w, h);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
group.bench_function("create_rhs_upwind9", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
let _matrix = maxwell::sparse::rhs_matrix(&sbp::operators::Upwind9, w, h);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
group.bench_function("create_rhs_upwind_upwind4", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
let _matrix =
|
||||||
|
maxwell::sparse::rhs_matrix_with_upwind_dissipation(&sbp::operators::Upwind4, w, h);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
group.bench_function("create_rhs_upwind_upwind9", |b| {
|
||||||
|
b.iter(|| {
|
||||||
|
let _matrix =
|
||||||
|
maxwell::sparse::rhs_matrix_with_upwind_dissipation(&sbp::operators::Upwind9, w, h);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "sparse")]
|
||||||
|
criterion_group!(sparse_create, sparse_creation);
|
||||||
criterion_group!(benches, performance_benchmark);
|
criterion_group!(benches, performance_benchmark);
|
||||||
|
|
||||||
|
#[cfg(feature = "sparse")]
|
||||||
|
criterion_main!(benches, sparse_create);
|
||||||
|
#[cfg(not(feature = "sparse"))]
|
||||||
criterion_main!(benches);
|
criterion_main!(benches);
|
||||||
|
|
|
@ -6,7 +6,7 @@ use sbp::operators::{SbpOperator2d, UpwindOperator2d};
|
||||||
use sbp::Float;
|
use sbp::Float;
|
||||||
|
|
||||||
#[cfg(feature = "sparse")]
|
#[cfg(feature = "sparse")]
|
||||||
mod sparse;
|
pub mod sparse;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Field(pub(crate) Array3<Float>);
|
pub struct Field(pub(crate) Array3<Float>);
|
||||||
|
|
Loading…
Reference in New Issue