@phoad: mem, , , , , , . . if-statement 5% , shared mem, , , .
10 , , 26 . zip_iterator , ( ). , threadIdx.x .. , Thrust . , , Thrust. , , "thrust:: system:: system_error" " ", " 10" " 41":
struct printf_functor {
__host__ __device__ void operator()(int e) {
printf("Processing %d\n", threadIdx.x);
}
};
int main() {
thrust::device_vector<int> dVec(32);
for (int i = 0; i < 32; ++i)
dVec[i] = i + 10;
thrust::for_each(dVec.begin(), dVec.end(), printf_functor());
return 0;
}
blockIdx.x blockDim.x . , , , .