DuckQueen DuckQueen - 1 year ago 121
C++ Question

Is there analogy of boost compute function in Thrust?

I wonder if there is an analog to boost compute Function ( ) that turns into kernel and can be created as embedded inline code that turns into a kernel?

Answer Source

In thrust, you can use function/functor with __device__ qualifier. An example of vector operation saxpy is shown in the link, where you could find the functor saxpy_functor

Similar to boost::compute, you could also use thrust lambda expression as

thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), A * _1 + _2);

or more standard C++ lambda expression as shown by @RobertCrovella.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download