HIP: Heterogenous-computing Interface for Portability
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Event Management

Functions

hipError_t hipEventCreateWithFlags (hipEvent_t *event, unsigned flags)
 Create an event with the specified flags. More...
 
hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream=NULL)
 Record an event in the specified stream. More...
 
hipError_t hipEventDestroy (hipEvent_t event)
 Destroy the specified event. More...
 
hipError_t hipEventSynchronize (hipEvent_t event)
 : Wait for an event to complete. More...
 
hipError_t hipEventElapsedTime (float *ms, hipEvent_t start, hipEvent_t stop)
 Return the elapsed time between two events. More...
 
hipError_t hipEventQuery (hipEvent_t event)
 Query event status. More...
 

Detailed Description

----------------------------------------------------------------------------------------------—

Function Documentation

hipError_t hipEventCreateWithFlags ( hipEvent_t event,
unsigned  flags 
)

Create an event with the specified flags.

Parameters
[in,out]eventReturns the newly created event.
[in]flagsFlags to control event behavior. hipEventDefault, hipEventBlockingSync, hipEventDisableTiming, hipEventInterprocess
Warning
On HCC platform, hipEventInterprocess is not supported.
Returns
#cudaSuccess
Warning
: flags must be 0.
hipError_t hipEventDestroy ( hipEvent_t  event)

Destroy the specified event.

Parameters
[in]eventEvent to destroy.
Returns
: hipSuccess,

Releases memory associated with the event. If the event is recording but has not completed recording when hipEventDestroy is called, the function will return immediately and the completion_future resources will be released later, when the hipDevice is synchronized.

hipError_t hipEventElapsedTime ( float *  ms,
hipEvent_t  start,
hipEvent_t  stop 
)

Return the elapsed time between two events.

Parameters
[out]ms : Return time between start and stop in ms.
[in]start: Start event.
[in]stop: Stop event.
Returns
: hipSuccess, hipErrorInvalidResourceHandle, hipErrorNotReady,

Computes the elapsed time between two events. Time is computed in ms, with a resolution of approximately 1 us.

Events which are recorded in a NULL stream will block until all commands on all other streams complete execution, and then record the timestamp.

Events which are recorded in a non-NULL stream will record their timestamp when they reach the head of the specified stream, after all previous commands in that stream have completed executing. Thus the time that the event recorded may be significantly after the host calls hipEventRecord.

If hipEventRecord has not been called on either event, then hipErrorInvalidResourceHandle is returned. If hipEventRecord has been called on both events, but the timestamp has not yet been recorded on one or both events (that is, hipEventQuery would return hipErrorNotReady on at least one of the events), then hipErrorNotReady is returned.

hipError_t hipEventQuery ( hipEvent_t  event)

Query event status.

Parameters
[in]eventEvent to query.
Returns
hipSuccess, hipEventNotReady

Query the status of the specified event. This function will return hipErrorNotReady if all commands in the appropriate stream (specified to hipEventRecord) have completed. If that work has not completed, or if hipEventRecord was not called on the event, then cudaSuccess is returned.

hipError_t hipEventRecord ( hipEvent_t  event,
hipStream_t  stream = NULL 
)

Record an event in the specified stream.

Parameters
[in]eventevent to record.
[in]streamstream in which to record event.
Returns
hipSuccess, hipErrorInvalidResourceHandle

hipEventQuery or hipEventSynchronize must be used to determine when the event transitions from "recording" (after eventRecord is called) to "recorded" (when timestamps are set, if requested).

Events which are recorded in a non-NULL stream will transition to from recording to "recorded" state when they reach the head of the specified stream, after all previous commands in that stream have completed executing.

If hipEventRecord has been previously called aon event, then this call will overwrite any existing state in event.

If this function is called on a an event that is currently being recorded, results are undefined - either outstanding recording may save state into the event, and the order is not guaranteed. This shoul be avoided.

See Also
hipEventElapsedTime
hipError_t hipEventSynchronize ( hipEvent_t  event)

: Wait for an event to complete.

This function will block until the event is ready, waiting for all previous work in the stream specified when event was recorded with hipEventRecord.

If hipEventRecord has not been called on event, this function returns immediately.

TODO-hcc - This function needs to support hipEventBlockingSync parameter.

Parameters
[in]eventEvent on which to wait.
Returns
hipSuccess, hipErrorInvalidResourceHandle,