-
-
Save shunting314/3591753fa78f2c8faf259c65f21f265b 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 torch | |
| import json | |
| N = 2 ** 28 | |
| glist = [] | |
| mempool = torch.cuda.graph_pool_handle() | |
| for _ in range(3): | |
| g = torch.cuda.CUDAGraph() | |
| glist.append(g) | |
| with torch.cuda.graph(g, pool=mempool): | |
| x = torch.randn(N, device="cuda") | |
| del x | |
| print(g.pool()) | |
| print(json.dumps(torch.cuda.memory_snapshot(), indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment