Take the 2-minute tour ×

I need to calculate the cumulative sum of a matrix which is that where value of each index (i,j) of the new cumulative sum matrix is sum of all the elements formed by the sub-matrix (0,0) to (i,j) of original one. Is there a way by which I can parallelise it using multiple threads of CUDA?

share|improve this question
Bing for CUDA parallel prefix sum. –  Jan Gray Dec 11 '10 at 20:42

1 Answer 1

The cumulative sum is a scan, the CUDA SDK includes "scan" examples. Check the ScanLargeArray example. This is a very highly refined algorithm, and there's even a paper http://developer.download.nvidia.com/compute/cuda/1_1/Website/projects/scan/doc/scan.pdf describing all the steps taken to optimise the algorithm.

share|improve this answer

Your Answer


