Is there any complete tutorial for sum all elements in an array/vector?

Hello guys,

I’m a novice to opencl. Basically, this is my second day. Someone wants me get familiar with opencl by implementing “get the summation of cubes of each element in an array”.

I found that get the cube of each element is quite easy. However, I have no idea about how to get the summation.

I checked on Google, it seems I need something called “reduction” and I can’t find full tutorial(both kernel and host) program.

Also, if you have other good examples, please tell me. I definitely need your help. :o

Thanks in advance.

You can find a good introduction to reduction with OpenCL here:

http://developer.amd.com/resources/documentation-articles/articles-whitepapers/opencl-optimization-case-study-simple-reductions/