179 questions
No questions match those filters.
← All questions
Python & DataEasy· CUDA· Performance Profiling
Why do you need to call torch.cuda.synchronize() before...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansIn PyTorch, operations on the GPU are asynchronous. When you call a function like dist.all_reduce(), the CPU merely submits the command to the GPU’s work queue and returns immediately. If you stop a timer immediately after the function call without calling torch.cuda.synchronize(), you are measuring how long it took to submit the task to the queue, not how long the GPU took to perform the actual computation or communication.