What is the difference between these three functions, especially the last two? The library manual says
Note that this function is deprecated because its name does not reflect its behavior. Its functionality is similar to the non-deprecated function cudaDeviceSynchronize(), which should be used instead.
But not very sure what does it mean.
These are all barriers. Barriers prevent code execution beyond the barrier until some condition is met.
cudaDeviceSynchronize
. Deprecated just means that it still works for now, but it's recommended not to use it (use cudaDeviceSynchronize instead) and in the future, it may become unsupported. ButcudaThreadSynchronize
() andcudaDeviceSynchronize
() are basically identical.cudaStreamSynchronize
() takes a stream id as its only parameter. cuda tasks issued in other streams may or may not be complete when CPU code execution continues beyond this barrier.