We are doing comparisons on the GPU using CUDAfy.NET. For that we are passing two arrays, one of which contains the data and the other stores the results. I only want to store those elements in the result array which satisfy a certain condition. But the array ends up with unwanted entries where condition doesn't satisfy. How can I filter these unwanted entries from the results array and return the filtered array back to the main function?
[Cudafy]
public static void Comparisons(GThread thread, int[] a,int[] c, int iter)
{
int tx = thread.threadIdx.x;
if(tx < iter)
{
if(a[tx] < tolerance) //tolerance is some user defined number
{
c[tx] = a[tx];
}
}
}