Skip to content

Commit a136e53

Browse files
committed
part-bench: cool down for 4s between runs
part-bench pins the rayon threads to CPU cores, so that runs at lower thread counts are not affected by how memory is laid out. On strong scaling runs, this can cause overheating since the first cores are working the most, while the later ones start fresh.
1 parent b6b1c43 commit a136e53

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/src/bin/part-bench/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use mesh_io::weight;
66
use std::env;
77
use std::fs;
88
use std::io;
9+
use std::thread::sleep;
10+
use std::time::Duration;
911

1012
const USAGE: &str = "Usage: part-bench [options]";
1113

@@ -135,11 +137,16 @@ fn main_d<const D: usize>(
135137
let max_threads = rayon::current_num_threads();
136138
let mut g = c.benchmark_group(benchmark_name);
137139
let mut thread_count = 1;
138-
while thread_count <= max_threads {
140+
loop {
139141
let pool = build_pool(thread_count);
140142
let benchmark_name = format!("threads={thread_count}");
141143
g.bench_function(&benchmark_name, |b| pool.install(|| b.iter(&mut benchmark)));
142144
thread_count *= 2;
145+
if max_threads < thread_count {
146+
break;
147+
}
148+
println!("Waiting 4s for CPUs to cool down...");
149+
sleep(Duration::from_secs(4));
143150
}
144151
} else {
145152
c.bench_function(&benchmark_name, |b| b.iter(&mut benchmark));

0 commit comments

Comments
 (0)