Open
docs: print ACL error messages safely in RAS guides #133
tianjunAdd on Oct 2
docs: print ACL error messages safely in RAS guides #133
Open
Total: 2 files changed+10-4
| @@ -26,8 +26,11 @@ If an operator execution failure or accuracy anomaly occurs during operator exec | |||
| 26 | 26 | ||
| 27 | Obtain exception information during aclnn interface invocation through the aclGetRecentErrMsg interface (refer to [acl API (C)](https://www.hiascend.com/document/detail/en/canncommercial/latest/API/appdevgapi/aclcppdevg_03_0004.html)). The usage method is as follows: | 27 | Obtain exception information during aclnn interface invocation through the aclGetRecentErrMsg interface (refer to [acl API (C)](https://www.hiascend.com/document/detail/en/canncommercial/latest/API/appdevgapi/aclcppdevg_03_0004.html)). The usage method is as follows: |
| 28 | 28 | ||
| 29 | - ```bash | 29 | + ```cpp |
| 30 | - printf(aclGetRecentErrMsg()); | 30 | + const char *errMsg = aclGetRecentErrMsg(); |
| 31 | + if (errMsg != nullptr) { | ||
| 32 | + printf("%s", errMsg); | ||
| 33 | + } | ||
| 31 | ``` | 34 | ``` |
| 32 | 35 | ||
| 33 | The printed error message example is as follows: | 36 | The printed error message example is as follows: |
| @@ -27,8 +27,11 @@ | |||
| 27 | 27 | ||
| 28 | 通过aclGetRecentErrMsg接口(参见[《Runtime运行时API》](https://hiascend.com/document/redirect/CannCommunityCppApi))获取aclnn接口调用过程中的异常信息,使用方法如下: | 28 | 通过aclGetRecentErrMsg接口(参见[《Runtime运行时API》](https://hiascend.com/document/redirect/CannCommunityCppApi))获取aclnn接口调用过程中的异常信息,使用方法如下: |
| 29 | 29 | ||
| 30 | - ```bash | 30 | + ```cpp |
| 31 | - printf(aclGetRecentErrMsg()); | 31 | + const char *errMsg = aclGetRecentErrMsg(); |
| 32 | + if (errMsg != nullptr) { | ||
| 33 | + printf("%s", errMsg); | ||
| 34 | + } | ||
| 32 | ``` | 35 | ``` |
| 33 | 36 | ||
| 34 | 打印错误信息样例如下: | 37 | 打印错误信息样例如下: |