Implementation of torch::cuda::synchronize (#50072)
Summary:
Adding `torch::cuda::synchronize()` to libtorch. Note that the implementation here adds a new method to the `CUDAHooksInterface`. An alternative that was suggested to me is to add a method to the `DeviceGuard` interface.
Fixes https://github.com/pytorch/pytorch/issues/47722
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50072
Reviewed By: H-Huang
Differential Revision: D25804342
Pulled By: jbschlosser
fbshipit-source-id: 45aa61d7c6fbfd3178caf2eb5ec053d6c01b5a43