Skip to content

Busy-wait inside cudaDeviceSynchronize while calling Thrust algorithms #1053

Discussion options

You must be logged in to vote

The wait behavior is controlled by cudaSetDeviceFlags (docs). The cudaDeviceScheduleYield should do what you're looking for.

Thrust uses the default stream by default, but this can be changed by passing thrust::device.on(stream) as the first argument to the algorithm, where stream is a cudaStream_t.

If you want more control over synchronization, you may also want to look at cub::DeviceScan::ExclusiveScan (docs). While Thrust algorithms are inherently synchronous, the CUB algorithms provide the user with more flexibility in this regard.

Replies: 0 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@andrewmcdonald-oxb
Comment options

@alliepiper
Comment options

Answer selected by andrewmcdonald-oxb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Thrust
Labels
None yet
2 participants