Why thrust::count and thrust::count_if give diffenrent results for counting how many elements are zero in device vector?
I have a thrust device vector with 16.679.056 float elements in it. The result of int result_count_0 = thrust::count(d_result.begin(),d_result.end(), 0); is 14.786.283 But at the same time the following approach with thrust::count_if gives a different result (15.733.822) struct is_zero { __host__ __device__ bool operator()(int x) { return x == 0; } }; … is_zero iszero;… Read More Why thrust::count and thrust::count_if give diffenrent results for counting how many elements are zero in device vector?