Matricization Check
The tool checks matricizable code fragments and provides modification suggestions.
Introduction
The matricization check tool checks and optimizes code snippets that incorporate the Stencil, General matrix-vector multiplication (GEMV), or Fast Fourier Transform (FFT) technology. The tool can check and optimize C, C++, and Fortran source code. The check process is performed on the abstract syntax tree (AST). The C and C++ source code uses Clang to generate the AST, and the Fortran source code uses Fparser to generate the AST. The tuning process is closely related to each computing mode.
- Stencil computation is an important kind of computation widely used in scientific applications, such as partial differential equations, the Gauss–Seidel method, computational fluid dynamics, and earth system simulation. It iteratively updates the values of the spatial grid points over multiple time steps according to a given pattern. The fixed pattern in which each point in the spatial grid is updated based on a subset of its neighbors is called Stencil.
- GEMV is a common linear algebra operation that can be highly optimized to take advantage of the parallelism and vectorization instructions of modern computer architectures. In computer science, GEMV is usually used as part of matrix multiplication, that is, multiplying a matrix with a vector.
- FFT is an efficient and fast method for calculating the discrete Fourier transform (DFT). This method features a high calculation efficiency since it can complete the calculation within the time complexity of O(nlogn), where n is the length of the sequence. At the same time, it has good flexibility for it supports different decomposition methods and calculation algorithms.
Prerequisites
- /opt/DevKit is the default installation directory of the tool. The following uses this directory as an example. Replace it with the actual directory.
- To perform a 64-bit running mode check on the WebUI, you need to manually upload files or compressed packages. In the IDE, you can simply scan local projects to run the check.
Procedure
- On the left pane of the page, choose Affinity Analyzer > Matricization Check and click
to create a task. See Figure 1.
Table 1 Matricization check parameters Parameter
Description
Task Name
A task name is automatically generated by default, which can be modified as required.
Source File Path
Set this parameter using either of the following methods:
- If you want to use uploaded source code, click the text box and select a source code path from the drop-down list or manually enter a source code path.
- Click Upload on the right to upload the package or folder. (The package is automatically decompressed during the upload.)
NOTE:- Only TAR, TAR.BZ, TAR.BZ2, TAR.GZ, TAR.XZ, TBZ, TBZ2, TGZ, TXZ and ZIP packages can be uploaded. Only one package can be uploaded at a time. The source package cannot exceed 1 GB, and the extracted files must be less than or equal to half of the remaining drive space.
- Only one folder can be uploaded at a time. The size of the folder must be less than or equal to half of the remaining drive space.
- Before manually uploading a software package, check whether the target directory exists. If it does not exist, create such a directory and grant the read, write, and execute permissions to the devkit user.
Compiler Options
Select a compilation method. The options are:
- Fill in the compile command
- Upload the compile_commands.json file. For details about how to upload the JSON file, see Generating a JSON File.
Build Tool
Select a build tool. The options are:
- Make
- CMake
- Click Check. After the check is complete, the check report page is displayed. See Figure 2. Click the Task Information tab page to view the task details.
- If the check result suggests that there are source files need to be modified, click View Suggested Source Code in the Operation column. See Figure 3.
- The tool supports concurrent running of multiple matricization check tasks.
- To cancel a task, click Close during the task running process.
- You can click the arrow keys in the upper right corner of Original Source Code to view the code.
- If the check fails or the check result indicates that no modification is required, an empty report is generated.


