Created
November 4, 2025 09:15
-
-
Save karminski/28fdd51746d4c46a4688c57b6436b304 to your computer and use it in GitHub Desktop.
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
| import time | |
| import torch | |
| d = 8192 | |
| x = torch.randn(size=(d, d)).to(torch.bfloat16).to("cuda") | |
| y = torch.randn(size=(d, d)).to(torch.bfloat16).to("cuda") | |
| def fun(x): | |
| for _ in range(50): | |
| x = x @ y.T | |
| return x | |
| for _ in range(10): | |
| fun(x) | |
| torch.cuda.synchronize() | |
| tic = time.time() | |
| for _ in range(10): | |
| fun(x) | |
| torch.cuda.synchronize() | |
| toc = time.time() | |
| s = (toc - tic) | |
| msec = 1e3 * s | |
| tf = (d**3) * 2 * 50 * 10 / (1024 **4) | |
| print(f"{msec=:.3f}") | |
| tflops = tf / s | |
| print(f"{tflops=:.3f}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment