---
title: 函数：record_event
description: "| C函数原型 | aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream) |"
url: "https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application%20Development%20Guide/aadgp/aclpythondevg_01_0086.html"
---

# 函数：record_event

| C函数原型 | aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream) |
| --- | --- |
| Python函数 | ret = acl.rt.record\_event(event, stream) |
| 函数功能 | 在Stream中记录一个Event。 |
| 输入说明 | event：int，待记录的Event的指针地址。 stream：int，将该Event记录在指定的Stream（指针地址）中，如果使用默认Stream，此处设置为0。 |
| 返回值说明 | ret：int，错误码。 返回0表示成功。 返回其它值表示失败。 |
| 约束说明 | 该接口是异步接口，调用接口成功仅表示任务下发成功，不表示任务执行成功。调用该接口后，需调用同步等待接口（例如，acl.rt.synchronize\_stream）确保任务已执行完成。 acl.rt.record\_event接口与acl.rt.stream\_wait\_event接口配合使用时，主要用于多Stream之间同步的场景，在调用acl.rt.record\_event接口时，系统内部会申请Event资源，在调用acl.rt.stream\_wait\_event接口之后，请及时调用acl.rt.reset\_event接口释放Event资源。 接口调用顺序：acl.rt.create\_event\-\->acl.rt.record\_event\-\->acl.rt.stream\_wait\_event\-\->acl.rt.reset\_event 由于在调用acl.rt.record\_event接口，系统内部会申请Event资源，因此会受Event数量的限制，具体参考如下： Atlas 200/500 A2推理产品，单个Device上最多支持1023个Event。 |
| 参考资源 | 接口调用流程，参见多Stream接口调用流程。 接口调用示例，参见关于Event的同步等待、关于Stream间任务的同步等待。 |
