Skip to content

Commit 6adc4b7

Browse files
authored
Merge pull request #1601 from martin-frbg/zaxpy
Use a single thread for small input size in zaxpy
2 parents 2ade0ef + e8880c1 commit 6adc4b7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

interface/zaxpy.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
#ifdef FUNCTION_PROFILE
4242
#include "functable.h"
4343
#endif
44-
44+
#if defined(Z13)
45+
#define MULTI_THREAD_MINIMAL 200000
46+
#else
47+
#define MULTI_THREAD_MINIMAL 10000
48+
#endif
4549
#ifndef CBLAS
4650

4751
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
6973
#endif
7074

7175
#ifndef CBLAS
72-
PRINT_DEBUG_CNAME;
76+
PRINT_DEBUG_NAME;
7377
#else
7478
PRINT_DEBUG_CNAME;
7579
#endif
@@ -93,6 +97,11 @@ void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint in
9397
if (incx == 0 || incy == 0)
9498
nthreads = 1;
9599

100+
//Work around the low performance issue with small imput size &
101+
//multithreads.
102+
if (n <= MULTI_THREAD_MINIMAL) {
103+
nthreads = 1;
104+
}
96105
if (nthreads == 1) {
97106
#endif
98107

0 commit comments

Comments
 (0)