PDA

View Full Version : Help adding large array



Rui
06-02-2010, 01:59 PM
What is the best way (as in the most efficient) to calculate the sum of a big array (>80000 cells)? In the problem I'm trying to solve I have at least 100 work-items, each one calculating the sum of a different array of that size.

david.garcia
06-03-2010, 12:35 PM
100 work-items is very little. Instead of having one work-item for each of the 100 arrays it would be better if you launched many work-items in each array and perform what is called a "reduction".

This link has an example of how to do it:
http://developer.apple.com/mac/library/samplecode/OpenCL_Parallel_Reduction_Example/Listings/reduce_c.html#//apple_ref/doc/uid/DTS40008188-reduce_c-DontLinkElementID_4