aclrtCreateEvent

Description

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

Restrictions

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

The number of events supported varies depending on the hardware model, as shown in the following table.

Model

Maximum Number of Events Supported by a Device

Atlas 200/300/500 Inference Product

1,023

Atlas Training Series Product

65,535

Prototype

aclError aclrtCreateEvent(aclrtEvent *event)

Parameters

Parameter

Input/Output

Description

event

Output

Event pointer.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.

Related APIs

You can also use the aclrtCreateEventWithFlag or aclrtCreateEventExWithFlag API to create an event with an identifier. Events with different identifiers are used for different functions.

See Also

For details about the API call sequence and example, see Sample Code for Event Synchronization and API Call Sequence and Sample Code for Task Synchronization Between Streams.