Advertisement
rasoran

Untitled

Oct 21st, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | None | 0 0
  1.   int bnum = 0;
  2.   buf[tid] = in[idx];
  3.   barrier(CLK_LOCAL_MEM_FENCE);
  4.   for (int i = 1; i < dim; i*=2) {
  5.     bnum = 1 - bnum;
  6.     if (tid >= i) {
  7.       buf[bnum*dim+tid] = buf[(1-bnum)*dim+tid] + buf[(1-bnum)*dim+tid-i];
  8.     } else {
  9.       buf[bnum*dim+tid] = buf[(1-bnum)*dim+tid];
  10.     }
  11.     barrier(CLK_LOCAL_MEM_FENCE);
  12.   }
  13.   out[idx] = buf[bnum*dim+tid];
  14.   barrier(CLK_LOCAL_MEM_FENCE);
  15.   if (tid == 0) {
  16.     if (dim < n) {
  17.       bout[gid] = buf[dim-1];
  18.     } else {
  19.       bout[gid] = buf[n-1];
  20.     }
  21.   }
  22.  
  23. the problematic output:
  24.  
  25. 116: cpu=58 gpu=58
  26. 117: cpu=59 gpu=59
  27. 118: cpu=60 gpu=60
  28. 119: cpu=60 gpu=60
  29. 120: cpu=60 gpu=60
  30. 121: cpu=61 gpu=61
  31. 122: cpu=61 gpu=61
  32. 123: cpu=62 gpu=62
  33. 124: cpu=62 gpu=62
  34. 125: cpu=62 gpu=62
  35. 126: cpu=62 gpu=62
  36. 127: cpu=62 gpu=62
  37. 128: cpu=63 gpu=26
  38. 129: cpu=64 gpu=27
  39. 130: cpu=64 gpu=27
  40. 131: cpu=65 gpu=28
  41. 132: cpu=66 gpu=29
  42. 133: cpu=67 gpu=30
  43. 134: cpu=68 gpu=31
  44. 135: cpu=69 gpu=32
  45. 136: cpu=70 gpu=33
  46. 137: cpu=71 gpu=34
  47. 138: cpu=71 gpu=34
  48. 139: cpu=72 gpu=35
  49. 140: cpu=72 gpu=35
  50. 141: cpu=73 gpu=36
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement