Rate This Document
Findability
Accuracy
Completeness
Readability

Checking Matricization

The matricization check function checks matricizable code fragments and provides modification suggestions.

Command Function

Checks matricizable code snippets.

Syntax

devkit advisor matrix-check {-i INPUT_PATH | --input INPUT_PATH} [-s SCAN_DIR | --scan-dir SCAN_DIR] [(-b{make, cmake} | --build-tool {make,cmake}) & (-c COMMAND | --cmd COMMAND)] | [-j COMPILE_JSON_PATH | --compile-command-json COMPILE_JSON_PATH] [-o OUTPUT_PATH | --output OUTPUT_PATH] [-r {all,html,csv} | --report-type {all,html,csv}] [-p {sme,domain} | --optimization {sme,domain}] [-m {compute,memory_access,communication} | --module {compute,memory_access,communication}] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeoutTIMEOUT]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-i/--input

-

Path to the source code folder to be scanned.

-s/--scan-dir

-

Relative path to the file or folder to be scanned in the source folder.

-b/--build-tool

make/cmake

Build tool, which defaults to make.

-c/--cmd

-

Builds source code. If the command contains spaces, use single quotation marks (').

Enter -c or -j.

-j/--compile-command-json

-

Path to the compile_commands.json file. For details about how to generate a JSON file, see Generating a JSON File.

Enter -c or -j.

-o/--output

-

Path for storing scan reports. By default, scan reports are stored in the current execution path. A report name is the format of Feature name_Timestamp.

-l/--log-level

0/1/2/3

Log level, which defaults to 1.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-r/--report-type

all/html/csv

Scan report format, which defaults to all.

  • all: generates reports in HTML and CSV formats.
  • html: generates a report only in HTML format.
  • csv: generates a report only in CSV format.

-p/--optimization

sme/domain

Matrix optimization method. This parameter is mandatory.

  • sme: SME-based matricization, covering Stencil, GEMV, and FFT.
  • domain: domain-specific optimization, which must be used together with the -m option.

-m/--module

compute/memory_access/communication

Optimization methods for specified domains:

  • compute: computing optimization, including equivalent transformation, elimination of redundant common operators, unit step calculation optimization, precision-consistent conversion of division to multiplication, search algorithm optimization, reduction calculation parallelization, directive statement optimization, sin/cos operator fusion, exp calculation simplification, and loop fusion.
  • memory_access: memory access optimization, that is, large data dimension reduction.
  • communication: communication optimization, that is, communication hiding.

--set-timeout

-

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.

For details about SME-based matricization and domain-specific optimization technologies, see Matricization Check.

Example

In this example, the source code in the /home/advisor/project directory is scanned, the build tool is make, and the build command is make.

devkit advisor matrix-check -i /home/advisor/project -c make -b make
The following information is displayed and a report is generated:
Executing the matricization task, please wait...
Current progress: 
Scanned time: 2024/05/17 06:17:34

Configuration:
     Scan source code path: /home/advisor/project
     Generate report path: /home/DevKit_Software
     Generate report type: all
     Task Timeout Interval: The timeout period is not set.
     Log level: info

Summary:
    Scanned 0 files, there are 0 sugguestions.

For the detailed information, please check
    /home/DevKit_Software/matrix-check_20240229024448_4d53.html
    /home/DevKit_Software/matrix-check_20240229024448_4d53.csv 

Output Report

Table 2 Output report parameters

Parameter

Description

Configuration

Displays the software source file path.

Source File to Be Modified

Displays information such as the path to the source file that needs to be modified.