From 8d68fefa48d289fff36a949bf0a3a60e2b3c4ae0 Mon Sep 17 00:00:00 2001 From: conrad Date: Sat, 30 Aug 2025 20:33:38 +1000 Subject: [PATCH] use threshold size of 30x30 for triggering openmp path --- include/armadillo_bits/mul_gemm.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/armadillo_bits/mul_gemm.hpp b/include/armadillo_bits/mul_gemm.hpp index aa33fbc1..b409a4f3 100644 --- a/include/armadillo_bits/mul_gemm.hpp +++ b/include/armadillo_bits/mul_gemm.hpp @@ -236,13 +236,17 @@ struct gemm_emul_large const uword B_n_cols = B.n_cols; #if defined(ARMA_USE_OPENMP) - if( (mp_thread_limit::in_parallel() == false) && (A_n_rows >= 2) && (A_n_cols >= 2) && (B_n_rows >= 2) && (B_n_cols >= 2) ) { - // TODO: the above limits on matrix sizes are place holders; - // TODO: need take into account transposes when determining if it's worth using the parallelised version - gemm_emul_large_mp::apply(C,A,B,alpha,beta); + constexpr uword threshold = uword(30); - return; + if( (A_n_rows >= threshold) && (A_n_cols >= threshold) && (B_n_rows >= threshold) && (B_n_cols >= threshold) && (mp_thread_limit::in_parallel() == false) ) + { + // TODO: the above limits on matrix sizes are place holders; + // TODO: need take into account transposes when determining if it's worth using the parallelised version + gemm_emul_large_mp::apply(C,A,B,alpha,beta); + + return; + } } #endif