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

This post was flagged by the community and is temporarily hidden.

1 Like

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 !

5 Likes

Thanks a lot! That’s very helpful.