-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 python profiler package #40065
add python profiler package #40065
Conversation
Thanks for your contribution! |
paddle/fluid/pybind/pybind.cc
Outdated
|
||
py::class_<paddle::platform::ProfilerOptions>(m, "ProfilerOptions") | ||
.def(py::init<>()) | ||
.def_readwrite("trace_level", |
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.
这个level暴漏吗?
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.
已改
paddle/fluid/pybind/pybind.cc
Outdated
profiler->Prepare(); | ||
}) | ||
.def("Start", &paddle::platform::Profiler::Start) | ||
.def("Stop", &paddle::platform::Profiler::Stop, |
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.
stop时disable HostEventRecorder
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.
LGTM
.def_readwrite("device_node", | ||
&paddle::platform::HostPythonNode::device_node_ptrs); | ||
|
||
py::class_<paddle::platform::Profiler>(m, "_Profiler") |
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.
这块的Profiler相关调用函数首字母大写,这块是有调研过竞品,都是大写?
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.
已修改为小写
paddle/fluid/pybind/pybind.cc
Outdated
|
||
py::class_<platform::RecordEvent>(m, "_RecordEvent") | ||
.def(py::init([](std::string name, platform::TracerEventType type) { | ||
return std::unique_ptr<platform::RecordEvent>(new platform::RecordEvent( |
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.
这里使用make_unique的性能是不是更好一点?
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.
已修改
import paddle.profiler as profiler | ||
with profiler.Profiler(targets=[profiler.ProfilerTarget.CPU, | ||
profiler.ProfilerTarget.GPU], | ||
scheduler = (3, 10), |
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.
这里有个疑问,虽然在构建scheduler的时候可以多种方式,但是给用户的感觉就是构建方法不够清晰,这里是不是考虑把接口统一一下
def __exit__(self, exc_type, exc_val, exc_tb): | ||
self.stop() | ||
|
||
def start(self): |
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.
start和stop的文档补齐一下
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.
LGTM
PR types
New features
PR changes
APIS
Describe