-
Notifications
You must be signed in to change notification settings - Fork 271
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
【Hackathon 7th No.21】RFC文档 新增 reset_peak_memory_stats/reset_max_memory_allocated/memory_stats API #1022
base: master
Are you sure you want to change the base?
Conversation
new file: rfcs/APIs/20241119_api_design_for_reset_peak_memory_stats_reset_max_memory_allocated_memory_stats.md
|
||
# 四、对比分析 | ||
|
||
由于 PyTorch 中的函数结构更符合飞浆的要求,因此可以参考 PyTorch 中的函数实现。 |
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.
飞浆-》飞桨
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.
抱歉,已修改
# 七、影响面 | ||
|
||
## 需要进一步讨论的问题 | ||
1. 是否对`Stat`类进行修改。 |
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.
可以修复Stat类,可以评估下修改 或 不修改,两种方案的优缺点。
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.
我目前认为可以直接在Stat类中加入新的函数。我认为现在不需要使用友元函数或者友元类来修改Stat类中的私有变量。不知道飞桨对这种类似的修改是否有要求?
|
||
## 需要进一步讨论的问题 | ||
1. 是否对`Stat`类进行修改。 | ||
2. 目前`StatRegistry`类中是否只注册了`Allocated`和`Reserved`。 |
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.
还需要注册哪些信息?
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.
因为我目前对飞桨的内存池还不太了解,希望可以和飞桨技术人员交流一下内存池的架构。
PyTorch的内存池比较复杂,信息更多。如新的commit中引用的struct DeviceStats
类所示,Pytorch的内存池中有更多的类似活动内存块和非活动内存块,大内存池(>1MB)和小内存池(<1MB)等信息。
## 需要进一步讨论的问题 | ||
1. 是否对`Stat`类进行修改。 | ||
2. 目前`StatRegistry`类中是否只注册了`Allocated`和`Reserved`。 | ||
3. 是否参考Pytorch注册更多的内存信息标签。 |
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.
可以列举一下有哪些内存信息标签。这些新注册的标签是否会被使用到。因为飞桨单侧有行覆盖率的要求,如果注册了标签,但没有使用,单侧会无法通过。
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.
因为对飞桨内存池还没有深入了解。我认为第一版函数可以按照此RFC文档中方案设计:
reset_peak_memory_stats
函数:将allocated memory和reserved memory中的peak值改为current值reset_max_memory_allocated
函数:参考Pytorch,调用reset_peak_memory_stats
函数MemoryStats
函数:返回包含以下信息的字典
{
{"memory.allocated.peak", 0},
{"memory.allocated.current", 0},
{"memory.reserved.peak", 0},
{"memory.reserved.current", 0}
}
请问这种设计能否满足目前的需求?
modified: rfcs/APIs/20241119_api_design_for_reset_peak_memory_stats_reset_max_memory_allocated_memory_stats.md
comment by @From00 :
|
收到,谢谢,已添加 |
modified: rfcs/APIs/20241119_api_design_for_reset_peak_memory_stats_reset_max_memory_allocated_memory_stats.md
希望可以与paddle开发人员讨论一下函数的具体实现细节