As you assume, you would have to synchronize the code before starting and stopping the timer via torch.cuda.synchronize().
I would also recommend to add some warm-up iterations as well as time your operations in a loop and take the average execution time.