tests : override hardware_concurrency in CI (#31797)

The self-hosted CPU runners are containers with 8 CPUs, but
std::thread::hardware_concurrency reports the cores of the host. The
table mode of test-llama-context sizes its pool from that count, so it
runs 4 models x 8 threads on an 8-CPU job and hangs.

Add TEST_ARG_HARDWARE_CONCURRENCY and TEST_ARG_PARALLEL_WORKERS as the
defaults for the auto-selected counts of test-llama-context and of
test-backend-ops, and set them to 8 and 4 for cpu-x64-high-perf.

Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB)
This commit is contained in:
Georgi Gerganov authored and GitHub committed 2026-11-06 14:52:26 +02:00
1 parent 18ab62a8ec
commit 9a1d03c7ca
3 files changed
+59 -4

No files matched your search

+26 -2
View File
@@ -48,9 +48,33 @@
#ifdef __EMSCRIPTEN__
# define N_THREADS 1
#else
# define N_THREADS std::thread::hardware_concurrency()
static unsigned test_hardware_concurrency() {
const char * env = std::getenv("TEST_ARG_HARDWARE_CONCURRENCY");
if (env != nullptr) {
const long n = std::strtol(env, nullptr, 10);
if (n > 0) {
return (unsigned) n;
}
}
return std::thread::hardware_concurrency();
}
# define N_THREADS test_hardware_concurrency()
#endif
static int test_parallel_workers(int default_workers) {
const char * env = std::getenv("TEST_ARG_PARALLEL_WORKERS");
if (env != nullptr) {
const long n = std::strtol(env, nullptr, 10);
if (n > 0) {
return (int) n;
}
}
return default_workers;
}
static void init_tensor_uniform(ggml_tensor * tensor, float min = -1.0f, float max = 1.0f) {
if (ggml_is_empty(tensor)) {
return;
@@ -14048,7 +14072,7 @@ int main(int argc, char ** argv) {
const char * backend_filter = nullptr;
const char * params_filter = nullptr;
const char * test_file_path = nullptr;
int parallel_workers = 1;
int parallel_workers = test_parallel_workers(1);
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "test") == 0) {