已合并
【docs】26.1.0英文资料合入更新 #74
luyq11创建于 8 天前
【docs】26.1.0英文资料合入更新 #74
已合并
共 21 个文件变更+387-85
| @@ -11,6 +11,8 @@ | |||
| 11 | 11 | ||
| 12 | </div> | 12 | </div> |
| 13 | 13 | ||
| 14 | +简体中文 | [English](./README_EN.md) | ||
| 15 | + | ||
| 14 | ## ✨ 最新消息 | 16 | ## ✨ 最新消息 |
| 15 | 17 | ||
| 16 | <span style="font-size:14px;"> | 18 | <span style="font-size:14px;"> |
| @@ -1,28 +1,40 @@ | |||
| 1 | <h1 align="center">MindStudio Tools Extension Library</h1> | 1 | <h1 align="center">MindStudio Tools Extension Library</h1> |
| 2 | 2 | ||
| 3 | <div align="center"> | 3 | <div align="center"> |
| 4 | -<h2>Ascend AI Operator Tool Extension Interface Library</h2> | 4 | +<p><b><span style="font-size:24px;">Ascend AI Operator Tool Extension Interface Library</span></b></p> |
| 5 | 5 | ||
| 6 | - [](https://www.hiascend.com/en/developer/software/mindstudio) | 6 | + [](https://deepwiki.com/mindstudio-docs/master) |
| 7 | - [](./LICENSE) | 7 | + [](https://zread.ai/mindstudio-docs/master) |
| 8 | + [](https://mindstudio-operator-tools-docs.readthedocs.io/zh-cn/latest/) | ||
| 9 | + [](https://www.hiascend.com/en/developer/software/mindstudio) | ||
| 10 | + [](https://gitcode.com/Ascend/mstx/issues) | ||
| 8 | 11 | ||
| 9 | </div> | 12 | </div> |
| 10 | 13 | ||
| 14 | +English | [简体中文](./README.md) | ||
| 15 | + | ||
| 11 | ## ✨ What's New | 16 | ## ✨ What's New |
| 12 | 17 | ||
| 13 | <span style="font-size:14px;"> | 18 | <span style="font-size:14px;"> |
| 14 | 19 | ||
| 15 | -🔹 **[2025.12.31]**: The MindStudio Tools Extension Library project is now fully open source. | 20 | +🔹 **[Dec 31, 2025]**: The MindStudio Tools Extension Library project is now fully open source. |
| 16 | 21 | ||
| 17 | </span> | 22 | </span> |
| 18 | 23 | ||
| 19 | -## ️ ℹ️ Introduction | 24 | +## ℹ️ Introduction |
| 20 | 25 | ||
| 21 | MindStudio Tools Extension Library (msTX) introduces the msTX instrumentation API. It allows you to customize collection time ranges or the start and end time points of key functions, identify information such as key functions or iterations, and quickly scope performance and operator issues. | 26 | MindStudio Tools Extension Library (msTX) introduces the msTX instrumentation API. It allows you to customize collection time ranges or the start and end time points of key functions, identify information such as key functions or iterations, and quickly scope performance and operator issues. |
| 22 | 27 | ||
| 23 | ## ⚙️ Features | 28 | ## ⚙️ Features |
| 24 | 29 | ||
| 25 | -By default, the mstx API has no functionality. You need to call the mstx API in your user application and then enable the mstx instrumentation feature for different scenarios, such as configuring `--mstx=on` when profiling data with the msprof command line, configuring `ACL_PROF_MSPROFTX` when profiling data with the AscendCL API, and configuring `mstx=True` when profiling data with the Ascend PyTorch Profiler API. | 30 | +By default, the mstx API has no functionality. You need to call the mstx API in your user application and then enable the mstx instrumentation feature for different scenarios, such as configuring `--mstx=on` when profiling data with the msprof CLI, configuring `ACL_PROF_MSPROFTX` when profiling data with the AscendCL API, and configuring `mstx=True` when profiling data with the Ascend PyTorch Profiler API. |
| 31 | + | ||
| 32 | +## 🌌 Smart Search | ||
| 33 | + | ||
| 34 | +To improve documentation search efficiency, we provide multiple efficient search methods: | ||
| 35 | +🔹 [AI Q&A (DeepWiki)](https://deepwiki.com/mindstudio-docs/master): Natural language Q&A to quickly grasp the project architecture and module relationships. | ||
| 36 | +🔹 [AI Q&A (ZRead)](https://zread.ai/mindstudio-docs/master): Better Chinese Q&A experience for precisely locating feature usage and details. | ||
| 37 | +🔹 [Precise Search (ReadTheDocs)](https://mindstudio-operator-tools-docs.readthedocs.io/zh-cn/latest/): Full-text keyword search that takes you directly to APIs, parameters, error messages, and more. | ||
| 26 | 38 | ||
| 27 | ## 📦 Installation Guide | 39 | ## 📦 Installation Guide |
| 28 | 40 | ||
| @@ -38,11 +50,11 @@ For details on msTX APIs, refer to [msTX API Reference](docs/en/api_reference/RE | |||
| 38 | 50 | ||
| 39 | ## 🛠️ Contribution Guide | 51 | ## 🛠️ Contribution Guide |
| 40 | 52 | ||
| 41 | -Contributions are welcome. For details, see the [Contribution Guide](./docs/zh/contributing/contributing_guide.md). | 53 | +Contributions are welcome. For details, see the [Contribution Guide](./docs/en/contributing/contributing_guide.md). |
| 42 | 54 | ||
| 43 | ## ⚖️ Related Information | 55 | ## ⚖️ Related Information |
| 44 | 56 | ||
| 45 | -🔹 [Release Notes](./docs/en/release_notes/release_notes.md) | 57 | +🔹 [Release Notes](https://gitcode.com/Ascend/mstx/releases) |
| 46 | 🔹 [LICENSE Statement](./docs/en/legal/license_notice.md) | 58 | 🔹 [LICENSE Statement](./docs/en/legal/license_notice.md) |
| 47 | 🔹 [Security Statement](./docs/en/legal/security_statement.md) | 59 | 🔹 [Security Statement](./docs/en/legal/security_statement.md) |
| 48 | 🔹 [Disclaimer](./docs/en/legal/disclaimer.md) | 60 | 🔹 [Disclaimer](./docs/en/legal/disclaimer.md) |
| @@ -51,9 +63,9 @@ Contributions are welcome. For details, see the [Contribution Guide](./docs/zh/c | |||
| 51 | 63 | ||
| 52 | We welcome contributions to the community. If you have any questions or suggestions, please submit an [Issue](https://gitcode.com/Ascend/mstx/issues), and we will respond as soon as possible. Thank you for your support. | 64 | We welcome contributions to the community. If you have any questions or suggestions, please submit an [Issue](https://gitcode.com/Ascend/mstx/issues), and we will respond as soon as possible. Thank you for your support. |
| 53 | 65 | ||
| 54 | -| 📱 Follow the MindStudio Official Account | 💬 More Communication and Support | | 66 | +| Instant Interaction (WeChat Group) | Official Updates (Official Account) | In-Depth Support (Assistant/Forum) | |
| 55 | -|:-------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 67 | +| :---: | :---: | :--- | |
| 56 | -| <img src="https://gitcode.com/Ascend/msot/blob/master/docs/zh/figures/readme/officialAccount.png" width="120"><br><sub>*Scan the QR code to get the latest updates*</sub> | 💡 **Join the WeChat Group**:<br>Follow the official account and reply "communication group" to get the group QR code.<br><br>🛠️ **Other Channels**:<br>👉 Ascend Assistant: [](https://gitcode.com/Ascend/msot/blob/master/docs/zh/figures/readme/xiaozhushou.png)<br>👉 Ascend Forum: [](https://www.hiascend.com/forum/) | | 68 | +| <img src="https://raw.gitcode.com/Ascend/docs/files/master/common/Writing_Template/figures/qr_code_wechat_work.png" width="120"><br><sub>*Scan the QR code to join the technical exchange group.*</sub> | <img src="https://raw.gitcode.com/Ascend/docs/files/master/common/Writing_Template/figures/qr_code_wechat_official_account.png" width="120"><br><sub>*Scan the QR code to follow the official account.*</sub> | Scan the QR code to join the group and follow the official account, the fastest communication channel for MindStudio users and developers:<br> **Quick Q&A:** Discuss technical issues with community members in real time.<br>**Latest Updates:** Get notified of version releases and feature updates as soon as possible.<br> **Experience Sharing:** Exchange best practices and hands-on experience with developers.<br> <br> **More Support Channels**: 👉 Ascend Assistant: [](https://gitcode.com/Ascend/msit/blob/master/docs/zh/figures/readme/xiaozhushou.png) 👉 Ascend Forum: [](https://www.hiascend.com/forum/) | |
| 57 | 69 | ||
| 58 | ## 🙏 Acknowledgments | 70 | ## 🙏 Acknowledgments |
| 59 | 71 | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -19,7 +19,7 @@ Creates a custom mstx domain. | |||
| 19 | 19 | ||
| 20 | **Prototype<a id="section1121883194711"></a>** | 20 | **Prototype<a id="section1121883194711"></a>** |
| 21 | 21 | ||
| 22 | -```python | 22 | +```cpp |
| 23 | mstxDomainHandle_t mstxDomainCreateA(const char* id) | 23 | mstxDomainHandle_t mstxDomainCreateA(const char* id) |
| 24 | ``` | 24 | ``` |
| 25 | 25 | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -30,7 +30,7 @@ void mstxDomainMarkA(mstxDomainHandle_t domain, const char *message, aclrtStream | |||
| 30 | |Parameter|Input/Output|Description| | 30 | |Parameter|Input/Output|Description| |
| 31 | |--|--|--| | 31 | |--|--|--| |
| 32 | |domain|Input|Handle of the specified domain.| | 32 | |domain|Input|Handle of the specified domain.| |
| 33 | -|message|Input|Pointer to the message string carried by the instrumentation. Length requirements for the passed message string: MSPTI scenario: cannot exceed 255 bytes. Non-MSPTI scenarios (for example, msprof command line, Ascend PyTorch Profiler): cannot exceed 156 bytes.| | 33 | +|message|Input|Pointer to the message string carried by the instrumentation. Length requirements for the passed message string: MSPTI scenario: cannot exceed 255 bytes.| |
| 34 | |stream|Input|Stream used to execute the instrumentation task. When set to nullptr, only the instantaneous event on the Host side is marked. When set to a valid stream, the instantaneous events on both the Host side and the corresponding Device side are marked.| | 34 | |stream|Input|Stream used to execute the instrumentation task. When set to nullptr, only the instantaneous event on the Host side is marked. When set to a valid stream, the instantaneous events on both the Host side and the corresponding Device side are marked.| |
| 35 | 35 | ||
| 36 | **Returns<a id="section16621124213476"></a>** | 36 | **Returns<a id="section16621124213476"></a>** |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -19,7 +19,7 @@ If the passed domain has been destroyed, a warning is logged and the API no long | |||
| 19 | 19 | ||
| 20 | **Prototype<a id="section1121883194711"></a>** | 20 | **Prototype<a id="section1121883194711"></a>** |
| 21 | 21 | ||
| 22 | -```python | 22 | +```cpp |
| 23 | mstxRangeId mstxDomainRangeStartA(mstxDomainHandle_t domain, const char *message, aclrtStream stream) | 23 | mstxRangeId mstxDomainRangeStartA(mstxDomainHandle_t domain, const char *message, aclrtStream stream) |
| 24 | ``` | 24 | ``` |
| 25 | 25 | ||
| @@ -30,7 +30,7 @@ mstxRangeId mstxDomainRangeStartA(mstxDomainHandle_t domain, const char *message | |||
| 30 | |Parameter|Input/Output|Description| | 30 | |Parameter|Input/Output|Description| |
| 31 | |--|--|--| | 31 | |--|--|--| |
| 32 | |domain|Input|Specified domain handle.| | 32 | |domain|Input|Specified domain handle.| |
| 33 | -|message|Input|Pointer to the message string carried by the instrumentation.<br>Length requirement for the incoming message string: MSPTI scenario: cannot exceed 255 bytes. Non-MSPTI scenarios (e.g., msprof command line, Ascend PyTorch Profiler): cannot exceed 156 bytes.| | 33 | +|message|Input|Pointer to the message string carried by the instrumentation.<br>Length requirement for the incoming message string: MSPTI scenario: cannot exceed 255 bytes.| |
| 34 | |stream|Input|Stream used to execute the instrumentation task. When set to nullptr, only marks instantaneous events on the Host side. When set to a valid stream, marks instantaneous events on both the Host side and the corresponding Device side.| | 34 | |stream|Input|Stream used to execute the instrumentation task. When set to nullptr, only marks instantaneous events on the Host side. When set to a valid stream, marks instantaneous events on both the Host side and the corresponding Device side.| |
| 35 | 35 | ||
| 36 | **Returns<a id="section16621124213476"></a>** | 36 | **Returns<a id="section16621124213476"></a>** |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -19,36 +19,36 @@ Invalid value 0, indicating that no tool has launched the program. | |||
| 19 | 19 | ||
| 20 | ```c | 20 | ```c |
| 21 | #define MSTX_TOOL_INVALID_ID 0x0 | 21 | #define MSTX_TOOL_INVALID_ID 0x0 |
| 22 | -``` | 22 | +``` |
| 23 | 23 | ||
| 24 | -0x1000, indicating that the program is launched by [msProf](https://www.hiascend.com/document/detail/en/canncommercial/83RC1/devaids/Profiling/atlasprofiling_16_0010.html) or [MSPTI](https://www.hiascend.com/document/detail/en/canncommercial/83RC1/devaids/Profiling/atlasprofiling_16_1153.html) | 24 | +0x1000, indicating that the program is launched by [msProf](https://www.hiascend.com/document/detail/en/CANNCommunityEdition/910/devaids/Profiling/atlasprofiling_16_0010.html) or [MSPTI](https://www.hiascend.com/document/detail/en/CANNCommunityEdition/910/devaids/Profiling/atlasprofiling_16_0031.html) |
| 25 | 25 | ||
| 26 | ```c | 26 | ```c |
| 27 | #define MSTX_TOOL_MSPROF_ID 0x1000 | 27 | #define MSTX_TOOL_MSPROF_ID 0x1000 |
| 28 | ``` | 28 | ``` |
| 29 | 29 | ||
| 30 | -0x1001, indicating that the program is launched by the [msProf](https://www.hiascend.com/document/detail/en/canncommercial/83RC1/devaids/optool/atlasopdev_16_0082.html) tool | 30 | +0x1001, indicating that the program is launched by the [msProf](https://gitcode.com/Ascend/msopprof/blob/26.1.0/docs/en/user_guide/msopprof_user_guide.md) tool |
| 31 | 31 | ||
| 32 | ```c | 32 | ```c |
| 33 | #define MSTX_TOOL_MSOPPROF_ID 0x1001 | 33 | #define MSTX_TOOL_MSOPPROF_ID 0x1001 |
| 34 | -``` | ||
| 35 | - | ||
| 36 | -0x1002, indicating that the program is launched by the [msSanitizer](https://www.hiascend.com/document/detail/en/canncommercial/83RC1/devaids/optool/atlasopdev_16_0039.html) tool | ||
| 37 | - | ||
| 38 | -```c | ||
| 39 | -#define MSTX_TOOL_MSSANITIZER_ID 0x1002 | ||
| 40 | ``` | 34 | ``` |
| 41 | 35 | ||
| 42 | -0x1003, indicating that the program is launched by the [msLeaks Memory Leak Detection Tool](https://www.hiascend.com/document/detail/en/canncommercial/83RC1/devaids/msleaks/atlas_msleaks_0001.html) | 36 | +0x1002, indicating that the program is launched by the [msSanitizer](https://gitcode.com/Ascend/mssanitizer/blob/26.1.0/docs/en/user_guide/mssanitizer_user_guide.md) tool |
| 43 | 37 | ||
| 44 | ```c | 38 | ```c |
| 45 | -#define MSTX_TOOL_MSLEAKS_ID 0x1003 | 39 | +#define MSTX_TOOL_MSSANITIZER_ID 0x1002 |
| 40 | +``` | ||
| 41 | + | ||
| 42 | +0x1003, indicating that the program is launched by the [msLeaks Memory Leak Detection Tool](https://gitcode.com/Ascend/msmemscope/blob/26.1.0/docs/en/quick_start/quick_start.md) | ||
| 43 | + | ||
| 44 | +```c | ||
| 45 | +#define MSTX_TOOL_MSLEAKS_ID 0x1003 | ||
| 46 | ``` | 46 | ``` |
| 47 | 47 | ||
| 48 | **Prototype<a id="zh-cn_topic_0000002446914857_section1121883194711"></a>** | 48 | **Prototype<a id="zh-cn_topic_0000002446914857_section1121883194711"></a>** |
| 49 | 49 | ||
| 50 | ```c | 50 | ```c |
| 51 | -void mstxGetToolId(uint64 *id) | 51 | +void mstxGetToolId(uint64_t *id) |
| 52 | ``` | 52 | ``` |
| 53 | 53 | ||
| 54 | **Parameter Description<a id="zh-cn_topic_0000002446914857_section11506138144714"></a>** | 54 | **Parameter Description<a id="zh-cn_topic_0000002446914857_section11506138144714"></a>** |
| @@ -65,7 +65,7 @@ None | |||
| 65 | 65 | ||
| 66 | **Example<a id="zh-cn_topic_0000002446914857_section16621124213476"></a>** | 66 | **Example<a id="zh-cn_topic_0000002446914857_section16621124213476"></a>** |
| 67 | 67 | ||
| 68 | -```py | 68 | +```c |
| 69 | uint64 id; | 69 | uint64 id; |
| 70 | mstxGetToolId(&id); | 70 | mstxGetToolId(&id); |
| 71 | ``` | 71 | ``` |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -27,7 +27,7 @@ void mstxMarkA(const char *message, aclrtStream stream) | |||
| 27 | 27 | ||
| 28 | |Parameter|Input/Output|Description| | 28 | |Parameter|Input/Output|Description| |
| 29 | |--|--|--| | 29 | |--|--|--| |
| 30 | -|message|Input|Pointer to the string carrying information for the trace event.<br>Length requirement for the input message string: MSPTI scenario: cannot exceed 255 bytes.<br>Non-MSPTI scenario (for example, msprof command line, Ascend PyTorch Profiler): cannot exceed 156 bytes.<br>message cannot be a null pointer.| | 30 | +|message|Input|Pointer to the string carrying information for the trace event.<br>Length requirement for the input message string: MSPTI scenario: cannot exceed 255 bytes.<br>message cannot be a null pointer.| |
| 31 | |stream|Input|Stream used to execute the trace task.<br>When set to nullptr, only marks the instantaneous event on the Host side.<br>When set to a valid stream, marks the instantaneous event on both the Host side and the corresponding Device side.| | 31 | |stream|Input|Stream used to execute the trace task.<br>When set to nullptr, only marks the instantaneous event on the Host side.<br>When set to a valid stream, marks the instantaneous event on both the Host side and the corresponding Device side.| |
| 32 | 32 | ||
| 33 | **Returns<a id="section16621124213476"></a>** | 33 | **Returns<a id="section16621124213476"></a>** |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -35,7 +35,7 @@ mstx.range_start(message, stream) | |||
| 35 | 35 | ||
| 36 | |Parameter|Input/Output|Description| | 36 | |Parameter|Input/Output|Description| |
| 37 | |--|--|--| | 37 | |--|--|--| |
| 38 | -|message|Input|message is a text marker that carries trace information.<br>Data type in C/C++: const char *.<br>In Python, message is a string. Defaults to None.<br>Length requirement for the input message string: MSPTI scenario: cannot exceed 255 bytes.<br>Non-MSPTI scenario (for example, msprof command line, Ascend PyTorch Profiler): cannot exceed 156 bytes.<br>message cannot be a null pointer.| | 38 | +|message|Input|message is a text marker that carries trace information.<br>Data type in C/C++: const char *.<br>In Python, message is a string. Defaults to None.<br>Length requirement for the input message string: MSPTI scenario: cannot exceed 255 Byte.<br>message cannot be a null pointer.| |
| 39 | |stream|Input|stream indicates the thread that uses the mark.<br>Data type in C/C++: aclrtStream.<br>In Python, stream is an aclrtStream object. Defaults to None.<br>When set to nullptr, only the instantaneous event on the Host side is marked.<br>When set to a valid stream, the instantaneous events on the Host side and the corresponding Device side are marked.| | 39 | |stream|Input|stream indicates the thread that uses the mark.<br>Data type in C/C++: aclrtStream.<br>In Python, stream is an aclrtStream object. Defaults to None.<br>When set to nullptr, only the instantaneous event on the Host side is marked.<br>When set to a valid stream, the instantaneous events on the Host side and the corresponding Device side are marked.| |
| 40 | 40 | ||
| 41 | **Returns<a id="zh-cn_topic_0000002016210401_section16621124213476"></a>** | 41 | **Returns<a id="zh-cn_topic_0000002016210401_section16621124213476"></a>** |
| @@ -58,8 +58,7 @@ If 0 is returned, it indicates failure. | |||
| 58 | // Run op | 58 | // Run op |
| 59 | if | 59 | if |
| 60 | (!opRunner.RunOp()) { | 60 | (!opRunner.RunOp()) { |
| 61 | - ERROR_LOG("Run | 61 | + ERROR_LOG("Run op failed"); |
| 62 | - op failed"); | ||
| 63 | return false; | 62 | return false; |
| 64 | } | 63 | } |
| 65 | mstxRangeEnd(id); | 64 | mstxRangeEnd(id); |
| @@ -73,7 +72,7 @@ If 0 is returned, it indicates failure. | |||
| 73 | 72 | ||
| 74 | ```py | 73 | ```py |
| 75 | import mstx | 74 | import mstx |
| 76 | - mstx.range_start("aaa") | 75 | + mstx.range_start("aaa", None) |
| 77 | print(1) | 76 | print(1) |
| 78 | mstx.range_end(1) | 77 | mstx.range_end(1) |
| 79 | import torch | 78 | import torch |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -17,7 +17,7 @@ Registers a memory pool. When calling this API to register a memory pool, the us | |||
| 17 | 17 | ||
| 18 | **Prototype<a id="zh-cn_topic_0000002216005989_section1121883194711"></a>** | 18 | **Prototype<a id="zh-cn_topic_0000002216005989_section1121883194711"></a>** |
| 19 | 19 | ||
| 20 | -```python | 20 | +```c |
| 21 | mstxMemHeapHandle_t mstxMemHeapRegister(mstxDomainHandle_t domain, mstxMemHeapDesc_t const *desc) | 21 | mstxMemHeapHandle_t mstxMemHeapRegister(mstxDomainHandle_t domain, mstxMemHeapDesc_t const *desc) |
| 22 | ``` | 22 | ``` |
| 23 | 23 | ||
| @@ -96,7 +96,8 @@ mstxMemVirtualRangeDesc_t rangeDesc = {}; | |||
| 96 | rangeDesc.deviceId = deviceId; // Device ID | 96 | rangeDesc.deviceId = deviceId; // Device ID |
| 97 | rangeDesc.ptr = gm; // Start address of the registered memory pool gm | 97 | rangeDesc.ptr = gm; // Start address of the registered memory pool gm |
| 98 | rangeDesc.size = 1024; // Memory pool size | 98 | rangeDesc.size = 1024; // Memory pool size |
| 99 | - heapDesc.typeSpecificDesc = &rangeDesc; | 99 | + |
| 100 | mstxMemHeapDesc_t heapDesc{}; | 100 | mstxMemHeapDesc_t heapDesc{}; |
| 101 | + heapDesc.typeSpecificDesc = &rangeDesc; | ||
| 101 | mstxMemHeapHandle_t memPool = mstxMemHeapRegister(globalDomain, &heapDesc); // Register memory pool | 102 | mstxMemHeapHandle_t memPool = mstxMemHeapRegister(globalDomain, &heapDesc); // Register memory pool |
| 102 | ``` | 103 | ``` |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -0,0 +1,113 @@ | |||
| 1 | +# mstxMemPermissionsAssign<a id="mstxMemPermissionsAssign"></a> | ||
| 2 | + | ||
| 3 | +**Supported Products<a id="section8178181118225"></a>** | ||
| 4 | + | ||
| 5 | +|Product|Supported| | ||
| 6 | +|--|:-:| | ||
| 7 | +|Ascend 950 products|√| | ||
| 8 | +|Atlas A3 training products/Atlas A3 inference products|√| | ||
| 9 | +|Atlas A2 training products/Atlas A2 inference products|√| | ||
| 10 | +|Atlas 200I/500 A2 inference products|√| | ||
| 11 | +|Atlas inference products|√| | ||
| 12 | +|Atlas training products|√| | ||
| 13 | + | ||
| 14 | +**Function<a id="zh-cn_topic_0000002216005989_section20806203412478"></a>** | ||
| 15 | + | ||
| 16 | +Specifies read, write, and share access permissions for a virtual memory interval. Before specifying permissions, ensure that this interval has been registered as a region. | ||
| 17 | + | ||
| 18 | +**Prototype<a id="zh-cn_topic_0000002216005989_section1121883194711"></a>** | ||
| 19 | + | ||
| 20 | +```c | ||
| 21 | +void mstxMemPermissionsAssign(mstxDomainHandle_t domain, mstxMemPermissionsAssignBatch_t const *desc); | ||
| 22 | +``` | ||
| 23 | + | ||
| 24 | +**Parameter Description<a id="zh-cn_topic_0000002216005989_section11506138144714"></a>** | ||
| 25 | + | ||
| 26 | +**Table 1** Parameter description | ||
| 27 | + | ||
| 28 | +<a name="zh-cn_topic_0000002216005989_table827101275518"></a> | ||
| 29 | +<table><thead align="left"><tr id="zh-cn_topic_0000002216005989_row429121265517"><th class="cellrowborder" valign="top" width="16.881688168816883%" id="mcps1.2.4.1.1"><p id="zh-cn_topic_0000002216005989_p1329121214558"><a name="zh-cn_topic_0000002216005989_p1329121214558"></a><a name="zh-cn_topic_0000002216005989_p1329121214558"></a>Parameter</p> | ||
| 30 | +</th> | ||
| 31 | +<th class="cellrowborder" valign="top" width="11.401140114011401%" id="mcps1.2.4.1.2"><p id="zh-cn_topic_0000002216005989_p10230141454318"><a name="zh-cn_topic_0000002216005989_p10230141454318"></a><a name="zh-cn_topic_0000002216005989_p10230141454318"></a>Input/Output</p> | ||
| 32 | +</th> | ||
| 33 | +<th class="cellrowborder" valign="top" width="71.71717171717171%" id="mcps1.2.4.1.3"><p id="zh-cn_topic_0000002216005989_p83121275519"><a name="zh-cn_topic_0000002216005989_p83121275519"></a><a name="zh-cn_topic_0000002216005989_p83121275519"></a>Description</p> | ||
| 34 | +</th> | ||
| 35 | +</tr> | ||
| 36 | +</thead> | ||
| 37 | +<tbody><tr id="zh-cn_topic_0000002216005989_row1131131265511"><td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000002216005989_p7669321185110"><a name="zh-cn_topic_0000002216005989_p7669321185110"></a><a name="zh-cn_topic_0000002216005989_p7669321185110"></a>domain</p> | ||
| 38 | +</td> | ||
| 39 | +<td class="cellrowborder" valign="top" width="11.401140114011401%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000002216005989_p723015144436"><a name="zh-cn_topic_0000002216005989_p723015144436"></a><a name="zh-cn_topic_0000002216005989_p723015144436"></a>Input</p> | ||
| 40 | +</td> | ||
| 41 | +<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000002216005989_p3243153110413"><a name="zh-cn_topic_0000002216005989_p3243153110413"></a><a name="zh-cn_topic_0000002216005989_p3243153110413"></a>Either globalDomain or the handle returned by <a href="../Common/mstxDomainCreateA.md">mstxDomainCreateA</a>.</p> | ||
| 42 | +<p id="zh-cn_topic_0000002216005989_p17135131418533"><a name="zh-cn_topic_0000002216005989_p17135131418533"></a><a name="zh-cn_topic_0000002216005989_p17135131418533"></a>Data type: const char *.</p> | ||
| 43 | +</td> | ||
| 44 | +</tr> | ||
| 45 | +<tr id="zh-cn_topic_0000002216005989_row18118485118"><td class="cellrowborder" valign="top" width="16.881688168816883%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000002216005989_p211549516"><a name="zh-cn_topic_0000002216005989_p211549516"></a><a name="zh-cn_topic_0000002216005989_p211549516"></a>desc</p> | ||
| 46 | +</td> | ||
| 47 | +<td class="cellrowborder" valign="top" width="11.401140114011401%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000002216005989_p1920117129516"><a name="zh-cn_topic_0000002216005989_p1920117129516"></a><a name="zh-cn_topic_0000002216005989_p1920117129516"></a>Input</p> | ||
| 48 | +</td> | ||
| 49 | +<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.2.4.1.3 "> | ||
| 50 | + | ||
| 51 | +<pre class="screen" id="zh-cn_topic_0000002216005989_screen47021458121411"><a name="zh-cn_topic_0000002216005989_screen47021458121411"></a><a name="zh-cn_topic_0000002216005989_screen47021458121411"></a> | ||
| 52 | +/** @brief No access permission for this memory | ||
| 53 | + */ | ||
| 54 | +#define MSTX_MEM_PERMISSIONS_REGION_FLAGS_NONE 0x00 | ||
| 55 | + | ||
| 56 | +/** @brief This memory is readable | ||
| 57 | + */ | ||
| 58 | +#define MSTX_MEM_PERMISSIONS_REGION_FLAGS_READ 0x01 | ||
| 59 | + | ||
| 60 | +/** @brief This memory is writable | ||
| 61 | + */ | ||
| 62 | +#define MSTX_MEM_PERMISSIONS_REGION_FLAGS_WRITE 0x02 | ||
| 63 | + | ||
| 64 | +/** @brief This memory can be shared across multiple devices | ||
| 65 | + */ | ||
| 66 | +#define MSTX_MEM_PERMISSIONS_REGION_FLAGS_SHARED 0x04 | ||
| 67 | + | ||
| 68 | +/** @brief Describes the memory permissions assigned to a region | ||
| 69 | + * @member flags - Permission flags represented by MSTX_MEM_PERMISSIONS_REGION_FLAGS_* | ||
| 70 | + * @member region - Reference to a registered virtual memory region | ||
| 71 | + */ | ||
| 72 | +typedef struct mstxMemPermissionsAssignRegionsDesc_t { | ||
| 73 | + uint32_t flags; | ||
| 74 | + mstxMemRegionRef_t region; | ||
| 75 | +} mstxMemPermissionsAssignRegionsDesc_t; | ||
| 76 | + | ||
| 77 | +/** @brief Used to describe memory permissions for multiple regions | ||
| 78 | + * @member regionCount - Length of the regionDescArray | ||
| 79 | + * @member regionDescArray - Array of permission descriptors | ||
| 80 | + */ | ||
| 81 | +typedef struct mstxMemPermissionsAssignBatch_t { | ||
| 82 | + size_t regionCount; | ||
| 83 | + mstxMemPermissionsAssignRegionsDesc_t const *regionDescArray; | ||
| 84 | +} mstxMemPermissionsAssignBatch_t;</pre> | ||
| 85 | +</td> | ||
| 86 | +</tr> | ||
| 87 | +</tbody> | ||
| 88 | +</table> | ||
| 89 | + | ||
| 90 | +**Returns<a id="zh-cn_topic_0000002216005989_section16621124213476"></a>** | ||
| 91 | + | ||
| 92 | +None. | ||
| 93 | + | ||
| 94 | +**Example<a id="zh-cn_topic_0000002216005989_section377820328555"></a>** | ||
| 95 | + | ||
| 96 | +```c | ||
| 97 | +// Assume handles have been initialized by mstxMemRegionsRegister | ||
| 98 | +mstxMemRegionHandle_t handles[2]; | ||
| 99 | + | ||
| 100 | +mstxMemPermissionsAssignRegionsDesc_t perms[2]; | ||
| 101 | +mstxMemPermissionsAssignBatch_t permBatch{}; | ||
| 102 | +perms[0].flags = MSTX_MEM_PERMISSIONS_REGION_FLAGS_READ; | ||
| 103 | +perms[0].region.refType = MSTX_MEM_REGION_REF_TYPE_HANDLE; | ||
| 104 | +perms[0].region.handle = handles[0]; | ||
| 105 | +perms[1].flags = MSTX_MEM_PERMISSIONS_REGION_FLAGS_WRITE; | ||
| 106 | +perms[1].region.refType = MSTX_MEM_REGION_REF_TYPE_HANDLE; | ||
| 107 | +perms[1].region.handle = handles[0]; | ||
| 108 | +permBatch.regionCount = 2; | ||
| 109 | +permBatch.regionDescArray = perms; | ||
| 110 | + | ||
| 111 | +// Assume globalDomain has been initialized by mstxMemRegionsRegister | ||
| 112 | +mstxMemPermissionsAssign(globalDomain, &permBatch); | ||
| 113 | +``` | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -77,5 +77,5 @@ regionsDesc.regionType = MSTX_MEM_TYPE_VIRTUAL_ADDRESS; | |||
| 77 | regionsDesc.regionCount = 1; | 77 | regionsDesc.regionCount = 1; |
| 78 | regionsDesc.regionDescArray = rangesDesc; | 78 | regionsDesc.regionDescArray = rangesDesc; |
| 79 | regionsDesc.regionHandleArrayOut = regionHandles; | 79 | regionsDesc.regionHandleArrayOut = regionHandles; |
| 80 | -mstxMemRegionsRegister(globalDomain, regionsDesc); // Secondary allocation registrationry Allocation Registration | 80 | +mstxMemRegionsRegister(globalDomain, ®ionsDesc); // Secondary allocation registration |
| 81 | ``` | 81 | ``` |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | |Product|Supported| | 5 | |Product|Supported| |
| 6 | |--|:-:| | 6 | |--|:-:| |
| 7 | -|Ascend 910_95 AI Processors|√| | 7 | +|Ascend 950 products|√| |
| 8 | |Atlas A3 training products/Atlas A3 inference products|√| | 8 | |Atlas A3 training products/Atlas A3 inference products|√| |
| 9 | |Atlas A2 training products/Atlas A2 inference products|√| | 9 | |Atlas A2 training products/Atlas A2 inference products|√| |
| 10 | |Atlas 200I/500 A2 inference products|√| | 10 | |Atlas 200I/500 A2 inference products|√| |
| @@ -78,9 +78,9 @@ None | |||
| 78 | 78 | ||
| 79 | **Example<a id="zh-cn_topic_0000002180600118_section377820328555"></a>** | 79 | **Example<a id="zh-cn_topic_0000002180600118_section377820328555"></a>** |
| 80 | 80 | ||
| 81 | -```python | 81 | +```c |
| 82 | -mstxMemRegionsUnregisterBatch_t refsDesc = {} | 82 | +mstxMemRegionsUnregisterBatch_t refsDesc = {}; |
| 83 | refsDesc.refCount = 1; | 83 | refsDesc.refCount = 1; |
| 84 | refsDesc.refArray = regionRef; | 84 | refsDesc.refArray = regionRef; |
| 85 | -mstxMemRegionsUnregister(globalDomain, &refsDesc); // Unregister secondary allocationster Secondary Allocation | 85 | +mstxMemRegionsUnregister(globalDomain, &refsDesc); // Unregister secondary allocation |
| 86 | ``` | 86 | ``` |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | This section describes the instrumentation APIs of the MindStudio Tools Extension Library (msTX). You can customize the collection period or the start and end timestamps of key functions to identify information such as key functions or iterations, enabling quick delimitation of performance and operator issues. | 3 | This section describes the instrumentation APIs of the MindStudio Tools Extension Library (msTX). You can customize the collection period or the start and end timestamps of key functions to identify information such as key functions or iterations, enabling quick delimitation of performance and operator issues. |
| 4 | 4 | ||
| 5 | -By default, the msTX APIs have no functionality. After calling the msTX APIs in your user application, you need to enable the msTX instrumentation feature according to different scenarios, for example, configuring `--mstx=on` when collecting data using the msprof command line, configuring `ACL_PROF_MSPROFTX` when collecting data using the AscendCL API, and configuring `mstx=True` when collecting data using the Ascend PyTorch Profiler interface. | 5 | +By default, the msTX APIs have no functionality. After calling the msTX APIs in your user application, you need to enable the msTX instrumentation feature according to different scenarios, for example, configuring `--mstx=on` when collecting data using the msprof CLI, configuring `ACL_PROF_MSPROFTX` when collecting data using the AscendCL API, and configuring `mstx=True` when collecting data using the Ascend PyTorch Profiler interface. |
| 6 | 6 | ||
| 7 | - Library file `libms_tools_ext.so` path: `${INSTALL_DIR}/lib64/`. | 7 | - Library file `libms_tools_ext.so` path: `${INSTALL_DIR}/lib64/`. |
| 8 | - When compiling with the header file, the user program needs to link the dl library during compilation. Header file `ms_tools_ext.h` path: `${INSTALL_DIR}/include/mstx`. | 8 | - When compiling with the header file, the user program needs to link the dl library during compilation. Header file `ms_tools_ext.h` path: `${INSTALL_DIR}/include/mstx`. |
| @@ -28,3 +28,4 @@ Replace `${INSTALL_DIR}` with the file storage path after CANN software installa | |||
| 28 | |[mstxMemRegionsRegister](./Mem/mstxMemRegionsRegister.md)|Registers secondary allocation of a memory pool.| | 28 | |[mstxMemRegionsRegister](./Mem/mstxMemRegionsRegister.md)|Registers secondary allocation of a memory pool.| |
| 29 | |[mstxMemRegionsUnregister](./Mem/mstxMemRegionsUnregister.md)|Unregisters secondary allocation of a memory pool.| | 29 | |[mstxMemRegionsUnregister](./Mem/mstxMemRegionsUnregister.md)|Unregisters secondary allocation of a memory pool.| |
| 30 | |[mstxMemHeapUnregister](./Mem/mstxMemHeapUnregister.md)|When a memory pool is unregistered, the associated regions are also unregistered.| | 30 | |[mstxMemHeapUnregister](./Mem/mstxMemHeapUnregister.md)|When a memory pool is unregistered, the associated regions are also unregistered.| |
| 31 | +|[mstxMemPermissionsAssign](./Mem/mstxMemPermissionsAssign.md)|Specify permissions for a virtual memory region.| | ||
| @@ -2,32 +2,131 @@ | |||
| 2 | 2 | ||
| 3 | <br> | 3 | <br> |
| 4 | 4 | ||
| 5 | -## 1. Development Environment Preparation | 5 | +## 1. Prerequisites |
| 6 | + | ||
| 7 | +First read the [msTX API List](../api_reference/README.md) to learn about the core APIs provided by msTX and their functions. | ||
| 8 | + | ||
| 9 | +## 2. Development Environment Preparation | ||
| 6 | 10 | ||
| 7 | For details, see [Operator Tool Development Environment Setup Guide](https://gitcode.com/Ascend/msot/blob/master/docs/en/common/dev_env_setup.md). | 11 | For details, see [Operator Tool Development Environment Setup Guide](https://gitcode.com/Ascend/msot/blob/master/docs/en/common/dev_env_setup.md). |
| 8 | 12 | ||
| 9 | -## 2. Compilation and Packaging | 13 | +Compilation also requires installing python3-dev (the header files required to compile Python bindings): |
| 14 | + | ||
| 15 | +```sh | ||
| 16 | +# openEuler | ||
| 17 | +yum install python3-devel | ||
| 18 | + | ||
| 19 | +# Ubuntu | ||
| 20 | +apt-get install python3-dev | ||
| 21 | +``` | ||
| 22 | + | ||
| 23 | +> **NOTE:** If you are not a root user, add `sudo` before the command. | ||
| 24 | + | ||
| 25 | +## 3. Compilation and Packaging | ||
| 26 | + | ||
| 27 | +The following two methods are available, with their advantages and disadvantages: | ||
| 28 | + | ||
| 29 | +| Method | Application Scenario | Advantages | Disadvantages | | ||
| 30 | +|------|---------|------|------| | ||
| 31 | +| One-click script | First build and CI/CD pipeline | Zero configuration, one-step setup | Steps cannot be executed independently. | | ||
| 32 | +| Step-by-step script | Daily development and incremental build | Flexible and efficient | Multiple steps are required. | | ||
| 33 | + | ||
| 34 | +### 3.1 Method 1: One-click Script | ||
| 10 | 35 | ||
| 11 | ```shell | 36 | ```shell |
| 12 | python build.py | 37 | python build.py |
| 13 | ``` | 38 | ``` |
| 14 | 39 | ||
| 15 | -## 3. Unit Testing | 40 | +### 3.2 Method 2: Step-by-Step Script |
| 16 | 41 | ||
| 17 | -You can run UT tests for C/CPP/PYTHON code using a one-click script: | 42 | +#### 3.2.1 Downloading Dependencies |
| 18 | 43 | ||
| 19 | -```sh | 44 | +```shell |
| 45 | +python download_dependencies.py | ||
| 46 | +``` | ||
| 47 | + | ||
| 48 | +#### 3.2.2 Starting Compilation | ||
| 49 | + | ||
| 50 | +Run the following command to start compilation: | ||
| 51 | + | ||
| 52 | +```shell | ||
| 53 | +mkdir build | ||
| 54 | +cd build | ||
| 55 | +cmake .. && make -j$(nproc) | ||
| 56 | +make install | ||
| 57 | +``` | ||
| 58 | + | ||
| 59 | +After compilation is complete, check the `output/` directory. If the file generation time has been updated to the current compilation time, the compilation has completed successfully. | ||
| 60 | + | ||
| 61 | +#### 3.2.3 Compilation Result Description | ||
| 62 | + | ||
| 63 | +The compilation results are generated in the `output/` directory: | ||
| 64 | + | ||
| 65 | +```text | ||
| 66 | +output/ | ||
| 67 | +├── mstx/ # Installation directory | ||
| 68 | +│ └── lib64/ # Dynamic libraries (libms_tools_ext.so, mstx.so) | ||
| 69 | +└── mstx-<version>.whl # Python installation package | ||
| 70 | +``` | ||
| 71 | + | ||
| 72 | +#### 3.2.4 Cleanup and Recompilation | ||
| 73 | + | ||
| 74 | +Delete the build directory and rerun [Section 3.2.2](#322-starting-compilation): | ||
| 75 | + | ||
| 76 | +```shell | ||
| 77 | +rm -rf build | ||
| 78 | +``` | ||
| 79 | + | ||
| 80 | +## 4. Unit Testing | ||
| 81 | + | ||
| 82 | +```shell | ||
| 20 | python build.py test | 83 | python build.py test |
| 21 | ``` | 84 | ``` |
| 22 | 85 | ||
| 86 | +This command sequentially downloads test dependencies, compiles C/CPP test targets in Debug mode, runs C/C++ unit tests, and runs Python unit tests. | ||
| 87 | + | ||
| 23 | If the output is similar to the following, and the number of run test cases equals the number of passed test cases, it indicates success: | 88 | If the output is similar to the following, and the number of run test cases equals the number of passed test cases, it indicates success: |
| 24 | 89 | ||
| 25 | ```text | 90 | ```text |
| 26 | -[----------] 4 tests from CoreApi (8ms total) | 91 | +[----------] 4 tests from CoreApi (8ms total) |
| 27 | ``` | 92 | ``` |
| 28 | 93 | ||
| 29 | ```text | 94 | ```text |
| 30 | ============= 4 passed in 0.03s ============= | 95 | ============= 4 passed in 0.03s ============= |
| 31 | ``` | 96 | ``` |
| 32 | 97 | ||
| 33 | -NOTE: You need to install pytest in the environment beforehand to run Python tests. There are multiple independent test suites. If the output results are similar to the example, it indicates successful execution. | 98 | +NOTE: You need to install `pytest` in the environment beforehand to run Python tests. There are multiple independent test suites. If the output results are similar to the example, it indicates successful execution. |
| 99 | + | ||
| 100 | +## 5. FAQ | ||
| 101 | + | ||
| 102 | +### 5.1 Compilation Error: `Python.h` Not Found | ||
| 103 | + | ||
| 104 | +```text | ||
| 105 | +fatal error: Python.h: No such file or directory | ||
| 106 | +``` | ||
| 107 | + | ||
| 108 | +**Solution:** Install the Python development package: | ||
| 109 | + | ||
| 110 | +```sh | ||
| 111 | +# OpenEuler | ||
| 112 | +yum install python3-devel | ||
| 113 | + | ||
| 114 | +# Ubuntu | ||
| 115 | +apt-get install python3-dev | ||
| 116 | +``` | ||
| 117 | + | ||
| 118 | +### 5.2 Test Error: `pytest` Not Found | ||
| 119 | + | ||
| 120 | +```text | ||
| 121 | +pytest: command not found | ||
| 122 | +``` | ||
| 123 | + | ||
| 124 | +**Solution:** Install `pytest`: | ||
| 125 | + | ||
| 126 | +```sh | ||
| 127 | +pip3 install pytest | ||
| 128 | +``` | ||
| 129 | + | ||
| 130 | +### 5.3 Only the whl Package Exists in the Output Folder, No Dynamic Library | ||
| 131 | + | ||
| 132 | +The one-click script `python build.py` generates the whl package and installs dynamic libraries to `output/mstx/lib64/` at the same time. If you only see the whl package, it is usually because only `cmake .. && make` was run during the step-by-step compilation and `make install` was missed. Run `make install` in the `build/` directory to fix this. | ||
| @@ -1,41 +1,114 @@ | |||
| 1 | # MindStudio Tools Extension Library Installation Guide | 1 | # MindStudio Tools Extension Library Installation Guide |
| 2 | 2 | ||
| 3 | -## 1. Dependencies | 3 | +<br> |
| 4 | 4 | ||
| 5 | -Since the code in this project depends on Python 3 header files, the `python3-dev` package must be installed in the build environment. You can install it by running the following command: | 5 | +## 1. Installation Notes |
| 6 | - | 6 | + |
| 7 | -```sh | 7 | +This tool is integrated into CANN. If CANN is already installed and you do not need to update this tool, you can use it directly without following the installation steps in this document. |
| 8 | -apt-get install python3-dev | 8 | + |
| 9 | -``` | 9 | +If CANN is not yet installed in your environment, refer to the [CANN Quick Installation](https://www.hiascend.com/cann/download) guide to install the Ascend NPU driver and CANN software (including Toolkit and the ops package), and configure the environment variables. |
| 10 | - | 10 | + |
| 11 | -## 2. Building and Packaging | 11 | +If you need to upgrade this tool separately or use the latest version, you can install it in the following three ways: [online installation](#21-online-installation), [offline installation](#22-offline-installation), [source installation](#23-source-installation). |
| 12 | + | ||
| 13 | +## 2. Installation Methods | ||
| 14 | + | ||
| 15 | +### 2.1 Online Installation | ||
| 16 | + | ||
| 17 | +If your device has internet access, you can automatically download and install the tool with a single command. Please visit the Ascend Community MindStudio [download](https://www.hiascend.com/developer/software/mindstudio/download) page, select the corresponding CANN version, and choose online installation as the installation method. The system will guide you through the subsequent operations. | ||
| 18 | + | ||
| 19 | +### 2.2 Offline Installation | ||
| 20 | + | ||
| 21 | +For devices in environments without external network access, such as enterprise intranets, first download the complete offline installation package on a machine with internet access, then transfer it to the target device for installation. Please visit the MindStudio [download](https://www.hiascend.com/developer/software/mindstudio/download) page on the Ascend Community, select the corresponding CANN version, choose offline installation as the installation method, and obtain the corresponding installation package and operation guide. | ||
| 22 | + | ||
| 23 | +### 2.3 Source Installation | ||
| 24 | + | ||
| 25 | +If you need to use the latest code features or modify the source code to enhance functionality, you can download the repository code, compile and package the tool yourself, and complete the installation. | ||
| 26 | + | ||
| 27 | +#### 2.3.1 Environment Preparation | ||
| 28 | + | ||
| 29 | +Please follow the documentation below for environment configuration: [Operator Tool Development Environment Setup Guide](https://gitcode.com/Ascend/msot/blob/26.1.0/docs/en/common/dev_env_setup.md). | ||
| 30 | + | ||
| 31 | +#### 2.3.2 Project Dependencies | ||
| 32 | + | ||
| 33 | +- Clone this repository | ||
| 34 | + | ||
| 35 | + ```sh | ||
| 36 | + git clone https://gitcode.com/Ascend/mstx.git -b 26.1.0 | ||
| 37 | + ``` | ||
| 38 | + | ||
| 39 | +- Download dependencies | ||
| 40 | + | ||
| 41 | + Since the code in this project depends on the header files of Python 3, the python3-dev package needs to be installed in the build environment. This can be done with the following commands: | ||
| 42 | + | ||
| 43 | + - OpenEuler environment: | ||
| 44 | + | ||
| 45 | + ```sh | ||
| 46 | + yum install python3-devel | ||
| 47 | + ``` | ||
| 48 | + | ||
| 49 | + - Ubuntu environment: | ||
| 50 | + | ||
| 51 | + ```sh | ||
| 52 | + apt-get install python3-dev | ||
| 53 | + ``` | ||
| 54 | + | ||
| 55 | + NOTE: Non-root users need to add sudo before the command, for example: `sudo yum install python3-devel`. | ||
| 56 | + | ||
| 57 | +#### 2.3.3 Building and Packaging | ||
| 12 | 58 | ||
| 13 | ```sh | 59 | ```sh |
| 60 | +cd mstx | ||
| 14 | python build.py | 61 | python build.py |
| 15 | ``` | 62 | ``` |
| 16 | 63 | ||
| 17 | -## 3. Installing the whl Package | 64 | +#### 2.3.4 whl Package Installation |
| 18 | 65 | ||
| 19 | ```sh | 66 | ```sh |
| 20 | cd output | 67 | cd output |
| 21 | pip3 install mstx-xxxxx.whl | 68 | pip3 install mstx-xxxxx.whl |
| 22 | ``` | 69 | ``` |
| 23 | 70 | ||
| 24 | -## 4. Upgrade | 71 | +## 3. Installation Verification |
| 25 | 72 | ||
| 26 | -To replace an existing installed whl package in the runtime environment with a new whl package, perform the following installation operation: | 73 | +After installation, run the following command to verify whether the tool was installed successfully: |
| 27 | 74 | ||
| 28 | -```sh | 75 | +```shell |
| 29 | -pip3 install mstx-xxxxx.whl --force-reinstall | 76 | +pip show mstx |
| 30 | ``` | 77 | ``` |
| 31 | 78 | ||
| 32 | -During installation, if prompted whether to replace the existing package: | 79 | +If no error is reported and relevant information is displayed, the installation is successful. |
| 33 | -Enter "y", and the package will automatically complete the upgrade operation. | ||
| 34 | 80 | ||
| 35 | -## 5. Uninstallation | 81 | +## 4. Uninstallation |
| 36 | 82 | ||
| 37 | -To uninstall, use the following command: | 83 | +You can uninstall it by following these steps: |
| 38 | 84 | ||
| 39 | -```sh | 85 | +1. Download the script. |
| 40 | -pip3 uninstall mstx-xxxxx.whl | 86 | + |
| 41 | -``` | 87 | + ```bash |
| 88 | + curl -O https://inst.obs.cn-north-4.myhuaweicloud.com/26.1.0/ms_install.py | ||
| 89 | + ``` | ||
| 90 | + | ||
| 91 | + > [!NOTE] | ||
| 92 | + > | ||
| 93 | + > - An internet connection is required for downloading. If the environment does not allow internet access or is offline, please download the script in an environment with internet access first, and then copy it to the target device. | ||
| 94 | + > - If the command does not respond or issues such as connection failure or SSL certificate errors occur, please refer to [FAQ](https://www.hiascend.com/developer/blog/details/02176213671719317003). | ||
| 95 | + | ||
| 96 | +2. Execute the uninstallation. | ||
| 97 | + | ||
| 98 | + ```bash | ||
| 99 | + python ms_install.py uninstall {tools_name} | ||
| 100 | + ``` | ||
| 101 | + | ||
| 102 | + Where `{tools_name}` refers to the name of the tool to be uninstalled. You can query it using the `python ms_install.py help` command, and the tool name will be displayed under the Available Tools field in the printed information. | ||
| 103 | + | ||
| 104 | + If the uninstallation is successful, the following information is printed: | ||
| 105 | + | ||
| 106 | + ```text | ||
| 107 | + Successfully uninstalled 1 tool ({tools_name}) | ||
| 108 | + ``` | ||
| 109 | + | ||
| 110 | +## 5. Upgrade | ||
| 111 | + | ||
| 112 | +Upgrade means "uninstall first, then install". Directly execute the installation command, and the tool will automatically uninstall the old version and guide you through the overwrite installation. | ||
| 113 | + | ||
| 114 | +You can run the `pip show mstx` command to check the version information of the current environment and select the version you want to upgrade to. When upgrading the version, pay attention to version compatibility. Refer to the [Release Notes](https://gitcode.com/Ascend/release-management/blob/master/MindStudio/26.1.0/release_notes.md). | ||
| @@ -14,15 +14,15 @@ echo 2 > /proc/sys/kernel/randomize_va_space | |||
| 14 | 14 | ||
| 15 | 2. If a tool depends on CANN, use the CANN package installed by the same non-privileged user. After running the `source` command, do not modify environment variables in `set_env.sh`. | 15 | 2. If a tool depends on CANN, use the CANN package installed by the same non-privileged user. After running the `source` command, do not modify environment variables in `set_env.sh`. |
| 16 | 16 | ||
| 17 | -3. Before using any tool in this repository, you are advised to set `umask` to `0027` or a more restrictive value to ensure that generated files meet the minimum permission security requirements. | 17 | +3. Before using any tool in this repository, you are advised to set `umask` to 0027 or a more restrictive value to ensure that generated files meet the minimum permission security requirements. |
| 18 | 18 | ||
| 19 | ## File Permission Control | 19 | ## File Permission Control |
| 20 | 20 | ||
| 21 | 1. When providing input files to the tool as command inputs, it is recommended that the file owner match the process owner of the tool and that file permissions restrict write access for `group` and `others`. By default, tool files written to the drive are not writable by others. You can manually control the permissions for the generated files as needed. | 21 | 1. When providing input files to the tool as command inputs, it is recommended that the file owner match the process owner of the tool and that file permissions restrict write access for `group` and `others`. By default, tool files written to the drive are not writable by others. You can manually control the permissions for the generated files as needed. |
| 22 | 22 | ||
| 23 | -2. Proper permission control is essential during installation and use. For details, see the following table. | 23 | +2. Proper permission control is essential during installation and use. You are advised to set permissions by referring to the [File Permission Reference](#file-permission-reference). |
| 24 | 24 | ||
| 25 | -## File Permission Reference | 25 | +**File Permission Reference**<a id="file-permission-reference"></a> |
| 26 | 26 | ||
| 27 | | Type | Maximum Linux Permission| | 27 | | Type | Maximum Linux Permission| |
| 28 | | ---------------------------------- | ------------------- | | 28 | | ---------------------------------- | ------------------- | |
| @@ -62,13 +62,15 @@ This tool supports source code compilation and installation. During compilation, | |||
| 62 | 62 | ||
| 63 | 2. During tool usage, no security validation is performed on user input programs. You need to ensure the security of the programs yourself. | 63 | 2. During tool usage, no security validation is performed on user input programs. You need to ensure the security of the programs yourself. |
| 64 | 64 | ||
| 65 | +3. During operation, the tool loads `.so` files from `LD_LIBRARY_PATH`. Before using the tool, you need to ensure that the contents of the `LD_LIBRARY_PATH` environment variable are secure and trustworthy, the paths it points to do not involve symbolic links, and the permissions and owners meet security expectations and cannot be tampered with by third parties. Otherwise, there is a risk of arbitrary code injection. | ||
| 66 | + | ||
| 65 | ## Public Network Address Statement | 67 | ## Public Network Address Statement |
| 66 | 68 | ||
| 67 | The tool does not involve the use of public IP addresses. | 69 | The tool does not involve the use of public IP addresses. |
| 68 | 70 | ||
| 69 | ## Public API Statement | 71 | ## Public API Statement |
| 70 | 72 | ||
| 71 | -This project is developed in Python with source code released. It is recommended to use the public APIs specified in the documentation. Directly calling source code APIs that are not explicitly disclosed is not recommended. | 73 | +This project is developed in Python with source code released. You are advised to use the public APIs specified in the documentation. Directly calling source code APIs that are not explicitly disclosed is not recommended. |
| 72 | 74 | ||
| 73 | ## Usage of Secure Functions | 75 | ## Usage of Secure Functions |
| 74 | 76 | ||
| @@ -61,7 +61,7 @@ To assess the severity level of a vulnerability, perform the following steps: | |||
| 61 | 61 | ||
| 62 | ### Severity Rating | 62 | ### Severity Rating |
| 63 | 63 | ||
| 64 | -| **Severity Rating** | **CVSS Score** | **Vulnerability Fix Time** | | 64 | +| Severity Rating | CVSS Score | Vulnerability Fix Time | |
| 65 | | ------------------------------- | --------------------- | ---------------- | | 65 | | ------------------------------- | --------------------- | ---------------- | |
| 66 | | Critical | 9.0~10.0 | 7 days | | 66 | | Critical | 9.0~10.0 | 7 days | |
| 67 | | High | 7.0~8.9 | 14 days | | 67 | | High | 7.0~8.9 | 14 days | |