Function: create_event

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

Creates an event, which can be used to compute the elapsed time between two events and synchronize streams.

Prototype

  • C Prototype

    aclError aclrtCreateEvent(aclrtEvent *event)
    
  • Python Function

    event, ret = acl.rt.create_event()
    

Parameters

None

Return Values

Return Value Description
event Int, pointer address of the created event object.
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

The event created using this API cannot be used in acl.rt.reset_event. Otherwise, undefined behavior may occur.

After an event is created by calling this API, the system allocates event resources only when acl.rt.record_event is called. Therefore, the number of events is limited. After the number of events reaches the upper limit, the system waits for resource release.

Limit on the number of events:

  • For the following product models, a maximum of 65,536 events are supported by a single device is:

    Ascend 950PR&950DT products

    Atlas A3 products

    Atlas A2 products

    Atlas 200I/500 A2 inference products

  • For Atlas inference products, a maximum of 1023 events are supported per device.
  • For Atlas training products, a maximum of 65535 events are supported per device.