title: Particle cell counting (1D and 2D histogram generation) in CUDA
body: <p>This <code>__global__</code> function is to increment number and counting how many particles are in some cells.</p>
  
  <pre><code>__global__ void Set_Nc_GPU_0831(int *nc,int *index,SP DSMC)
  {
      int tidx;
      tidx=threadIdx.x+blockDim.x*blockIdx.x;
  
      atomicAdd(&amp;nc[index[tidx]],1);
  }
  </code></pre>
  
  <p>I'm using atomic operations which are slow. So I want to replace the atomic function with some other functions or algorithms.</p>
  
  <p>Is there any alternative to modify this simple <code>__global__</code> function?</p>