Browse code

20230922: Intel VTune Profiler open

root authored on2023-09-22 09:40:18
Showing7 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,309 @@
1
+---
2
+title: 'Intel VTune Profiler'
3
+taxonomy:
4
+    category:
5
+        - docs
6
+external_links:
7
+    process: true
8
+    no_follow: true
9
+    target: _blank
10
+    mode: active
11
+media_order: 'amplxe01.png,amplxe02.png,amplxe03.png,amplxe04.png,amplxe05.png,amplxe06.png,amplxe07.png,vtune_1.png,vtune_5.png,vtune_6.png,vtune_2.png,vtune_3.png,vtune_4.png'
12
+---
13
+
14
+[toc]
15
+
16
+## 利用環境{#enviroment}
17
+
18
+
19
+
20
+### 利用できるバージョン・システム{#version}
21
+
22
+バージョン     | モジュールファイル名| システムA |  システムB/C | システムG | クラウドシステム | 備考 | 
23
+---------------| ------------------  | --------- |  ----------- | --------- | ---------------- |      |
24
+2023           |  intel-vtune/2023.1 |  +        |  +           |  -        |  -               |      |
25
+2022 (default) |  intel-vtune/2022.3 |  +        |  +           |  -        |  -               |      |
26
+
27
+
28
+
29
+
30
+\+: すべてのユーザが利用可能
31
+- : 利用不可
32
+
33
+[Intelコンパイラ](/compilers/intel) が利用できる状態で、以下のようにmoduleコマンドを実行してください。
34
+
35
+
36
+```nohighlight
37
+$ module load intel-vtune
38
+```
39
+
40
+
41
+moduleコマンドの詳細は [Modules](/config/modules) をご覧ください。
42
+
43
+
44
+## 利用方法{#usage}
45
+
46
+
47
+
48
+### コマンド{#command}
49
+
50
+コマンド     |  説明                               
51
+------------ | ---------------------------------
52
+ vtune-gui   |   GUI版のVTune Profilerを起動します。     
53
+ vtune       |    コマンドライン版のVTune Profilerを起動します。 
54
+
55
+
56
+### オプション{#option}
57
+
58
+
59
+#### vtune の主なオプション
60
+
61
+オプション                     |  説明                   
62
+-------------------------- | ---------------------
63
+ -collect=_string_         |  分析を行うタイプを指定します。     
64
+ -app-working-dir=_string_ |  ワーキングディレクトリを指定します。  
65
+ -r, -result-dir=_string_  |  結果を保存するディレクトリを指定します。
66
+
67
+
68
+#### vtuneの-collectで指定可能な主なタイプ
69
+
70
+タイプ                 |  説明                          
71
+---------------------- | ----------------------------
72
+ threading             |  マルチスレッドの並列性を表示します。         
73
+ hotspots              |  ホットスポットを分析します。                        
74
+ memory-access         |  メモリアクセスを分析します。
75
+
76
+
77
+## 利用例{#sample}
78
+
79
+
80
+
81
+### GUIでの利用例{#sample_gui}
82
+
83
+
84
+1. コンパイル  
85
+Intel VTune Profilerを使用する場合、デバッグオプション **-g** と実際のプログラム実行時と同等な最適化オプションを指定してコンパイルを行ってください。
86
+
87
+    ```nohighlight
88
+    $ icc -g -O2 test.c
89
+    ```
90
+
91
+2. VTune Profiler の起動  
92
+[MobaXterm](/login/mobaxterm) または [FastX](/login/fastx) で、 **vtune-gui** コマンドを実行するとVTune Amplifierが起動します。 **tssrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。
93
+
94
+    ```nohighlight
95
+    $ tssrun --x11 vtune-gui 
96
+    ```
97
+
98
+    ![](vtune_1.png?width=600)
99
+3. プロジェクトを作成する  
100
+画面中央の **New Project** を選択すると以下のような画面が表示されますので、適切な **Project name** を入力して、 **Create Project** を押してください。
101
+
102
+    ![](vtune_2.png?width=400)
103
+
104
+4. プロジェクトの設定  
105
+続いて、Configure Analysis の画面が表示されますので、対象とするプログラムを **Application** で指定して **OK** を押してください。引数等が必要な場合はここで指定します。
106
+
107
+    ![](vtune_3.png?width=600)
108
+
109
+5. 分析開始  
110
+Performance Snapshot を押して、チェックの対象を指定したうえで、三角マークの **Start** を押してください。
111
+
112
+    ![](vtune_4.png?width=600)
113
+
114
+6. 分析結果の確認  
115
+しばらく待つと、VTune Profilerでの分析結果が表示されます。この例では、multiply1関数がCPU時間を多く使用していることが分かります。
116
+
117
+    ![](vtune_5.png?width=600)
118
+
119
+
120
+#### OpenMPプログラムの解析
121
+
122
+GUI版はOpenMPプログラムの解析に対応しています。
123
+tssrun コマンドで起動時に、--rsc オプションでスレッド数を指定します。
124
+
125
+例:8スレッド実行
126
+```nohighlight
127
+tssrun --x11 --rsc t=8:c=8 vtune-gui
128
+```
129
+
130
+<!--
131
+VTuneの起動後、「Advanced Hotspots」を選び、「Analyze OpenMP Regions」を選択して「Start」を押せば、スレッド8並列での解析が行われます。 
132
+
133
+![](amplxe07.png)
134
+-->
135
+
136
+
137
+#### MPIプログラムの解析
138
+MPIプログラムの解析は、CUI版をご利用ください。
139
+
140
+### CUIでの利用例{#sample_cui}
141
+
142
+1. コンパイル  
143
+Intel VTune Profilerを使用する場合、デバッグオプション **-g** と実際のプログラム実行時と同等な最適化オプションを指定してコンパイルを行ってください。
144
+
145
+    ```nohighlight
146
+    $ icc -g -O2 test.c
147
+    ```
148
+
149
+2. チェックの実行  
150
+CUI版のVTune Profilerは **vtune** コマンドで利用できます。この例では、結果を出力するディレクトリの指定して、hotspotsの分析をしています。 **tssrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。
151
+
152
+```nohighlight
153
+$ tssrun vtune -collect hotspots  -r=./result.vtune ./a.out
154
+salloc: Pending job allocation 723318
155
+salloc: job 723318 queued and waiting for resources
156
+salloc: job 723318 has been allocated resources
157
+salloc: Granted job allocation 723318
158
+salloc: Waiting for resource configuration
159
+salloc: Nodes xb0013 are ready for job
160
+vtune: Analyzing data in the node-wide mode. The hostname (xb0013) will be added to the result path/name.
161
+vtune: Collection started.
162
+
163
+(略)
164
+
165
+vtune: Executing actions 42 % Saving the resultElapsed Time: 0.075s
166
+ | Application execution time is too short. Metrics data may be unreliable.
167
+ | Consider reducing the sampling interval or increasing your application
168
+ | execution time.
169
+ |
170
+    CPU Time: 0.050s
171
+        Effective Time: 0s
172
+        Spin Time: 0s
173
+            Imbalance or Serial Spinning: 0s
174
+            Lock Contention: 0s
175
+            Other: 0s
176
+        Overhead Time: 0.050s
177
+         | A significant portion of CPU time is spent in synchronization or
178
+         | threading overhead. Consider increasing task granularity or the scope
179
+         | of data synchronization.
180
+         |
181
+            Creation: 0s
182
+            Scheduling: 0s
183
+            Reduction: 0s
184
+            Atomics: 0s
185
+            Other: 0.050s
186
+    Total Thread Count: 1
187
+    Paused Time: 0s
188
+
189
+Top Hotspots
190
+Function                       Module       CPU Time  % of CPU Time(%)
191
+-----------------------------  -----------  --------  ----------------
192
+__kmp_api_omp_get_max_threads  libiomp5.so    0.050s            100.0%
193
+Effective Physical Core Utilization: 100.0% (112.000 out of 112)
194
+    Effective Logical Core Utilization: 148.8% (333.230 out of 224)
195
+Collection and Platform Info
196
+    Application Command Line: ../oss/openmp/omp-sample/01_hello/src/c/run.x
197
+    Operating System: 4.18.0-477.15.1.el8_8.x86_64 Red Hat Enterprise Linux release 8.8 (Ootpa)
198
+    Computer Name: xb0013
199
+    Result Size: 5.5 MB
200
+    Collection start time: 09:39:56 21/09/2023 UTC
201
+    Collection stop time: 09:39:57 21/09/2023 UTC
202
+    Collector Type: Event-based counting driver,User-mode sampling and tracing
203
+    CPU
204
+        Name: Intel(R) Xeon(R) Processor code named Sapphirerapids
205
+        Frequency: 2.000 GHz
206
+        Logical CPU Count: 224
207
+        LLC size: 110.1 MB
208
+        Cache Allocation Technology
209
+            Level 2 capability: available
210
+            Level 3 capability: available
211
+
212
+If you want to skip descriptions of detected performance issues in the report,
213
+enter: vtune -report summary -report-knob show-issues=false -r <my_result_dir>.
214
+Alternatively, you may view the report in the csv format: vtune -report
215
+<report_name> -format=csv.
216
+vtune: Executing actions 100 % done
217
+salloc: Relinquishing job allocation 723318
218
+
219
+exit code: 0
220
+    ```
221
+
222
+3. 結果の確認  
223
+[MobaXterm](/login/mobaxterm) または [FastX](/login/fastx) など X(GUI)が利用できる環境で、 **vtune-gui** コマンドを実行し、GUI版のVTune Amplifierで結果を確認してください。 **tssrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。
224
+
225
+    ```nohighlight
226
+    $ tssrun --x11 vtune-gui ./result/result.vtune
227
+    ```
228
+
229
+    ![](vtune_6.png?width=600)
230
+
231
+#### 並列プログラムの解析{#parallel}
232
+
233
+CUI版はMPIおよびOpenMPプログラムの解析に対応しています。
234
+tssrunでVTuneを実行の際、--rsc オプションで並列数を指定します。
235
+<!--
236
+また、mpiexec.hydra の付加が必要です。
237
+-->
238
+例:MPI4並列で解析
239
+
240
+```nohighlight
241
+$ tssrun --rsc p=4 vtune -collect hotspots  -r=./result ./a.out
242
+salloc: Pending job allocation 723080
243
+salloc: job 723080 queued and waiting for resources
244
+salloc: job 723080 has been allocated resources
245
+salloc: Granted job allocation 723080
246
+vtune: Analyzing data in the node-wide mode. The hostname (xb0127) will be added to the result path/name.
247
+vtune: Collection started.
248
+
249
+(略)                             
250
+                                                         
251
+vtune: ExecutinElapsed Time: 1.015sg the result
252
+    CPU Time: 1.710s
253
+        Effective Time: 1.710s
254
+        Spin Time: 0s
255
+            MPI Busy Wait Time: 0s
256
+            Other: 0s
257
+        Overhead Time: 0s
258
+            Other: 0s
259
+    Total Thread Count: 8
260
+    Paused Time: 0s
261
+
262
+Top Hotspots
263
+Function                Module                CPU Time  % of CPU Time(%)
264
+----------------------  --------------------  --------  ----------------
265
+read                    libc.so.6               0.670s             39.2%
266
+PMPI_Init               libmpi.so.12            0.112s              6.6%
267
+main                    allrank                 0.100s              5.8%
268
+dlopen                  libdl.so.2              0.089s              5.2%
269
+[ld-linux-x86-64.so.2]  ld-linux-x86-64.so.2    0.080s              4.7%
270
+[Others]                N/A                     0.658s             38.5%
271
+Effective Physical Core Utilization: 89.5% (100.261 out of 112)
272
+    Effective Logical Core Utilization: 45.0% (100.843 out of 224)
273
+     | The metric value is low, which may signal a poor utilization of logical
274
+     | CPU cores while the utilization of physical cores is acceptable. Consider
275
+     | using logical cores, which in some cases can improve processor throughput
276
+     | and overall performance of multi-threaded applications.
277
+     |
278
+Collection and Platform Info
279
+    Application Command Line: ../lecture/20230906/mpi/allrank
280
+    Operating System: 4.18.0-477.15.1.el8_8.x86_64 Red Hat Enterprise Linux release 8.8 (Ootpa)
281
+    Computer Name: xb0127
282
+    Result Size: 7.2 MB
283
+    Collection start time: 09:24:37 21/09/2023 UTC
284
+    Collection stop time: 09:24:38 21/09/2023 UTC
285
+    Collector Type: Event-based counting driver,User-mode sampling and tracing
286
+    CPU
287
+        Name: Intel(R) Xeon(R) Processor code named Sapphirerapids
288
+        Frequency: 2.000 GHz
289
+        Logical CPU Count: 224
290
+        LLC size: 110.1 MB
291
+        Cache Allocation Technology
292
+            Level 2 capability: available
293
+            Level 3 capability: available
294
+
295
+If you want to skip descriptions of detected performance issues in the report,
296
+enter: vtune -report summary -report-knob show-issues=false -r <my_result_dir>.
297
+Alternatively, you may view the report in the csv format: vtune -report
298
+<report_name> -format=csv.
299
+vtune: Executing actions 100 % done
300
+salloc: Relinquishing job allocation 723080
301
+
302
+exit code: 0
303
+```
304
+
305
+
306
+## マニュアル{#manual}
307
+
308
+* [Intel VTune Profiler Documentation](https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler-documentation.html)
309
+* [Intel VTune Progiler User Guide](https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-2.html)
0 310
new file mode 100644
1 311
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_1.png differ
2 312
new file mode 100644
3 313
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_2.png differ
4 314
new file mode 100644
5 315
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_3.png differ
6 316
new file mode 100644
7 317
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_4.png differ
8 318
new file mode 100644
9 319
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_5.png differ
10 320
new file mode 100644
11 321
Binary files /dev/null and b/user/pages/08.compilers/15.intel_vtune/vtune_6.png differ