Fixed #6. Disable multi-thread swap when incx==0 or incy==0.
authorXianyi Zhang <xianyi@iscas.ac.cn>
Sun, 20 Feb 2011 09:14:38 +0000 (17:14 +0800)
committerXianyi Zhang <xianyi@iscas.ac.cn>
Sun, 20 Feb 2011 09:14:38 +0000 (17:14 +0800)
interface/swap.c
interface/zswap.c

index 7676246f9262d137ed9f52e12d2e962ff6dc020d..271fa083ae827019f70c7be58f7201306e5883a3 100644 (file)
@@ -78,7 +78,12 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
 
 #ifdef SMP
   nthreads = num_cpu_avail(1);
-
+  
+  //disable multi-thread when incx==0 or incy==0
+  //In that case, the threads would be dependent.
+  if (incx == 0 || incy == 0)
+         nthreads = 1;
+  
   if (nthreads == 1) {
 #endif
 
index f4a03a55085d2612e9208e7dd27744a1b4be1b6a..06a8892041f8235598f6eaa0ee9a097965130a91 100644 (file)
@@ -80,6 +80,11 @@ void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
 #ifdef SMP
   nthreads = num_cpu_avail(1);
 
+  //disable multi-thread when incx==0 or incy==0
+  //In that case, the threads would be dependent.
+  if (incx == 0 || incy == 0)
+         nthreads = 1;
+
   if (nthreads == 1) {
 #endif