File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
doc/fluid/howto/optimization Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## how to use timeline tool to do profile
2
+
3
+ 1 . Add ` with profiler.profiler(...) ` to the main training loop. After run, the code will generate a profile record file ` /tmp/profile ` .
4
+
5
+ ```python
6
+ with profiler.profiler('All', 'total', '/tmp/profile') as prof:
7
+ for pass_id in range(pass_num):
8
+ for batch_id, data in enumerate(train_reader()):
9
+ exe.run(fluid.default_main_program(),
10
+ feed=feeder.feed(data),
11
+ fetch_list=[],
12
+ use_program_cache=True)
13
+ ...
14
+ ```
15
+
16
+ 1 . Run ` python paddle/tools/timeline.py ` to process ` /tmp/profile ` , it will generate another
17
+ file ` /tmp/timeline ` by default. You can change the path by cmd parameter, please take a look at
18
+ [ timeline.py] ( https://github.com/PaddlePaddle/Paddle/blob/develop/tools/timeline.py ) for details.
19
+
20
+ 1 . Open chrome and visit < chrome://tracing/ > , use ` load ` button to load the generated ` timeline ` file.
21
+
22
+ 
23
+
24
+ 1 . The resulting timeline should be like:
25
+
26
+
27
+ 
You can’t perform that action at this time.
0 commit comments