Selecting cuda device before launching thrust::reduce

Is there a way to select a device on which to run thrust::reduce or does it choose automatically? Do I need to do cudaSetDevice before calling reduce?

you can use cudaSetDevice

thrust is a template library on top of cuda