- Notifications
You must be signed in to change notification settings - Fork 5.9k
Add timer tool to Profiler #40386
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 timer tool to Profiler #40386
Conversation
| Thanks for your contribution! |
python/paddle/profiler/profiler.py Outdated
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.
是否需要支持允许指定单位?或者作为step_info的参数?
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.
目前修改为在step_info中,通过unit参数指定样本单位,比如unit='images',吞吐量则表示为images/s
| Sorry to inform you that 27f7dc2's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
27f7dc2 to e5367af Compare
rainyfly left a comment
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
和@Xreki 讨论了下,这块step_indo,在API中已经说明了统计的是2次调用之间经过的迭代的均值,所以不再额外增加avg字段了。 |
1b01098 to 3c45e1c Compare 275ba57 to 51088e9 Compare 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.
check_if_need_record是否在before_reader中自动调用比较好?
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.
因为check_if_need_record要接受一个reader参数,和hook的几个基本接口的参数列表不一样。这块为了保持接口的一致性,这个函数单独抽出来
python/paddle/profiler/profiler.py Outdated
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.
done
python/paddle/profiler/profiler.py Outdated
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.
done
python/paddle/profiler/profiler.py Outdated
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里面不怎么用这种命名风格吧?batch_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.
因为这里是一个常量名,python代码风格一般是用大写的
python/paddle/profiler/timer.py Outdated
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类型最好都继承object?
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
python/paddle/profiler/timer.py Outdated
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.
done
python/paddle/profiler/timer.py Outdated
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.
为啥要设置speed_mode和speed_unit两个?
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.
speed_mode是速度的表示模式,用来确定是采用吞吐量samples/s, 还是steps/s给出性能,它取决于num_samples的设置。
speed_unit是速度的单位,取决于用户在step_info调用时自定义的样本单位,这个值仅仅在speed_mode为samples/s时生效,用于产生images/s, words/s等不同的吞吐量单位
python/paddle/profiler/timer.py Outdated
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.
这个逻辑会不会放在Event里面比较好?
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
python/paddle/profiler/timer.py Outdated
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.
这个逻辑会不会放在Event里面比较好?
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
python/paddle/profiler/profiler.py Outdated
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.
done
d254a09 to 1ce7507 Compare python/paddle/profiler/profiler.py Outdated
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.
每个iter的log放在L370之后,总的log放在L371之后,表明哪个函数产生哪样的log。
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
python/paddle/profiler/profiler.py Outdated
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.
done
1ce7507 to 99661bd Compare
Xreki left a comment
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
| Returns: | ||
| string: A string representing the statistic. | ||
| Examples: |
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.
Please add a black line before Examples
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
python/paddle/profiler/profiler.py Outdated
| import paddle | ||
| import paddle.profiler as profiler | ||
| import numpy as np |
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.
Please use Paddle's API create Tensor instead of numpy
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.
TCChenlong left a comment
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
TODO:Fix docs
f0f1cdd to 3fb9373 Compare 3fb9373 to 5cc1bcd Compare 5cc1bcd to 81ac3a6 Compare
Xreki left a comment
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
TCChenlong left a comment
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 for API docs

PR types
Function optimizationPR changes
OthersDescribe
Add timer tool to Profiler实现说明
结果展示
doc