Skip to content

Commit

Permalink
Fixup poh_bench
Browse files Browse the repository at this point in the history
  • Loading branch information
steviez committed Mar 25, 2024
1 parent d8f10f3 commit 58f3e04
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions poh-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ solana-entry = { workspace = true }
solana-logger = { workspace = true }
solana-measure = { workspace = true }
solana-perf = { workspace = true }
solana-rayon-threadlimit = { workspace = true }
solana-sdk = { workspace = true }
solana-version = { workspace = true }

Expand Down
23 changes: 16 additions & 7 deletions poh-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use {
clap::{crate_description, crate_name, Arg, Command},
solana_measure::measure::Measure,
solana_perf::perf_libs,
solana_rayon_threadlimit::get_max_thread_count,
solana_sdk::hash::hash,
};

Expand Down Expand Up @@ -73,6 +74,14 @@ fn main() {
let start_hash = hash(&[1, 2, 3, 4]);
let ticks = create_ticks(max_num_entries, hashes_per_tick, start_hash);
let mut num_entries = start_num_entries as usize;
let num_threads = matches
.value_of_t("num_threads")
.unwrap_or(get_max_thread_count());
let threadpool = rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
.thread_name(|i| format!("solPohBench{i:02}"))
.build()
.expect("rayon threadpool");
if matches.is_present("cuda") {
perf_libs::init_cuda();
}
Expand All @@ -81,8 +90,8 @@ fn main() {
let mut time = Measure::start("time");
for _ in 0..iterations {
assert!(ticks[..num_entries]
.verify_cpu_generic(&start_hash)
.finish_verify());
.verify_cpu_generic(&start_hash, &threadpool)
.finish_verify(&threadpool));
}
time.stop();
println!(
Expand All @@ -100,7 +109,7 @@ fn main() {
let mut time = Measure::start("time");
for _ in 0..iterations {
assert!(ticks[..num_entries]
.verify_cpu_x86_simd(&start_hash, 8)
.verify_cpu_x86_simd(&start_hash, 8, &threadpool)
.finish_verify());
}
time.stop();
Expand All @@ -115,8 +124,8 @@ fn main() {
let mut time = Measure::start("time");
for _ in 0..iterations {
assert!(ticks[..num_entries]
.verify_cpu_x86_simd(&start_hash, 16)
.finish_verify());
.verify_cpu_x86_simd(&start_hash, 16, &threadpool)
.finish_verify(&threadpool));
}
time.stop();
println!(
Expand All @@ -132,8 +141,8 @@ fn main() {
let recyclers = VerifyRecyclers::default();
for _ in 0..iterations {
assert!(ticks[..num_entries]
.start_verify(&start_hash, recyclers.clone())
.finish_verify());
.start_verify(&start_hash, &threadpool, recyclers.clone())
.finish_verify(&threadpool));
}
time.stop();
println!(
Expand Down

0 comments on commit 58f3e04

Please sign in to comment.