In my system I program multiple GPUs concurrently. Do I need to call cudaSetDevice()
before calling cudaStreamSynchronize()
?
When creating the cudaStream_t
objects, I did set the device correctly before calling cudaStreamCreate()
.
I may be wrong but I don't think you need to call the function cudaSetDevice()
again if you already used it when creating the stream.
Resources:
https://developer.nvidia.com/blog/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
https://forums.developer.nvidia.com/t/how-many-times-does-cudasetdevice-need-to-be-called/10646
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.