1.跟踪和正确性验证
在你运行mpi程序的时候,可以使用Intel® Trace Analyzer and Collector以及Application Performance Snapshot来跟踪和收集数据。
High-Level Performance Analysis:
intel提供了一个轻量级的analysis,就是上面说的aps,下面是一个使用示例:
//启动相关程序
$ source <psxe_installdir>/compilers_and_libraries_<version>.<update>.<package>/linux/bin/compilervars.sh intel64
$ source <psxe_installdir>/compilers_and_libraries_<version>.<update>.<package>/linux/mpi/intel64/bin/mpivars.sh
$ source <psxe_installdir>/performance_snapshots/apsvars.sh
//运行aps
$ mpirun -n 4 -aps ./myprog
//运行aps-report
$ aps-report ./aps_result_<date>-<time>
注意//那几行是我的注释,命令行时请不要输入,下同,后面不再重复。
这时候会弹出控制台显示结果。当然aps也会生成一个html文件包含相关信息。文件名为:
aps_report_<date>_<time>.html
Tracing Applications:
当使用Intel Trace Analyzer and Collector时,你需要生成一个你的应用的trace文件,然后用Intel® Trace Analyzer去分析相关信息。trace文件的生成可以使用Intel® Trace Collector,可以用-t(-trace)命令快速调用Intel® Trace Collector,下面是一个例子:
//启动相关程序
$ source <mpi_installdir>/intel64/bin/mpivars.sh
$ source <itac_installdir>/intel64/bin/itacvars.sh
//启动trace Collector
$ mpirun -trace -n 4 ./myprog
//使用分析器分析
$ traceanalyzer ./myprog.stf &
检测正确性:
使用-check_mpi来启用正确性检测,正确性检测可以检测一些比较常见的问题,具体包括(data types, buffers, communicators, point-to-point messages and collective operations, detect deadlocks, or data corruption),注意最好打开debug选项(-g),例如:
$ mpirun -check_mpi -n 4 ./myprog
...
[0] ERROR: GLOBAL:COLLECTIVE:DATATYPE:MISMATCH: error
...