1
- Trace Diff using Holistic Trace Analysis
1
+ μ’
ν©μ λΆμμ μ΄μ©ν νΈλ μ΄μ€ μ°¨μ΄ λΆμ
2
2
========================================
3
3
4
- **Author: ** `Anupam Bhatnagar <https://github.com/anupambhatnagar >`_
4
+ **μ μ: ** `Anupam Bhatnagar <https://github.com/anupambhatnagar >`_
5
+ **λ²μ: ** `μ΄μ§ν <https://github.com/uddk6215>__ `
5
6
6
- Occasionally, users need to identify the changes in PyTorch operators and CUDA
7
- kernels resulting from a code change. To support this requirement, HTA
8
- provides a trace comparison feature. This feature allows the user to input two
9
- sets of trace files where the first can be thought of as the *control group *
10
- and the second as the *test group *, similar to an A/B test. The ``TraceDiff `` class
11
- provides functions to compare the differences between traces and functionality
12
- to visualize these differences. In particular, users can find operators and
13
- kernels that were added and removed from each group, along with the frequency
14
- of each operator/kernel and the cumulative time taken by the operator/kernel.
7
+ λλλ‘ μ¬μ©μλ€μ μ½λ λ³κ²½μΌλ‘ μΈν PyTorch μ°μ°μμ CUDA 컀λμ λ³νλ₯Ό μλ³ν΄μΌ ν νμκ° μμ΅λλ€.
8
+ μ΄λ₯Ό μν΄ HTAλ νΈλ μ΄μ€ λΉκ΅ κΈ°λ₯μ μ 곡ν©λλ€. μ΄ κΈ°λ₯μ ν΅ν΄ μ¬μ©μλ λ μΈνΈμ νΈλ μ΄μ€ νμΌμ μ
λ ₯ν μ μλλ°,
9
+ A/B ν
μ€νΈμ μ μ¬νκ², 첫 λ²μ§Έ μΈνΈλ λμ‘°κ΅°μΌλ‘, λ λ²μ§Έ μΈνΈλ μ€νκ΅°μΌλ‘ κ°μ£Όν μ μμ΅λλ€.
10
+ TraceDiff ν΄λμ€λ νΈλ μ΄μ€ κ°μ μ°¨μ΄λ₯Ό λΉκ΅νκ³ μ΄λ¬ν μ°¨μ΄λ₯Ό μκ°ννλ κΈ°λ₯μ μ 곡ν©λλ€.
11
+ νΉν, μ¬μ©μλ κ° κ·Έλ£Ήμμ μΆκ°λκ±°λ μ κ±°λ μ°μ°μμ 컀λμ μ°Ύμ μ μμΌλ©°, κ° μ°μ°μ/컀λμ λΉλμ λμ μμ μκ°λ νμΈν μ μμ΅λλ€.
15
12
16
- The `TraceDiff <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html >`_ class
17
- has the following methods :
13
+ `TraceDiff <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html >`_ ν΄λμ€λ λ€μκ³Ό κ°μ λ©μλλ₯Ό κ°μ§κ³ μμ΅λλ€.
14
+ TraceDiff ν΄λμ€μ λ©μλ :
18
15
19
16
* `compare_traces <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html#hta.trace_diff.TraceDiff.compare_traces >`_:
20
- Compare the frequency and total duration of CPU operators and GPU kernels from
21
- two sets of traces.
17
+ λ μΈνΈμ νΈλ μ΄μ€μμ CPU μ°μ°μμ GPU 컀λμ λΉλμ μ΄ μ§μ μκ°μ λΉκ΅ν©λλ€.
22
18
23
19
* `ops_diff <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html#hta.trace_diff.TraceDiff.ops_diff >`_:
24
- Get the operators and kernels which have been:
20
+ λ€μκ³Ό κ°μ μνμ μ°μ°μμ 컀λμ κ°μ Έμ΅λλ€.
21
+ μν μμ:
25
22
26
- #. **added ** to the test trace and are absent in the control trace
27
- #. **deleted ** from the test trace and are present in the control trace
28
- #. **increased ** in frequency in the test trace and exist in the control trace
29
- #. **decreased ** in frequency in the test trace and exist in the control trace
30
- #. **unchanged ** between the two sets of traces
23
+ #. **μΆκ°: ** μ€νκ΅°μ νΈλ μ΄μ€μ μΆκ°λμκ³ λμ‘°κ΅°μ νΈλ μ΄μ€μλ μλ κ²
24
+ #. **μμ : ** μ€νκ΅°μ νΈλ μ΄μ€μμ μμ λκ³ λμ‘°κ΅°μ νΈλ μ΄μ€μλ μλ κ²
25
+ #. **μ¦κ°: ** μ€νκ΅°μμμ λΉλκ° μ¦κ°νκ³ λμ‘°κ΅°μ νΈλ μ΄μ€μλ μ‘΄μ¬νλ κ²
26
+ #. **κ°μ: ** μ€νκ΅°μμμ λΉλκ° κ°μνκ³ λμ‘°κ΅°μ νΈλ μ΄μ€μλ μ‘΄μ¬νλ κ²
27
+ #. **λ³κ²½ μ λ¨: ** λ μΈνΈμ νΈλ μ΄μ€ κ°μ λ³νκ° μλ κ²
31
28
32
29
* `visualize_counts_diff <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html#hta.trace_diff.TraceDiff.visualize_counts_diff >`_
33
30
34
31
* `visualize_duration_diff <https://hta.readthedocs.io/en/latest/source/api/trace_diff_api.html#hta.trace_diff.TraceDiff.visualize_duration_diff >`_
35
32
36
- The last two methods can be used to visualize various changes in frequency and
37
- duration of CPU operators and GPU kernels, using the output of the
38
- ``compare_traces `` method.
33
+ λ§μ§λ§ λ λ©μλλ compare_traces λ©μλμ μΆλ ₯μ μ¬μ©νμ¬ CPU μ°μ°μμ GPU 컀λμ
34
+ λΉλ λ° μ§μ μκ°μ λ€μν λ³νλ₯Ό μκ°ννλ λ° μ¬μ©ν μ μμ΅λλ€.
39
35
40
- For example, the top ten operators with increase in frequency can be computed as
41
- follows:
36
+ μλ₯Ό λ€μ΄, λΉλκ° μ¦κ°ν μμ 10κ°μ μ°μ°μλ λ€μκ³Ό κ°μ΄ κ³μ°ν μ μμ΅λλ€.
42
37
43
38
.. code-block :: python
44
39
@@ -47,20 +42,18 @@ follows:
47
42
48
43
.. image :: ../_static/img/hta/counts_diff.png
49
44
50
- Similarly, the top ten operators with the largest change in duration can be computed as
51
- follows:
45
+ λ§μ°¬κ°μ§λ‘, μ§μ μκ° λ³νκ° κ°μ₯ ν° μμ 10κ° μ°μ°μλ λ€μκ³Ό κ°μ΄ κ³μ°ν μ μμ΅λλ€.
52
46
53
47
.. code-block :: python
54
48
55
49
df = compare_traces_output.sort_values(by = " diff_duration" , ascending = False )
56
- # The duration differerence can be overshadowed by the "ProfilerStep" ,
57
- # so we can filter it out to show the trend of other operators .
50
+ # "ProfilerStep"μ μν΄ μ§μ μκ° μ°¨μ΄κ° κ°λ €μ§ μ μμΌλ―λ‘ ,
51
+ # μ΄λ₯Ό νν°λ§νμ¬ λ€λ₯Έ μ°μ°μλ€μ κ²½ν₯μ 보μ¬μ€ μ μμ΅λλ€ .
58
52
df = df.loc[~ df.index.str.startswith(" ProfilerStep" )].head(10 )
59
53
TraceDiff.visualize_duration_diff(df)
60
54
61
55
.. image :: ../_static/img/hta/duration_diff.png
62
56
63
- For a detailed example of this feature see the `trace_diff_demo notebook
64
- <https://github.com/facebookresearch/HolisticTraceAnalysis/blob/main/examples/trace_diff_demo.ipynb> `_
65
- in the examples folder of the repository.
57
+ μ΄ κΈ°λ₯μ λν μμΈν μμλ μ μ₯μμ examples ν΄λμ μλ `trace_diff_demo notebook
58
+ <https://github.com/facebookresearch/HolisticTraceAnalysis/blob/main/examples/trace_diff_demo.ipynb> `_ μ 보면 λ©λλ€.
66
59
0 commit comments