Rate This Document
Findability
Accuracy
Completeness
Readability

Calculation Precision Analysis Functions

The calculation precision analysis tool locates the precision differences of the Fortran, C, and C++ languages caused by x86 and Kunpeng instructions.

Command Function

Locates the precision differences of the Fortran, C, and C++ languages caused by x86 and Kunpeng instructions.

Calculation precision analysis can identify the KML_MATH functions used in your application. If your application uses these functions but is not linked to the KML_MATH library, you will be advised to use the KML_MATH library. For details about the supported functions, see Kunpeng Math Library.

Syntax

Compilation and instrumentation:

1
devkit advisor precision [-h | --help] {-instrument | --instrument} {-c COMMAND COMMANDS | --commands COMMANDS} {-p PROJECT | --project PROJECT} {-e ENTRY | --entry ENTRY} [-v VARIABLE | --variable VARIABLE] [-d DEPTH | --depth DEPTH] [-L | --loops] [-D DATABASE| --database DATABASE] [-b BLACK_LIST | --black-list BLACK_LIST] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]

Log difference analysis:

1
devkit advisor precision [-h | --help] {-analysis | --analysis} {-i INPUT_LOG | --input INPUT_LOG} [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]

To use the calculation precision analysis tool, you need to perform compilation and instrumentation on the different platforms (Kunpeng and x86). After the instrumentation is complete, analyze log differences.

Parameter Description

Table 1 Compilation and instrumentation parameters

Parameter

Option

Description

-h/--help

-

Obtains help information. This parameter is optional.

-instrument/--instrument

-

Compilation and instrumentation mode. This parameter is mandatory.

-c/--commands

-

Builds source code. If there are multiple build commands, separate them with semicolons (;) and enclose them with single quotation marks (') or double quotation marks ("). If a command contains spaces, enclose it with single or double quotation marks. This parameter is mandatory.

Example: "make all" or "cd /home/test;make"

NOTE:
  • Do not run the cmake command directly. You need to run the command in advance.
  • The source code build command in the command line tool does not support variable setting and environment variable export.

    Example: "CFLAGS='-O0 -g';make" or "export CFLAGS='-O0 -g';make"

-p/--project

-

Absolute path to the project source code. This parameter is mandatory.

Example: /home/test/project1/ or /home/project2/

-e/--entry

-

Instrumentation entry file and the associated function. This parameter is mandatory. Enter the relative path (specified by -p/--project) to the entry file in the project path. The file is used for compilation and cannot be the source file before preprocessing. The function is Main Program, Function, or Subroutine that exists in the specified Fortran file.

NOTE:

Each file and its function must be separated using a colon (:).

  • Specify a single function of a single file.

    -e File_name:Function_name (for example, -e demo.f90:main)

  • Specify multiple functions of a single file. Use commas (,) to separate the functions.

    -e File_name:Function_name_1,Function_name_2 (for example, -e demo.f90:main,func)

  • Specify multiple files.

    Use multiple -e parameters to specify each file and function name (for example, -e demo.f90:main -e test.f90:func).

-v/--variable

-

Parameter instrumentation mode, which is used to specify a certain variable. This parameter is optional. When this parameter is specified, the instrumentation depth is forcibly set to 0.

-d/--depth

-

Depth of continuous instrumentation from the entry function. The default value is 0. The value ranges from 0 to 99. This parameter is optional.

-L/--loops

-

Instrumentation inside loops. This parameter is optional. When this option is selected, the precision log file generated by running the executable file after instrumentation becomes larger. Properly arrange the instrumentation entry (entry file and function) and depth.

-D/--database

-

Path to the compilation database. After you specify the path, incremental compilation will be performed. This parameter is optional. The compilation database file dev_compile_commands.json is generated by instrumentation using the calculation precision analysis tool for the first time.

-b/--black-list

-

Files that do not participate in instrumentation. The value must be an absolute file path. This parameter is optional. The files do not contain the file specified by the -e parameter.

Example: "/home/test/demo1.f90;/home/test/demo2.f90"

-l/--log-level

0/1/2/3

Log level, which defaults to 1. This parameter is optional.

  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

--set-timeout

-

Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete.

Table 2 Parameters of log difference analysis modes

Parameter

Option

Description

-h/--help

-

Obtains help information. This parameter is optional.

-analysis/--analysis

-

Log difference analysis mode. This parameter is mandatory.

-i/--input

-

Path to the specified log files or log file directories. The input sequence is Kunpeng logs first and then x86 logs. This parameter is mandatory.

Example: "/home/kunpeng.log;/home/x86.log" or "/home/kunpeng/;/home/x86/"

-o/--output

-

Directory for storing analysis result files. The default directory is the current directory. This parameter is optional.

-l/--log-level

0/1/2/3

Log level, which defaults to 1. This parameter is optional.

  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

--set-timeout

-

Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete.