How to reduce Time spent by torch.cuda.synchronize()?

Hi,

torch.cuda.synchronize() just wait for all the work to be done on the GPU.
If the synchronize takes different time for different models, I guess that means that one requires more things to be done on the GPU. There is not much you can do here.
Also, unless you are doing time meansurement, you don’t need to explicitly synchronize when using pytorch. It will be done automatically when needed !

6 Likes

Thanks a lot! That’s very helpful.