If I use thrust::transform on thrust::host, the lambda usage is fine
thrust::transform(thrust::host, a, a+arraySize,b,d,[](int a, int b)->int
{
return a + b;
});
However, if I change the thrust::host to thrust::device, The code wouldn't pass the compiler. Here is the error on vs 2013
The closure type for a lambda ("lambda [](int, int)->int") cannot be used in the template argument type of a
__global__function template instantiation, unless the lambda is defined within a__device__or__global__function
So the problem is how to add the __device__ or __global__ to lambda?
Aucun commentaire:
Enregistrer un commentaire