Parakeet v Whisper h2h #26
@@ -287,8 +287,22 @@ impl Transcriber for WhisperTranscriber {
|
||||
|
||||
#[cfg(feature = "cpu-transcription")]
|
||||
fn available_threads() -> std::ffi::c_int {
|
||||
// WA_WHISPER_THREADS: support/bench override — see cap rationale below.
|
||||
if let Some(n) = std::env::var("WA_WHISPER_THREADS")
|
||||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
{
|
||||
return n;
|
||||
}
|
||||
// Capped at 4 (whisper.cpp's own CLI default): ggml workers spin-wait at
|
||||
// a per-graph-node barrier, so one worker scheduled on a slow core stalls
|
||||
// every node while the rest burn CPU. With all 14 logical CPUs of a
|
||||
// hybrid Meteor Lake (incl. 2 LP E-cores) this measured RTF ~22 — ~80x
|
||||
// slower than the same build at 4 threads (RTF 0.28), regardless of
|
||||
// compiler flags. 4 threads is also the CPU-frugal choice (NFR-RES-1):
|
||||
// 1.07 vs 2.16 cpu-sec/audio-sec at 12 threads for near-equal wall time.
|
||||
std::thread::available_parallelism()
|
||||
.map(|n| n.get() as std::ffi::c_int)
|
||||
.map(|n| (n.get() as std::ffi::c_int).min(4))
|
||||
.unwrap_or(4)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user