-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 profiler_range #59634
add profiler_range #59634
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
需要加个单测
python/paddle/profiler/utils.py
Outdated
return | ||
|
||
try: | ||
if (iter_id == start) or (iter_id >= start): |
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.
这个判断逻辑看起来很奇怪,而且在exit_after_prof==false
的时候看起来是错的。
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.
这个判断逻辑看起来很奇怪,而且在
exit_after_prof==false
的时候看起来是错的。
已修复
@contextmanager
def job_schedule_profiler_range(iter_id, start, end, exit_after_prof=True):
if start >= end:
yield False
return
try:
if iter_id >= start and iter_id < end:
yield True
else:
yield False
finally:
if iter_id == end - 1:
if exit_after_prof:
sys.exit()
python/paddle/profiler/utils.py
Outdated
|
||
|
||
@contextmanager | ||
def profiler_range(iter_id, start, end, exit_after_prof=True): |
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.
def profiler_range(iter_id, start, end, exit_after_prof=True): | |
def job_schedule_profiler_range(iter_id, start, end, exit_after_prof=True): |
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
done |
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
from paddle.profiler.utils import job_schedule_profiler_range | ||
|
||
|
||
class TestJobScheDuleProfilerRange(unittest.TestCase): |
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.
class TestJobScheDuleProfilerRange(unittest.TestCase): | |
class TestJobScheduleProfilerRange(unittest.TestCase): |
PR types
Others
PR changes
Others
Description
添加 profiler_range 工具,方便 便捷地启用 profile 工具:
相关pr: