cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

erman_amd
Journeyman III

Simple question

Add all elements in an array

Hi,

I have a sequential function code below. I want to make it parallel as OpenCL kernel, but I think this can not be parallelize. Am I right? CMIIW. Thanks for help.

 

 

 

 

... float sum = 0; for(i=0; i<h;i++) for(j=0; j<w;j++) sum+= array[i*w+j]; return sum;

0 Likes
1 Reply
himanshu_gautam
Grandmaster

erman_amd,

The code is parallelizeable quite easily.Refer to the Reduction samples from the SDK. 

0 Likes