From b1970233ee1f807a133e7badf7b7b3a4eda7f803 Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Sun, 2 Mar 2025 17:53:32 -0600 Subject: [PATCH] verify flag for cfd --- juno_samples/rodinia/cfd/src/lib.rs | 67 +++++++++++++++------------- juno_samples/rodinia/cfd/src/main.rs | 2 + 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/juno_samples/rodinia/cfd/src/lib.rs b/juno_samples/rodinia/cfd/src/lib.rs index d61df4c5..a9800ed0 100644 --- a/juno_samples/rodinia/cfd/src/lib.rs +++ b/juno_samples/rodinia/cfd/src/lib.rs @@ -19,6 +19,8 @@ pub struct CFDInputs { pub block_size: usize, #[clap(short = None, long = Some("pre-euler"))] pub pre_euler: bool, + #[clap(short, long)] + pub verify: bool, } fn run_euler( @@ -219,6 +221,7 @@ pub fn cfd_harness(args: CFDInputs) { iterations, block_size, pre_euler, + verify, } = args; let FarFieldConditions { @@ -268,37 +271,39 @@ pub fn cfd_harness(args: CFDInputs) { &ff_fc_momentum_z, ) }; - let res_rust = if pre_euler { - rust_cfd::pre_euler( - nelr, - iterations, - variables, - areas.as_slice(), - elements_surrounding_elements.as_slice(), - &normals, - &ff_variable, - &ff_fc_density_energy, - &ff_fc_momentum_x, - &ff_fc_momentum_y, - &ff_fc_momentum_z, - ) - } else { - rust_cfd::euler( - nelr, - iterations, - variables, - areas.as_slice(), - elements_surrounding_elements.as_slice(), - &normals, - &ff_variable, - &ff_fc_density_energy, - &ff_fc_momentum_x, - &ff_fc_momentum_y, - &ff_fc_momentum_z, - ) - }; + if verify { + let res_rust = if pre_euler { + rust_cfd::pre_euler( + nelr, + iterations, + variables, + areas.as_slice(), + elements_surrounding_elements.as_slice(), + &normals, + &ff_variable, + &ff_fc_density_energy, + &ff_fc_momentum_x, + &ff_fc_momentum_y, + &ff_fc_momentum_z, + ) + } else { + rust_cfd::euler( + nelr, + iterations, + variables, + areas.as_slice(), + elements_surrounding_elements.as_slice(), + &normals, + &ff_variable, + &ff_fc_density_energy, + &ff_fc_momentum_x, + &ff_fc_momentum_y, + &ff_fc_momentum_z, + ) + }; - if !compare_floats(&res_juno, &res_rust) { - panic!("Mismatch in results"); + if !compare_floats(&res_juno, &res_rust) { + panic!("Mismatch in results"); + } } } diff --git a/juno_samples/rodinia/cfd/src/main.rs b/juno_samples/rodinia/cfd/src/main.rs index 277a3edb..2dd9a364 100644 --- a/juno_samples/rodinia/cfd/src/main.rs +++ b/juno_samples/rodinia/cfd/src/main.rs @@ -14,6 +14,7 @@ fn test_euler() { iterations: 1, block_size: 16, pre_euler: false, + verify: true, }); } @@ -24,5 +25,6 @@ fn test_pre_euler() { iterations: 1, block_size: 16, pre_euler: true, + verify: true, }); } -- GitLab