From: Sigbjørn Skjæret Date: Thu, 2 Oct 2025 18:10:12 +0000 (+0200) Subject: test-barrier : do not use more threads than physically available (#16389) X-Git-Tag: upstream/0.0.6764~91 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=d64c8104f090b27b1f99e8da5995ffcfa6b726e2;p=pkg%2Fggml%2Fsources%2Fllama.cpp test-barrier : do not use more threads than physically available (#16389) * do not use more threads than physically available * ensure n_threads > 0 Co-authored-by: Jeff Bolz --------- Co-authored-by: Jeff Bolz --- diff --git a/tests/test-barrier.cpp b/tests/test-barrier.cpp index d85bf912..04c27761 100644 --- a/tests/test-barrier.cpp +++ b/tests/test-barrier.cpp @@ -1,6 +1,5 @@ #include "ggml.h" #include "ggml-cpu.h" -#include "ggml-backend.h" #include #include @@ -8,12 +7,13 @@ #include #include #include +#include #define MAX_NARGS 2 int main(int argc, char *argv[]) { - int n_threads = 4; + int n_threads = std::max(1, std::min(4, (int) std::thread::hardware_concurrency())); int n_rounds = 100; if (argc > 1) {