Skip to content
Snippets Groups Projects

Set up cava benchmark

Merged rarbore2 requested to merge cava_opt_3 into main
2 files
+ 155
133
Compare changes
  • Side-by-side
  • Inline
Files
2
#![feature(concat_idents)]
use criterion::{criterion_group, criterion_main, Criterion};
use juno_cava::{cava_harness, CavaInputs};
use hercules_rt::{runner, HerculesImmBoxTo};
use juno_cava::*;
juno_build::juno!("cava");
fn cava_bench(c: &mut Criterion) {
let mut group = c.benchmark_group("cava bench");
group.sample_size(10);
let args = CavaInputs {
input: "examples/raw_tulip-small.bin".to_string(),
output: None,
verify: false,
output_verify: None,
cam_model: "cam_models/NikonD7000".to_string(),
crop_rows: Some(144),
crop_cols: Some(192),
};
let (raw_image, cam_model) = make_raw_image_and_cam_model(&args);
let (rows, cols, num_ctrl_pts, image, tstw, ctrl_pts, weights, coefs, tonemap) =
prepare_hercules_inputs(&raw_image, &cam_model);
let mut r = runner!(cava);
group.bench_function("cava bench small", |b| {
b.iter(|| {
async_std::task::block_on(r.run(
rows as u64,
cols as u64,
num_ctrl_pts as u64,
image.to(),
tstw.to(),
ctrl_pts.to(),
weights.to(),
coefs.to(),
tonemap.to(),
));
})
});
let args = CavaInputs {
input: "examples/raw_tulips.bin".to_string(),
output: None,
verify: true,
output_verify: None,
cam_model: "cam_models/NikonD7000".to_string(),
crop_rows: None,
crop_cols: None,
};
let (raw_image, cam_model) = make_raw_image_and_cam_model(&args);
let (rows, cols, num_ctrl_pts, image, tstw, ctrl_pts, weights, coefs, tonemap) =
prepare_hercules_inputs(&raw_image, &cam_model);
let mut r = runner!(cava);
fn cava_bench_small(c: &mut Criterion) {
c.bench_function("cava_bench_small", |b| {
group.bench_function("cava bench full", |b| {
b.iter(|| {
cava_harness(CavaInputs {
input: "examples/raw_tulip-small.bin".to_string(),
output: None,
verify: false,
output_verify: None,
cam_model: "cam_models/NikonD7000".to_string(),
crop_rows: Some(144),
crop_cols: Some(192),
})
async_std::task::block_on(r.run(
rows as u64,
cols as u64,
num_ctrl_pts as u64,
image.to(),
tstw.to(),
ctrl_pts.to(),
weights.to(),
coefs.to(),
tonemap.to(),
));
})
});
}
criterion_group!(benches, cava_bench_small);
criterion_group!(benches, cava_bench);
criterion_main!(benches);
Loading