Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created December 12, 2019 09:29
Show Gist options
  • Save nithyadurai87/8eebce687ba439cd9b9691383c780dbe to your computer and use it in GitHub Desktop.
Save nithyadurai87/8eebce687ba439cd9b9691383c780dbe to your computer and use it in GitHub Desktop.
import time
import torch
a = torch.rand(10000,10000)
b = torch.rand(10000,10000)
start = time.time()
a.matmul(b)
end = time.time()
print("{} seconds".format(end - start))
print (torch.cuda.is_available())
a = a.cuda()
b = b.cuda()
start = time.time()
a.matmul(b)
end = time.time()
print("{} seconds".format(end – start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment