From e8880c1699816483090aa5574cf9b3322943831f Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Thu, 7 Jun 2018 10:26:55 +0200 Subject: [PATCH] Use a single thread for small input size copies daxpy improvement from #27, see #1560 --- interface/zaxpy.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/interface/zaxpy.c b/interface/zaxpy.c index fbb830ffb..529e78e79 100644 --- a/interface/zaxpy.c +++ b/interface/zaxpy.c @@ -41,7 +41,11 @@ #ifdef FUNCTION_PROFILE #include "functable.h" #endif - +#if defined(Z13) +#define MULTI_THREAD_MINIMAL 200000 +#else +#define MULTI_THREAD_MINIMAL 10000 +#endif #ifndef CBLAS void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){ @@ -69,7 +73,7 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in #endif #ifndef CBLAS - PRINT_DEBUG_CNAME; + PRINT_DEBUG_NAME; #else PRINT_DEBUG_CNAME; #endif @@ -93,6 +97,11 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in if (incx == 0 || incy == 0) nthreads = 1; + //Work around the low performance issue with small imput size & + //multithreads. + if (n <= MULTI_THREAD_MINIMAL) { + nthreads = 1; + } if (nthreads == 1) { #endif