Skip to content
Snippets Groups Projects

Rodinia benches

Merged rarbore2 requested to merge rodinia_benches into main
5 files
+ 197
121
Compare changes
  • Side-by-side
  • Inline
Files
5
 
#![feature(concat_idents)]
 
use criterion::{criterion_group, criterion_main, Criterion};
 
 
use hercules_rt::{runner, HerculesImmBox, HerculesImmBoxTo, HerculesMutBox, HerculesMutBoxTo};
 
 
juno_build::juno!("srad");
 
 
use juno_srad::*;
 
 
fn srad_bench(c: &mut Criterion) {
 
let mut group = c.benchmark_group("srad bench");
 
 
let mut r = runner!(srad);
 
let niter = 100;
 
let lambda = 0.5;
 
let nrows = 502;
 
let ncols = 458;
 
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());
 
let mut iN = (0..nrows).map(|i| i as i32 - 1).collect::<Vec<_>>();
 
let mut iS = (0..nrows).map(|i| i as i32 + 1).collect::<Vec<_>>();
 
let mut jW = (0..ncols).map(|j| j as i32 - 1).collect::<Vec<_>>();
 
let mut jE = (0..ncols).map(|j| j as i32 + 1).collect::<Vec<_>>();
 
// Fix boundary conditions
 
iN[0] = 0;
 
iS[nrows - 1] = (nrows - 1) as i32;
 
jW[0] = 0;
 
jE[ncols - 1] = (ncols - 1) as i32;
 
let iN_h = HerculesImmBox::from(iN.as_slice());
 
let iS_h = HerculesImmBox::from(iS.as_slice());
 
let jW_h = HerculesImmBox::from(jW.as_slice());
 
let jE_h = HerculesImmBox::from(jE.as_slice());
 
group.bench_function("srad bench", |b| {
 
b.iter(|| {
 
async_std::task::block_on(async {
 
r.run(
 
nrows as u64,
 
ncols as u64,
 
niter as u64,
 
image_h.to(),
 
iN_h.to(),
 
iS_h.to(),
 
jW_h.to(),
 
jE_h.to(),
 
max,
 
lambda,
 
)
 
.await
 
});
 
})
 
});
 
}
 
 
criterion_group!(benches, srad_bench);
 
criterion_main!(benches);
Loading