--- title: 'Intel VTune Amplifier' taxonomy: category: - docs external_links: process: true no_follow: true target: _blank mode: active --- [toc] ## 利用環境{#enviroment} ### 利用できるバージョン・システム{#version} バージョン | システムA | システムB | システムC -------------------------------- | ----- | ----- | ----- VTune Amplifier XE 2022 (default) | ― | + | + \+ : 利用可能 ― : 利用不可 ### 環境設定{#modules} バージョン | moduleファイル名 -------------------------- | --------------- 2022 | iutils/xe2022 [Intelコンパイラ](/compilers/intel) が利用できる状態で、以下のようにmoduleコマンドを実行してください。 ```nohighlight $ module load iutils ``` moduleコマンドの詳細は [Modules](/config/modules) をご覧ください。 ## 利用方法{#usage} ### コマンド{#command} #### 2020以降 コマンド | 説明 ------------ | --------------------------------- vtune-gui | GUI版のVTune Amplifierを起動します。 vtune | コマンドライン版のVTune Amplifierを起動します。 #### 2019以前 コマンド | 説明 ------------ | --------------------------------- amplxe-gui | GUI版のVTune Amplifierを起動します。 amplxe-cl | コマンドライン版のVTune Amplifierを起動します。 ### オプション{#option} #### amplxe-cl の主なオプション オプション | 説明 -------------------------- | --------------------- -collect=_string_ | 分析を行うタイプを指定します。 -app-working-dir=_string_ | ワーキングディレクトリを指定します。 -r, -result-dir=_string_ | 結果を保存するディレクトリを指定します。 #### amplxe-clの-collectで指定可能な主なタイプ タイプ | 説明 ---------------------- | ---------------------------- concurrency | マルチスレッドの並列性を表示します。 hotspots | ホットスポットを分析します。 lightweight-hotspots | ホットスポットを高速に分析します。 locksandwaits | ロックとウェイトを分析します。 snb_memory-access | Sandy Bridgeでメモリアクセスを分析します。 ## 利用例{#sample} ### GUIでの利用例{#sample_gui} 1. コンパイル Intel VTune Amplifierを使用する場合、デバッグオプション **-g -O2** を指定してコンパイルを行ってください。コンパイルオプションについては [こちら](http://software.intel.com/en-us/articles/compiler-switches-for-intel-vtune-amplifier-xe-for-linux/)も参考にしてください。 ```nohighlight $ icc -g -O2 test.c ``` 2. VTune Amplifier の起動 [Exceed onDemand](/login/eod) で、 **amplxe-gui** コマンドを実行するとVTune Amplifierが起動します。 **xrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。 ```nohighlight $ xrun amplxe-gui ``` ![](amplxe01.png) 3. プロジェクトを作成する **File** => **New** => **Project** を選択すると以下のような画面が表示されますので、適切な **Project name** を入力して、 **Create Project** を押してください。 ![](amplxe02.png) 4. プロジェクトの設定 続いて、Project Properties の画面が表示されますので、対象とするプログラムを **Application** で指定して **OK** を押してください。引数等が必要な場合はここで指定します。 ![](amplxe03.png) 5. 新しい分析の設定 プロジェクトのプロパティ設定が完了すると、下図の画面に戻りますので 三角マークの **New Analysis** を押してください。 ![](amplxe04.png) 5. 分析開始 Choose Analysis Type の画面が表示されますので、チェックの対象を指定した上で、 **Start** を押してください。 ![](amplxe05.png) 6. 分析結果の確認 しばらく待つと、VTune Amplifierでの分析結果が表示されます。この例では、grid_intersect関数がCPU時間を多く使用していることが分かります。 ![](amplxe06.png) #### OpenMPプログラムの解析 GUI版はOpenMPプログラムの解析に対応しています。 xrun コマンドで起動時に、-A オプションでスレッド数を指定します。 例:8スレッド実行 ```nohighlight xrun -A t=8:c=8 amplxe-gui ``` VTuneの起動後、「Advanced Hotspots」を選び、「Analyze OpenMP Regions」を選択して「Start」を押せば、スレッド8並列での解析が行われます。 ![](amplxe07.png) なお、MPIプログラムの解析は、CUI版をご利用ください。 ### CUIでの利用例{#sample_cui} 1. コンパイル Intel VTune Ampliferを使用する場合、デバッグオプション **-g -O2** を指定してコンパイルを行ってください。コンパイルオプションについては [こちら](http://software.intel.com/en-us/articles/compiler-switches-for-intel-vtune-amplifier-xe-for-linux/)も参考にしてください。 ```nohighlight $ icc -g -O2 test.c ``` 2. チェックの実行 CUI版のVTune Amplifierは **amplxe-cl** コマンドで利用できます。この例では、結果を出力するディレクトリの指定して、hotspotsの分析をしています。 **tssrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。 ```nohighlight $ tssrun amplxe-cl -collect hotspots -r=./result ./a.out Parser returned a non-zero error code reading dat/balls.dat Aborting Render... Using result path `/home/b/b59999/intel/amplxe/samples/tachyon/result' Executing actions 75 % Generating a report Summary -------   Elapsed Time: 0.101 CPU Time: 0 Executing actions 100 % done ``` 3. 結果の確認 [Exceed onDemand](/login/eod) など X(GUI)が利用できる環境で、 **amplxe-gui** コマンドを実行し、GUI版のVTune Amplifierで結果を確認してください。 **xrun** コマンドの詳細は [会話型処理](/run/interactive) をご覧ください。 ```nohighlight $ xrun amplxe-gui ./result/result.amplxe ``` ![](amplxe06.png) #### 並列プログラムの解析{#parallel} CUI版はMPIおよびOpenMPプログラムの解析に対応しています。 tssrunでVTuneを実行の際、-A オプションで並列数を指定します。 また、mpiexec.hydra の付加が必要です。 例:MPI4並列で解析 ```nohighlight $ tssrun -A p=4 mpiexec.hydra amplxe-cl -collect hotspots -r=./result ./a.out qsub: waiting for job 1258261.jb to start qsub: job 1258261.jb ready amplxe: Analyzing data in the node-wide mode. The hostname (nb-0041) will be added to the result path/name. amplxe: Collection started. Hello world from processor nb-0041, rank 2 out of 4 processors Hello world from processor nb-0041, rank 3 out of 4 processors Hello world from processor nb-0041, rank 0 out of 4 processors Hello world from processor nb-0041, rank 1 out of 4 processors amplxe: Collection stopped. amplxe: Using result path `/home0/w/w00001/mpitest/b/result.nb-0041' amplxe: Executing actions 19 % Resolving information for `libtmip_psm2.so' amplxe: Warning: Cannot locate debugging symbols for file `/opt/app/intel/impi/2017.2.174/intel64/lib/libtmip_psm2.so'. amplxe: Executing actions 75 % Generating a report amplxe: Executing actions 100 % done Collection start time 07:23:49 19/12/2017 UTC Collection stop time 07:23:50 19/12/2017 UTC Summary ------- Elapsed Time: 0.553 Paused Time: 0.0 CPU Time: 0.310 Average CPU Usage: 0.435 qsub: job 1258261.jb completed ``` ## マニュアル{#manual} * [Intel VTune Amplifier XE 2016 Documentation](https://web.kudpc.kyoto-u.ac.jp/Compiler_Manual/Intel/VTune_Amplifier_XE_2016/en/documentation_amplifier.htm) * [Intel VTune Amplifier XE 2018 Help](https://web.kudpc.kyoto-u.ac.jp/Compiler_Manual/Intel/VTune_Amplifier_XE_2018/index.htm) * [Intel® VTune™ Amplifier 2019 User Guide](https://web.kudpc.kyoto-u.ac.jp/Compiler_Manual/Intel/intel_parallel_studio_xe_2019_3/en/vtune_amplifier/help/index.htm)