Memory Consistency Check
The memory consistency check function checks for any memory consistency problem when the source code is ported to the Kunpeng platform and provides suggestions on inserting memory barriers.
- Before using this function, ensure that the drive where the tool is installed has sufficient space. During the weak memory sequence checks, large intermediate files are generated. According to empirical data, about 100 GB of available memory is required for every 100,000 lines of code.
- The check of a large amount of source code consumes many resources. It is recommended the code to be checked do not exceed 100,000 lines.
- The memory consistency check function is available on the Kunpeng platform.
Command Function
Checks memory inconsistency problems in source code.
Syntax
devkit advisor mm-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH}{-f BC_PATH | --bc-file BC_PATH} [--autofix {true,false}] [--autofix-dir AUTOFIX_OUTPUT_PATH] [-o OUTPUT_PATH | --output OUTPUT_PATH] [-r {all,json,html,csv} | --report-type {all,json,html,csv}] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. |
-i/--input |
input_path |
Path of the source code folder corresponding to the BC file. This parameter is mandatory. |
-f/--bc-file |
path |
BC folder path. BC files must exist in this path. This parameter is mandatory. |
--autofix |
true/false |
Indicates whether to generate a compiler configuration file. The default value is false. |
--autofix-dir |
path |
Path for storing the compiler configuration file. By default, the file is generated in the source code folder in the tool directory. The file takes effect only when the --autofix parameter is used and is set to true. |
-o/--output |
output_path |
Path for storing scan reports. By default, scan reports are stored in the current execution path. A report name is the format of Module name_Timestamp. |
--set-timeout |
time |
Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. By default, there is no timeout interval. The task will be executed until it is complete. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1.
|
-r/--report-type |
all/json/html/csv |
Scan report format, which defaults to all.
|
Example
In this example, the source code in the /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort directory is scanned. Replace the example directory with the actual one.
devkit advisor mm-check -i /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort -f /opt/DevKit/testcase/affinity/weak_cons/bc_file -l 0
The following information is displayed and a report is generated:
Scanned time: 20240229061648
Configuration:
Scan bc files path: /opt/DevKit/testcase/affinity/weak_cons/bc_file
Scan source code path: /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort
Autofix: false
Generate report path: /home/DevKit_Software
Generate report type: all
Task Timeout Interval: The timeout period is not set.
Log level: debug
Summary:
Scanned 2 bc files, there are 6 recommended modifications.
For the details information, please check:
/home/DevKit_Software/mem-check_20240229061648_7905.json
/home/DevKit_Software/mem-check_20240229061648_7905.html
/home/DevKit_Software/mem-check_20240229061648_7905.csv
Output Report
Parameter |
Description |
|---|---|
Configuration |
Displays the paths of the software source file and BC file. |
Source File to Be Modified |
Displays information such as the path of the source file that needs to be modified. |