Parallel Reduction

Hi,

I am looking at Parallel reduction code provided in SDK but I am confused about correctness of code.

In Method benchmarkReduce(), When reduce function is called, both input and output variables point to output variable which is strange. If we do not have input data how we can execute kernel but when I run this program, Output is “PASSED”. Why?

For convenience, I am putting function call of reduce().

reduce(s, threads, blocks, kernel, d_odata, d_odata);

and reduce() method header is

template
void reduce(int size, int threads, int blocks, int whichKernel, T *d_idata, T *d_odata)

and there is no assignment of d_idata to d_odata.

Best Regards,
Kashif