Rate this Page

Function c10::cuda::setCurrentCUDAStream#

Function Documentation#

void c10::cuda::setCurrentCUDAStream(CUDAStream stream)#

Set the current stream on the device of the passed in stream to be the passed in stream.

Yes, you read that right: this function has nothing to do with the current device: it toggles the current stream of the device of the passed stream.

Confused? Avoid using this function; prefer using ‘CUDAStreamGuard’ instead (which will switch both your current device and current stream in the way you expect, and reset it back to its original state afterwards).