-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Introduce a new API torch.accelerator.get_mem_info #156812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh/guangyey/163/base
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/156812
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 16 PendingAs of commit e19a8fc with merge base a354fa9 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Isn't this duplicated with other existing APIs? |
Unlike |
Currently, in if device.type == "cuda":
index = device.index if device.index is not None else torch.cuda.current_device()
device_memory = torch.cuda.mem_get_info(index)[0] Changing these code with another |
@albanD Do you think if introducing this API is reasonable. |
@albanD Just a kind reminder ^_^ |
Stack from ghstack (oldest at bottom):
Motivation
torch.cuda.mem_get_info
andtorch.xpu.mem_get_info
are widely used in other popular repos, such asThis PR introduces a unified API
torch.accelerator.get_memory_info
to cover this scenario.