This section describes how to collect and flush profile data by using Profiling AscendCL APIs. The purpose is to write the collected profile data to a file, which is then parsed and displayed by the Profiling tool. For details, see Profiling Instructions.
These APIs can be called repeatedly in a process, allowing for varied Profiling configurations with each call.
aclInit can be called only once per process. To modify the Profiling configuration, modify the JSON configuration file. For details, see the description of the aclInit API.
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.
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.
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.
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
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