-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add new APIs for GPU memory monitoring (max_memory_allocated, max_memory_reserved, memory_allocated, memory_reserved) #38657
Add new APIs for GPU memory monitoring (max_memory_allocated, max_memory_reserved, memory_allocated, memory_reserved) #38657
Conversation
Thanks for your contribution! |
Sorry to inform you that 4d506ea's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
… add-new-api-memory_reserved
… add-new-api-memory_reserved
if (platform::is_gpu_place(place)) { | ||
int dev_id = place.GetDeviceId(); | ||
int64_t alloc_size = | ||
STAT_INT_ADD("STAT_gpu" + std::to_string(dev_id) + "_alloc_size", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问这里能做到通过 AllocatorFacade 分配内存等价于拿到具体的 Allocator 然后返回 Allocator->Allocate(size)
吗?后续 Tensor 计划不走 AllocatorFacade,而是直接传入具体的 Allocator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已另作讨论,这里采集显存数据的相关逻辑无法实现到具体的Allocator里,与pten直接获取Allocator对象后分配内存的设想不等价,之后pten的Alloc接口在获取Allocator分配内存后,也需要添加类似的数据采集逻辑。此处存在一些和Allocator以及Pten最初设计不太切合的修改,短期先同步后进行合入,不阻塞相关功能的开发,后续pten项目相关负责人员腾出时间后,再对类似的问题进行集中讨论和优化整改。 @phlrain @chenwhql @zhiqiu @jim19930609
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按先期形成的共识,Allocator 分配逻辑的统一出口为 https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/memory/allocation/allocator.h#L142 。目前因为进度原因先行同意此合入,相关问题 @From00 后续处理。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按先期形成的共识,Allocator 分配逻辑的统一出口为 https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/memory/allocation/allocator.h#L142 。目前此 PR 在实现上有差异。因为进度原因先行同意此合入,相关问题 @From00 后续处理。
Sorry to inform you that fb04a61's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
… add-new-api-memory_reserved
… add-new-api-memory_reserved
… add-new-api-memory_reserved
此PR有计划随着 paddle2.3 发版吗? @From00 |
paddle/fluid/memory/stats.h
Outdated
void Update(int64_t increment) override { | ||
ThreadLocalStatType thread_local_stat = | ||
ThreadDataRegistry<ThreadLocalStatType>::GetInstance() | ||
.GetCurrentThreadData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetMutableCurrentThreadData is designed for read&write scene
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thx.
新的方案通过包装一层StatAllocator实现显存统计功能,目前已不影响Alloacator分配逻辑的出口函数GetAllocator,与PHI(原PTEN)的设计原则无差异,可兼容直接获取Allocator对象后分配内存的行为。 |
有计划。此PR目前由于人力原因推动较慢,会争取在Paddle 2.3随版发布。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve for coverage-ci build size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG API
build目录体积增大的情况说明与豁免申请
|
PR types
New features
PR changes
APIs
Describe
Add 4 new APIs: paddle.device.cuda.max_memory_allocated, paddle.device.cuda.max_memory_reserved, paddle.device.cuda.memory_allocated and paddle.device.cuda.memory_reserved
CN docs PR:PaddlePaddle/docs#4193