Skip to content

Commit

Permalink
test: multithreaded benchmarks with no run number variation
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Sep 25, 2024
1 parent 5b9d51b commit a778a34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions src/iguana/tests/include/TestMultithreading.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ inline int TestMultithreading(
algo_name,
prerequisite_algos,
bank_names,
// vary_run,
vary_run,
verbose,
num_events_per_thread,
num_events_per_frame,
Expand Down Expand Up @@ -118,18 +118,21 @@ inline int TestMultithreading(
event.read(bank);

// occasionally vary the run number (if the user wants to)
if(run_config_bank_idx.has_value())
if(vary_run && run_config_bank_idx.has_value()) {
// === rapid variation ===
banks[run_config_bank_idx.value()].putInt("run", 0, std::rand() % 3000);
// if(vary_run && run_config_bank_idx.has_value()) {
// if(std::rand() % 10 == 0) {
// auto runnum = banks[run_config_bank_idx.value()].getInt("run", 0);
// runnum += (std::rand() % 2 == 0) ? 1 : -1; // randomly increase or decrease the runnum by 1
// banks[run_config_bank_idx.value()].putInt("run", 0, runnum);
// }
// else if(std::rand() % 10 == 1) {
// banks[run_config_bank_idx.value()].putInt("run", 0, 1); // set the runnum to '1'
// }
// }
// === slower variation ===
/*
if(std::rand() % 10 == 0) {
auto runnum = banks[run_config_bank_idx.value()].getInt("run", 0);
runnum += (std::rand() % 2 == 0) ? 1 : -1; // randomly increase or decrease the runnum by 1
banks[run_config_bank_idx.value()].putInt("run", 0, runnum);
}
else if(std::rand() % 10 == 1) {
banks[run_config_bank_idx.value()].putInt("run", 0, 1); // set the runnum to '1'
}
*/
}

// run the iguana algorithm
seq.Run(banks, order);
Expand Down
2 changes: 1 addition & 1 deletion src/iguana/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ foreach algo : algo_dict
'multithreading',
'-j', get_option('test_multithreading').to_string(),
'-m', concurrency_model,
'-V',
# '-V', # vary run number
]
test(
'-'.join(['multithreading', concurrency_model, test_name_algo]),
Expand Down

0 comments on commit a778a34

Please sign in to comment.