From 4cf9d708a9dddef41b1519cfe0cdec3da10b8d93 Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Tue, 4 Mar 2025 09:58:06 -0600 Subject: [PATCH] cleanup srad bench --- .../rodinia/srad/benches/srad_bench.rs | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/juno_samples/rodinia/srad/benches/srad_bench.rs b/juno_samples/rodinia/srad/benches/srad_bench.rs index 23dc0643..bf0e4ad4 100644 --- a/juno_samples/rodinia/srad/benches/srad_bench.rs +++ b/juno_samples/rodinia/srad/benches/srad_bench.rs @@ -1,7 +1,7 @@ #![feature(concat_idents)] use criterion::{criterion_group, criterion_main, Criterion}; -use hercules_rt::{runner, HerculesImmBox, HerculesImmBoxTo, HerculesMutBox, HerculesMutBoxTo}; +use hercules_rt::{runner, HerculesMutBox, HerculesMutBoxTo}; juno_build::juno!("srad"); @@ -11,35 +11,37 @@ fn srad_bench(c: &mut Criterion) { let mut group = c.benchmark_group("srad bench"); group.sample_size(10); - let mut r = runner!(srad); - let niter = 30; - let lambda = 0.5; - let nrows = 2048; - let ncols = 2048; - let image = "data/image.pgm".to_string(); - let Image { - image: image_ori, - max, - rows: image_ori_rows, - cols: image_ori_cols, - } = read_graphics(image); - let image = resize(&image_ori, image_ori_rows, image_ori_cols, nrows, ncols); - let mut image_h = HerculesMutBox::from(image.clone()); - group.bench_function("srad bench large", |b| { - b.iter(|| { - async_std::task::block_on(async { - r.run( - nrows as u64, - ncols as u64, - niter as u64, - image_h.to(), - max, - lambda, - ) - .await - }); - }) - }); + let mut bench = |name, niter, nrows, ncols| { + let mut r = runner!(srad); + let lambda = 0.5; + let image = "data/image.pgm".to_string(); + let Image { + image: image_ori, + max, + rows: image_ori_rows, + cols: image_ori_cols, + } = read_graphics(image); + let image = resize(&image_ori, image_ori_rows, image_ori_cols, nrows, ncols); + let mut image_h = HerculesMutBox::from(image.clone()); + group.bench_function(name, |b| { + b.iter(|| { + async_std::task::block_on(async { + r.run( + nrows as u64, + ncols as u64, + niter as u64, + image_h.to(), + max, + lambda, + ) + .await + }); + }) + }); + }; + + bench("srad bench small", 100, 512, 512); + bench("srad bench large", 30, 2048, 2048); } criterion_group!(benches, srad_bench); -- GitLab