计算精度分析工具用于定位x86和鲲鹏指令引起的Fortran语言精度差异问题。
此处以扫描“/home/test/demo1”路径下源码文件为例,编译命令为cmake ..、make,请根据实际情况进行修改,也可参考Fortran语言场景的学习视频。
demo1文件目录结构:
1 2 3 4 5 6 |
demo1 ├── build ├── CMakeLists.txt ├── funcparam_utils.f90 ├── shape_utils.f90 └── test.f90 |
1 2 3 |
cd /home/test/demo1/build cmake .. devkit advisor precision -instrument -c make -p /home/test/demo1 -e test.f90:main -d 1 |
回显信息如下:
Perform the instrumentation and compilation mode. Finish run precision check tool. For detail logs on the tool, see /Path_to_DevKit_CLI/advisor/logs/preccheck.log and /home/test1/demo1/build/precision_20241106111820_6193.txt Please check whether error information exists in above two files to ensure that the project can run properly. Before running the project to get the log file, please add: 1) the libcorrect.mod file path: export LD_LIBRARY_PATH=/Path_to_DevKit_CLI/advisor/devkitplugins/affinity/tools/compileopt/libcruiser/gnu_lib:$LD_LIBRARY_PATH 2) the log file path: export CRUISER_LOG=/LOGPATH/
export LD_LIBRARY_PATH=/Path_to_DevKit_CLI/advisor/devkitplugins/affinity/tools/compileopt/libcruiser/gnu_lib:$LD_LIBRARY_PATH
Flang:
export LD_LIBRARY_PATH=/Path_to_DevKit_CLI/advisor/devkitplugins/affinity/tools/compileopt/libcruiser/bisheng_lib:$LD_LIBRARY_PATH
ifort或者ifx:
export LD_LIBRARY_PATH=/Path_to_DevKit_CLI/advisor/devkitplugins/affinity/tools/compileopt/libcruiser/user_lib:$LD_LIBRARY_PATH
1
|
export CRUISER_LOG=/LOGPATH/ |
“/LOGPATH/”:生成的日志文件存放路径,存放路径下必须为空。
1
|
./myprogram |
运行可执行文件后若有以下输出信息,表示日志文件所在路径磁盘空间已不满足5G,请清理磁盘空间。
1
|
[WARNING] The remaining space is less than 5 GB in /home/test1, please clear enough space and run the program again. |
myprogram:生成的可执行文件。
生成日志时请注意磁盘空间大小。
1 2 3 4 5 6 |
shape_utils.f90|absize|=|28|ins|998058|429d81ed2795e3c586906c6c335aa136 shape_utils.f90|absize|=|28|ins|998058|429d81ed2795e3c586906c6c335aa136 test.f90|main|absize|26|array1d|998058|22160b46bba283274412c4033f1f33fe shape_utils.f90|absize|=|28|ins|998058|429d81ed2795e3c586906c6c335aa136 test.f90|main|xysize|35|x2|998058|5d5ebe7707f02dec747fd0d111d0f83c test.f90|main|submain|41|array1d|998058|22160b46bba283274412c4033f1f33fe |
日志文件中的每条日志分为七部分内容,以图中两条日志信息为例,对每部分内容进行解释。
1:文件名。
2:第三部分内容表达式语句所在的当前最小作用域名称,可能是函数、子例程或主程序。
3:当插桩变量位于函数调用语句(作为函数参数)时,此处为被调用函数名;当插桩变量位于赋值语句时,此处为“=”号。
4:行号。
5:插桩变量名。
6:线程ID。
7:插桩变量值对应的HASH值。
1
|
devkit advisor precision -analysis -i "/home/kunpeng;/home/x86" |
回显信息如下:
1 2 3 4 |
Perform the logs analysis mode. Finish run precision check tool. For detail logs on the tool, see /Path_to_DevKit_CLI/advisor/logs/preccheck.log and /home/test1/demo1/build/precision_20250213110835_5b7a.txt The analysis result is in /home/test1/demo1/build/analysis_diff_20250213110840_935b.txt |