Overview
General Restrictions
You cannot call the APIs in Profiling AscendCL API for Subscription (Subscription to Operator Information), including aclprofModelSubscribe, aclprofGet*, and aclprofModelUnSubscribe, between the aclprofInit and aclprofFinalize calls.
API Constraints
- API requirements
- aclprofInit must be called after aclInit and before model loading.
If profiling configuration has been set by the aclInit call, the aclprofInit, aclprofStart, aclprofStop, or aclprofFinalize call returns an error.
If aclprofInit is not called, an error is returned when calling aclprofStart, aclprofStop, or aclprofFinalize.
- Call aclprofStart before the model is executed. If aclprofStart is called during model execution, only profile data after the aclprofStart call is collected, which may be incomplete.
When calling aclprofStart, you can specify one or more devices to profile.
In a user app process, an error is returned if aclprofStart is called repeatedly and the specified profiling configuration or device is duplicate.
- In the lifetime of a user app process, do not repeatedly call the aclprofInit and aclprofFinalize pair. Otherwise, the path for storing profile data files may be changed.
- aclprofStart must be used in pair with aclprofStop.
- aclprofSetConfig must be called before aclprofStart interface. In an app process, aclprofSetConfig can be called once or multiple times as required.
- After aclFinalize is called and a normal exit code is received, the execution is complete. Otherwise, the execution is abnormal. Due to the lack of support for multi-process concurrent execution in profile data collection, to ensure that the driver can be properly stopped, it is necessary to wait until the previous profile data collection test case is fully executed before starting the next round of collection. You are advised to add exception handling operations to the return value of aclFinalize to facilitate execution status display and exception localization.
- aclprofInit must be called after aclInit and before model loading.
- API call sequence
- The recommended API call sequence is as follows. In this example, two models are executed in a single user app process.
aclInit --> aclprofInit --> aclprofStart (specify device 0 and device 1) --> Load model 1 --> Execute model 1 --> aclprofStop (consistent with the aclprofConfig data passed to aclprofStart) --> aclprofStart (specify device 1 and device 2) --> Load model 2 --> Execute model 2 --> aclprofStop (consistent with the aclprofConfig data passed to aclprofStart) --> aclprofFinalize --> Execute other tasks --> Unload models --> aclFinalize
- The following is an example of an incorrect call sequence. In this example, aclprofStart is called repeatedly and duplicated devices are specified in a single app process.
aclInit --> aclprofInit --> aclprofStart (specify Device 0 and Device 1) --> aclprofStart (specify Device 1 and Device 2) --> Load model 1 --> Execute model 1 --> Load model 2 --> Execute model 2 --> aclprofStop --> aclprofStop --> aclprofFinalize --> Execute other tasks --> Unload models --> aclFinalize
- The recommended API call sequence is as follows. In this example, two models are executed in a single user app process.