Function: create_event_with_flag

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Description

Creates an event with a flag. Events with different flags are used for different functions. When an event is created, multiple flags can be carried (bitwise OR operation) to enable the corresponding flag function.

Prototype

  • C Prototype
    1
    aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag)
    
  • Python Function
    1
    event, ret = acl.rt.create_event_with_flag(flag)
    

Parameters

Parameter

Description

flag

Int, event flag. The options are as follows:

  • ACL_EVENT_TIME_LINE = 0x00000008 indicates that the number of created events is not limited, and the created events can be used to compute the elapsed time between events.
  • ACL_EVENT_SYNC = 0x00000001 indicates that the number of created events is limited, and the created events can be used for synchronization between multiple streams.
  • ACL_EVENT_CAPTURE_STREAM_PROGRESS = 0x00000002 indicates that the created event is used to trace the task execution progress of the stream.

Return Values

Return Value

Description

event

Int, pointer address of the created event object.

ret

Int, error code. 0 on success; else, failure.

Restrictions

When this API is called to create an event, flag is a bitmap. Operations can be performed on a single flag or multiple flags, for example, acl.rt.create_event_with_flag( ACL_EVENT_TIME_LINE | ACL_EVENT_SYNC).

  • If the flag contains the ACL_EVENT_SYNC, the number of created events is limited. For details, see the following:

    For the Atlas 200I/500 A2 inference products, a single device supports a maximum of 65,536 events.

    For the Atlas inference products, a single device supports a maximum of 1,023 events.

    For the Atlas training products, a single device supports a maximum of 65,535 events.

    For the Atlas A2 training products/Atlas A2 inference products, a single device supports a maximum of 65,536 events.

    For the Atlas A3 training products/Atlas A3 inference products, a single device supports a maximum of 65,536 events.

  • If the value of flag does not contain ACL_EVENT_SYNC, events created using this API cannot be used in the following APIs: acl.rt.reset_event, acl.rt.stream_wait_event, and acl.rt.query_event_wait_status.