Can I use thrust algorithms with dynamic parallelism?

I’ve tried messing around and I keep getting compilation errors.

Is it possible to have a global GPU kernel call a thrust library function?

Generally speaking, no. Thrust algorithms are not callable from GPU kernels. The exception would be the use of thrust::seq, the execution policy which allows an algorithm to be called from a single CUDA thread and will run the desired algorithm sequentially within that thread:

[url]cuda - using thrust::sort inside a thread - Stack Overflow

You may also want to take a look at CUB, which has some thrust-like algorithmic capabilities. CUB routines, with appropriate setup, can be called from device code, and will then use dynamic parallelism to execute their routines (in parallel) on the device.

[url]http://nvlabs.github.io/cub/[/url]

Thank you!