device int k=0;
global void
search1( int * values1,int *s, int NUM1, int target1)
{
int j=0;
unsigned int i = threadIdx.x + blockDim.x * blockIdx.x;
if(values1[i]==target1)
{
__syncthreads();
atomicAdd(&s[k], i);
k++;
}
s[j]=0;
}
above code is simple searching algorithm where values contain the array in which we will look for target and i am storing found indexes in array s …
so above code results is output in which all indexes are added is s[0] while i want to store them differently in s[0], s[1] and so on…
so can any one help me with this …
it will be very thankful of you…