Development Environment Setup, Compilation, and UT Methods for MindStudio Kernel Performance Prediction¶
1. Background Knowledge Required¶
For details about the code framework and core process, see the msKPP Architecture Design Specifications.
2. Development Environment Setup¶
-
For hardware environment requirements, see Ascend Product Models.
-
Set up the environment by referring to the Operator Tool Development Environment Setup Guide.
-
Python 3.9 or later must be installed in the build environment.
-
msKPP depends on other Python libraries. You can run the
pip install -r requirement.txtcommand to install the dependency libraries in one-click mode. GCC version > 7.4.03.20.2 <= CMAKE version <= 3.31.10
3. Building and Packaging¶
There are two methods, each with its own advantages and disadvantages:
| Method | Application Scenario | Advantages | Disadvantages |
|---|---|---|---|
| One-click script | Initial build and CI/CD pipeline | Zero configuration, one-step setup | Steps cannot be executed independently. |
| Step-by-step script | Routine development and incremental build | Flexibility and efficiency | Multiple steps are required. |
3.1 Method 1: One-click Script¶
3.2 Method 2: Step-by-Step Script¶
3.2.1 Building and Packaging¶
mkdir build
cd build
cmake ..
make -j$(nproc) install # -j indicates the number of parallel build jobs, which can be specified as required. If nproc is unavailable, manually enter a number (for example, -j8).
3.2.1.2 Build Result Description¶
The build result is generated in the output directory:
output/
|-- include # API header file
|-- lib # Static library
|-- lib64 # Dynamic library
|-- mindstudio_kpp-XXX-py3-none-manylinux_2_31_XXX.whl # Installation package
3.2.3 Cleanup/Rebuild¶
Delete the build directory and perform operations in Section 3.2.1 again.
4. Running UT¶
4.1 One-click script¶
The Python UT depends on the pytest and coverage tools, which can be installed by running pip install coverage pytest.
If the number of executed test cases is the same as the number of passed test cases, the test is successful. The output is similar to the following:
4.2 Cleanup/Rebuild¶
Delete the build directory and perform operations in Section 4.1 again.