最新的VTune™ Amplifier XE 2013已经可以直接支持Intel® Xeon Phi™ 协处理器,此款协处理器是基于Intel® Many Integrated Core (MIC) 架构
本文用最简洁的语言,介绍VTune在MIC上的使用方法及步骤,以节省用户查找文档和学习的时间。
1. 确认MIC设备处于工作状态
# service mpss status
如果显示 “mpss is stopped”,则启动
# micctrl --resetconfig
# service mpss start
等待
Starting MPSS Stack: [ OK ]
2. 安装VTune及SEP驱动程序 (Optional - 后续的版本可能在产品安装时已经完成SEP驱动的安装,在Target上)
正常安装完工具在Host,转向
# cd /opt/intel/vtune_amplifier_xe_2013/bin64/k1om
#sep_micboot_install.sh
还可以手工安装
# scp sep3_8-k1om-2.6.34-gdc02fc4smp.ko mic0:/lib/modules/
sep3_8-k1om-2.6.34-gdc02fc4smp.ko 100% 1331KB 1.3MB/s 00:00
# ssh mic0
# insmod /lib/modules/sep3_8-k1om-2.6.34-gdc02fc4smp.ko
确认SEP驱动程序已经安装在mic0
# ssh mic0
# lsmod | grep sep
sep3_8 48224 0
exit
# source /opt/intel/vtune_amplifier_xe_2013/amplxe-vars.sh ; 设置环境
3.1 准备应用程序
在MIC上可以有二种程序运行方式:Offload,Native
设置编译器环境
# source /opt/intel/composer_xe_2013/bin/compilervars.sh intel64
准备二个例子:
# icc -g -openmp sampleC01.c -o sampleC01 ;Offload 的例子
# icc -mmic -g int_sin.c -o int_sin; Native的例子,结果Copy到mic0
# scp int_sin mic0:/root
int_sin 100% 24KB 24.0KB/s 00:00
3.2 现在可以进行性能分析了
3.2.1 使用命令行
# amplxe-cl -collect knc-lightweight-hotspots -- ./sampleC01 ; Offload的例子
相对简单的命令行,假定源码和执行程序都在当前目录,不设置搜索路径,也不设置时间,程序正常退出。
# amplxe-cl -report hotspots -r r000lh/
Using result path `/home/peter/r000lh'
Executing actions 50 % Generating a report
Function Module CPU Time
-------------------------------------- ------------------- --------
[vmlinux] vmlinux 1.367
__svml_divf16_mask libsvml.so 0.055
[ld-2.14.90.so] ld-2.14.90.so 0.018
__offload_entry_sampleC01_c_45sample01 sampleC01 0.018
[libstdc++.so.6.0.16] libstdc++.so.6.0.16 0.009
从结果来看热点函数名包含以“__offload_”开始的前缀
此例设定搜索路径,运行时间,用ssh驱动mic上的程序运行
# amplxe-cl -collect knc-lightweight-hotspots -search-dir all=./ -d 20 -- ssh mic0 /root/int_sin
万一在采样时没加搜索路径,可以事后补救, 如:
amplxe-cl -finalize --search-dir all:rp=./ -r r002lh/
# amplxe-cl -report hotspots
Using result path `/home/peter/r002lh'
Executing actions 50 % Generating a report
Function Module CPU Time
----------------- --------------- --------
[vmlinux] vmlinux 21.789
sin int_sin 16.661
main int_sin 1.651
fabs int_sin 1.202
[dropbearmulti] dropbearmulti 0.294
[libc-2.14.90.so] libc-2.14.90.so 0.046
[intel_micveth] intel_micveth 0.028
[busybox] busybox 0.018
Executing actions 100 % done
还有一种是直接使用选中的Events, 如:
# amplxe-cl -collect-with runsa-knc -knob event-config=CPU_CLK_UNHALTED,INSTRUCTIONS_EXECUTED -search-dir all=./ -d 20 -- ssh mic0 /root/int_sin
Killed by signal 2.
Using result path `/home/peter/r010runsa_knc'
Executing actions 33 % Resolving module symbols
Warning: Cannot locate file `micscif.ko'.
Executing actions 34 % Resolving information for `micscif'
Warning: Cannot locate file `/usr/bin/dropbearmulti'.
Executing actions 35 % Resolving information for `int_sin'
Warning: Cannot locate file `/lib64/libc-2.14.90.so'.
Executing actions 36 % Resolving information for `libc-2.14.90.so'
Warning: Cannot locate file `/boot/vmlinuz-2.6.34-gdc02fc4'.
Executing actions 37 % Resolving information for `vmlinux'
Warning: Cannot locate file `/lib64/ld-2.14.90.so'.
Executing actions 50 % Generating a report
Summary
-------
Elapsed Time: 20.018
Executing actions 100 % done
(所支持的Events可以从vtune_amplifier_xe_2013/lib64/knc_db.txt中找到)
3.2.2 直接工作在图形界面
运行 amplxe-gui, 首先看配置(以Native模式为例,Offload模式和以前的Host用法一样)
a. 程序设置

b. 指定模块、源码路径

c. 选择分析类型

d. 输出结果

