aclmdlRICaptureBegin

Applicable Products

Product

Supported

Ascend 950PR / Ascend 950DT

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Function

Starts capturing tasks delivered to a stream.

All tasks delivered to the specified stream between aclmdlRICaptureBegin and aclmdlRICaptureEnd are not executed immediately. Instead, they are stored in the internal model running instance of the system. These tasks are executed only when aclmdlRIExecuteAsync is called to run the model, thereby reducing the task delivery overhead on the host. After all tasks are executed, if the internal model is no longer needed, call aclmdlRIDestroy to destroy the resource in a timely manner.

aclmdlRICaptureBegin and aclmdlRICaptureEnd must be used in pairs, and the streams of the two APIs must be the same. Between the two APIs, you can call aclmdlRICaptureGetInfo to obtain the capture information and call aclmdlRICaptureThreadExchangeMode to switch the capture mode of the current thread. After aclmdlRICaptureEnd is called, you can call aclmdlRIDebugPrint to print the model information, which helps locate faults in maintenance and test scenarios.

If tasks captured between aclmdlRICaptureBegin and aclmdlRICaptureEnd (including the tasks themselves and task parameter information) need to be updated, you need to deliver the tasks that may be updated between aclmdlRICaptureTaskGrpBegin and aclmdlRICaptureTaskGrpEnd, mark the tasks with the task group flag, and update the input information of the tasks between aclmdlRICaptureTaskUpdateBegin and aclmdlRICaptureTaskUpdateEnd.

Tasks captured between aclmdlRICaptureBegin and aclmdlRICaptureEnd are temporarily stored in the internal model running instance of the system. As the number of tasks increases and event deduction and internal tasks are performed, more streams enter the capture state, which may result in higher stream consumption and insufficient concurrent scheduling resources. Therefore, you need to plan the use of scheduling resources in advance.

Prototype

1
aclError aclmdlRICaptureBegin(aclrtStream stream, aclmdlRICaptureMode mode)

Parameters

Parameter

Input/Output

Description

stream

Input

Stream. For details about the type definition, see aclrtStream.

mode

Input

Capture mode. This mode is used to limit the scope of unsafe functions, including aclrtMemset, aclrtMemcpy, aclrtMemcpy2d, and APIs (such as aclrtMemcpyAsync) that use non-page-locked host memory for asynchronous memory copy.

For details about the type definition, see aclmdlRICaptureMode.

Returns

0 on success; otherwise, failure. For details, see aclError.

API Call Example

For the API call example, see Single-Stream Capture.