---
title: aclrtRecordEvent
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclcppdevg_03_0083.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_0083.html
indexId: b68a3fc723d4485f7f3289d736ebe42265cb08ad02883a080949d6e7e0259f2668
---
# aclrtRecordEvent

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 功能说明

在指定Stream中记录一个Event。异步接口。

aclrtRecordEvent接口与aclrtStreamWaitEvent接口配合使用时，主要用于多Stream之间同步等待的场景。

调用aclrtRecordEvent接口时，会捕获当前Stream上已下发的任务，并记录到Event事件中，因此后续若调用aclrtQueryEventStatus或aclrtStreamWaitEvent接口时，会检查或等待该Event事件中所捕获的任务都已经完成。

另外，对于使用aclrtCreateEventExWithFlag创建的Event：

- aclrtRecordEvent接口支持对同一个Event多次record实现Event复用，每次Record会重新捕获当前Stream上已下发的任务，并覆盖保存到Event中。在调用aclrtStreamWaitEvent接口时，会使用最近一次Event中所保存的任务，且不会被后续的aclrtRecordEvent调用影响。
- 在首次调用aclrtRecordEvent接口前，由于Event中没有任务，因此调用aclrtQueryEventStatus接口时会返回ACL_EVENT_RECORDED_STATUS_COMPLETE。


#### 函数原型

```
aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| event | 输入 | 待记录的Event。类型定义请参见aclrtEvent。 |
| stream | 输入 | 指定Stream。类型定义请参见aclrtStream。 多Stream同步等待场景下，例如，Stream2等待Stream1的场景，此处配置为Stream1。 |


#### 返回值说明

返回0表示成功，返回其他值表示失败，请参见aclError。


#### 接口调用示例

接口调用示例，参见Event等待(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/runtime_doc_dev_0026.html)。
