AnsweredAssumed Answered

ScanLargeArrays Sample in AMD SDK

Question asked by is2013 on Oct 21, 2013
Latest reply on Oct 23, 2013 by is2013

Hi all,

 

I am computing prefix sum using ScanLargeArrays sample in SDK of a large array containing 1s and 0s lets say {1,0,0,1,1,0,0,0,0,0,1,1,0,1,1,1} so after prefix sum, output is {0,1,1,1,2,3,3,3,3,3,3,4,5,5,6,7}. Is there a way to determine the number of distinct elements in this prefixed sum array inside any of the 3 kernels in this sample? either counting 1s in input array (somehow in scanLargeArray kernel) or distinct elements in final array (somehow in blockAddition kernel)?

Lets assume that number of 1s and 0s are not known beforehand in cpu and these distinct elements are to be determined inside kernel as the array size is in millions.

 

Thank you.

Outcomes