Browse Source

swap: disable multi-threading for small matrices

Close #731
tags/v0.2.16.rc1
Jerome Robert 9 years ago
parent
commit
66eafb16cf
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      interface/swap.c

+ 4
- 3
interface/swap.c View File

@@ -77,12 +77,13 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
if (incy < 0) y -= (n - 1) * incy; if (incy < 0) y -= (n - 1) * incy;


#ifdef SMP #ifdef SMP
nthreads = num_cpu_avail(1);


//disable multi-thread when incx==0 or incy==0 //disable multi-thread when incx==0 or incy==0
//In that case, the threads would be dependent. //In that case, the threads would be dependent.
if (incx == 0 || incy == 0)
nthreads = 1;
if (incx == 0 || incy == 0 || n < 2097152 * GEMM_MULTITHREAD_THRESHOLD / sizeof(FLOAT))
nthreads = 1;
else
nthreads = num_cpu_avail(1);


if (nthreads == 1) { if (nthreads == 1) {
#endif #endif


Loading…
Cancel
Save