Created
September 16, 2019 22:53
-
-
Save Hanrui-Wang/e71e42a6182e20d9ecd43e157638f49e to your computer and use it in GitHub Desktop.
measure the latency of pytorch program execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = torch.cuda.Event(enable_timing=True) | |
end = torch.cuda.Event(enable_timing=True) | |
start.record() | |
z = x + y | |
end.record() | |
# Waits for everything to finish running | |
torch.cuda.synchronize() | |
print(start.elapsed_time(end)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment