msSanitizer (Operator Anomaly Detection)
The msSanitizer tool is used throughout the operator development cycle to allow developers to ensure the quality and stability of operators. By detecting and fixing exceptions in the early stage, msSanitizer greatly mitigates potential risks and reduces maintenance costs after product rollout.
- After the tool is started, the tool run log file mssanitizer_{TIMESTAMP}_{PID}.log is automatically generated in the current directory. After the user program is executed, an exception report is displayed.
- ${git_clone_path} is the path of the sample repository.
- Run the following command in the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch directory to generate a custom operator project and implement the operator on the host and kernel:
bash install.sh -v Ascendxxxyy # xxxyy indicates the processor type used by the user.
- Run the following command in the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/CustomOp directory to build and deploy the operator again:
bash build.sh ./build_out/custom_opp_<target_os>_<target_architecture>.run // Name of the .run package in the current directory
- Switch to the ${git_clone_path}/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AclNNInvocation directory, start the operator API running script, and check the memory.
- Enable memory check.
- You can run the following command to explicitly specify memory check types. By default, detection of illegal read/write, multi-core corruption, unaligned access, and illegal release is enabled.
mssanitizer --tool=memcheck bash run.sh
- Run the following command to manually enable memory leak detection:
mssanitizer --tool=memcheck --leak-check=yes bash run.sh
- You can run the following command to explicitly specify memory check types. By default, detection of illegal read/write, multi-core corruption, unaligned access, and illegal release is enabled.
- Locate a memory exception. For details, see Analyzing a Memory Exception Report.
- Enable memory check.
- Perform contention check.
- Run the following commands to enable contention check:
mssanitizer --tool=racecheck bash run.sh
- Locate a contention check. For details, see Analyzing a Contention Check Report.
The tool run log file mssanitizer_{TIMESTAMP}_{PID}.log is automatically generated in the current directory. After the program is executed, an exception report is displayed.
- Run the following commands to enable contention check:
- Perform uninitialization check.
Parent topic: Operator Development Tools Quick Start