prepare_kernel.c 717 B

1234567891011121314151617181920
  1. // statistical kernel
  2. __global__ void prepare( long d_Ne,
  3. fp *d_I, // pointer to output image (DEVICE GLOBAL MEMORY)
  4. fp *d_sums, // pointer to input image (DEVICE GLOBAL MEMORY)
  5. fp *d_sums2){
  6. // indexes
  7. int bx = blockIdx.x; // get current horizontal block index
  8. int tx = threadIdx.x; // get current horizontal thread index
  9. int ei = (bx*NUMBER_THREADS)+tx; // unique thread id, more threads than actual elements !!!
  10. // copy input to output & log uncompress
  11. if(ei<d_Ne){ // do only for the number of elements, omit extra threads
  12. d_sums[ei] = d_I[ei];
  13. d_sums2[ei] = d_I[ei]*d_I[ei];
  14. }
  15. }