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:

http://stackoverflow.com/questions/23403653/using-thrustsort-inside-a-thread/23416764#23416764

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.

http://nvlabs.github.io/cub/

Thank you!