使用APS快速获取程序性能瓶颈

APS是一种不需要重新编译程序,就能分析程序所在瓶颈的工具

  1. 在运行的程序前面加上aps即可

    • 对于mpirun的程序,指令类似如下

      mpirun -n 4 -machinefile machinefile aps ./myApp
    • 对于非mpirun的程序,指令类似如下

      aps ./myApp
  2. 如果要获取MPI的一些详细信息,需要加上环境变量MPS_STAT_LEVEL,其取值含义如下

LevelInformation is collected about
1 (default)MPI functions and their times
2MPI functions and amount of transmitted data
3MPI functions, communicators, and message sizes
4MPI functions, communicators, communication directions and aggregated traffic for each direction
5MPI functions, communicators, message sizes, and communication directions

如果是用mpirun运行程序,建议使用类似如下指令

mpirun -n 4 -machinefile machinefile aps -genv MPS_STAT_LEVEL 5 ./myApp
  1. ps. 对于应用cesm会产生不过:在执行完cesm.exe后无法继续执行后续脚本,任务会被挂起到后台,需要使用fg [%N]命令将任务切换到前台执行完。

  2. 在执行目录会生成名称为aps_result_[date]的文件夹,可以执行以下操作

    • 生成html查看程序性能大致性能信息,执行如下命令
      aps-report aps_result_[date]
      即可生成一个html
    • 在命令行查看详细信息,使用aps-report -help查看其它参数,加参数即可。(不知道为啥官网有将其它结果也可视化的html方法,但是我尝试失败了,只能命令行查看)