Default Thrust execution policy

What is the default thrust execution policy? Is it host or device or does it pick based on the iterator? How does this work for arrays allocated using cudaMallocManaged (unified addressing)?

It picks it based on the supplied iterators.

For default behavior when you pass bare pointers (e.g. those provided by malloc, cudaMallocHost, cudaMallocManaged, cudaMalloc, etc.) read the thrust quick start guide:

https://github.com/thrust/thrust/wiki/Quick-Start-Guide

"You may wonder what happens when a “raw” pointer is used as an argument to a Thrust function. Like the STL, Thrust permits this usage and it will dispatch the host path of the algorithm. "

if you don’t want that default behavior, then override it with an explicit execution policy, or else pass iterators from which the container type can be deduced (e.g. thrust vector iterators or thrust pointers)