From 8116299631321a634d01a7c7edf0d4e254167a37 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 17 Nov 2020 18:18:35 +0100 Subject: [PATCH] Handle runtime OMP thread count exceeding build-time NUM_THREADS --- common_thread.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common_thread.h b/common_thread.h index a18df0d78..ce68da7c8 100644 --- a/common_thread.h +++ b/common_thread.h @@ -140,6 +140,7 @@ static __inline int num_cpu_avail(int level) { #ifdef USE_OPENMP int openmp_nthreads=omp_get_max_threads(); + if (openmp_nthreads > MAX_CPU_NUMBER) openmp_nthreads=MAX_CPU_NUMBER; #endif #ifndef USE_OPENMP