Rate This Document
Findability
Accuracy
Completeness
Readability

Difference Analysis Tool

According to the instrumentation method for analyzing calculation result differences, a large number of repeated instrumentation actions are performed during cause locating. To improve analysis efficiency, Hawkeye is developed based on the debugging function of the GNU debugger (GDB). This tool can automatically instrument functions, recursively traverse function calling, automatically record functions that cause calculation result differences.

Figure 1 Using Hawkeye

Restrictions

  1. This tool uses the debugging function of GDB and depends on the symbol table in the binary file. Therefore, you need to change the compilation option optimization level of the application to be analyzed to -O0 and add the -g compilation option.
  2. This tool supports only single-thread debugging and does not support OpenMP.

Procedure

The following uses WRF 3.4.1 as an example.

  1. Change the optimization level to -O0 and modify compilation options by add -g and deleting -fopenmp and -qopenmp.
  2. Link WRF to the print_md5.o static library. The static library can read and write input values and generate MD5 values. It can be stored in the same directory as wrf.exe. You can also specify a storage directory.

    Modify the main/Makefile file. Before modification:

    $(LD) -o wrf.exe $(LDFLAGS) -fopenmp wrf.o ../main/module_wrf_top.o $(LIBWRFLIB) $(LIB)

    After modification:

    $(LD) -o wrf.exe $(LDFLAGS) -lcrypto print_md5.o wrf.o ../main/module_wrf_top.o $(LIBWRFLIB) $(LIB)
  3. Place the WRF binary file, computing test cases, and the Hawkeye tool in the same directory. Specify the application name and main function file path to run Hawkeye.
    ./hawkeye.sh wrf.exe wrf-3.4.1/dyn_em/solve_em.f90
    Figure 2 Hawkeye analysis result

    The analysis result displays the functions that have different calculation results on the Kunpeng and x86 platforms and their paths. To facilitate function locating, their call stacks are also displayed. Figure 3 shows the tree structure of the MD5 value file of each function. You can view the MD5 value files to further analyze causes of differences.

    Figure 3 MD5 value files saved by Hawkeye