         outi[bid] = imax;
       }
     }
+    __syncthreads();
   }
 }
 

  __shared__ int maxi[32];
  T vmax, vtmp;
  int imax, itmp, i, k;
  int bid = blockIdx.y + blockIdx.z * blockDim.y;

  if (bid < ncols) {
    vmax = maxminv;

  __shared__ int maxi[32];
  T vmax, vtmp;
  int imax, itmp, i, k, start, end, ij;
  int bid = blockIdx.y + blockIdx.z * gridDim.y;

  if (bid < ncols) {
    for (ij = blockIdx.x; ij < m; ij += gridDim.x) {
