From 3300f5ebffd058c9132e87dfea1174bd526196f8 Mon Sep 17 00:00:00 2001 From: wernsaar Date: Mon, 15 Sep 2014 11:38:25 +0200 Subject: [PATCH] optimized multithreading lower limits --- interface/gemm.c | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/interface/gemm.c b/interface/gemm.c index 74908e8..a5a2b47 100644 --- a/interface/gemm.c +++ b/interface/gemm.c @@ -405,49 +405,12 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS #ifndef COMPLEX double MNK = (double) args.m * (double) args.n * (double) args.k; - if ( MNK <= (16.0 * 1024.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) + if ( MNK <= (65536.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) nthreads_max = 1; - else - { - if ( MNK <= (2.0 * 65536.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) - { - nthreads_max = 4; - if ( args.m < 16 * GEMM_MULTITHREAD_THRESHOLD ) - { - nthreads_max = 2; - if ( args.m < 3 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - if ( args.n < 1 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - if ( args.k < 3 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - } - else - { - if ( args.n <= 1 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 2; - } - } - } #else double MNK = (double) args.m * (double) args.n * (double) args.k; - if ( MNK <= (256.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) + if ( MNK <= (8192.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) nthreads_max = 1; - else - { - if ( MNK <= (16384.0 * (double) GEMM_MULTITHREAD_THRESHOLD) ) - { - nthreads_max = 4; - if ( args.m < 3 * GEMM_MULTITHREAD_THRESHOLD ) - { - nthreads_max = 2; - if ( args.m <= 1 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - if ( args.n < 1 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - if ( args.k < 1 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 1; - } - else - { - if ( args.n < 2 * GEMM_MULTITHREAD_THRESHOLD ) nthreads_max = 2; - } - } - } - #endif args.common = NULL; -- 2.7.4