File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
doc/fluid/howto/optimization Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ # 如何使用timeline工具做性能分析
2
+
3
+ 1 . 在训练的主循环外加上` with profiler.profiler(...) ` 。运行之后,代码会在` /tmp/profile ` 目录下生成一个profile的记录文件。
4
+
5
+ **提示:**
6
+ 请不要在timeline记录信息时运行太多次迭代,因为timeline中的记录数量和迭代次数是成正比的。
7
+
8
+ ```python
9
+ with profiler.profiler('All', 'total', '/tmp/profile') as prof:
10
+ for pass_id in range(pass_num):
11
+ for batch_id, data in enumerate(train_reader()):
12
+ exe.run(fluid.default_main_program(),
13
+ feed=feeder.feed(data),
14
+ fetch_list=[])
15
+ ...
16
+ ```
17
+
18
+ 1 . 运行` python paddle/tools/timeline.py ` 来处理` /tmp/profile ` ,这个程序默认会生成一个` /tmp/timeline ` 文件,你也可以用命令行参数来修改这个路径,请参考[ timeline.py] ( https://github.com/PaddlePaddle/Paddle/blob/develop/tools/timeline.py ) 。
19
+
20
+ 1 . 打开chrome浏览器,访问< chrome://tracing/ > ,用` load ` 按钮来加载生成的` timeline ` 文件。
21
+
22
+ 
23
+
24
+ 1 . 结果如下图所示,可以放到来查看timetime的细节信息。
25
+
26
+ 
File renamed without changes.
You can’t perform that action at this time.
0 commit comments