GPUOcelot
Functions

Event Management

CUDA Driver API
Collaboration diagram for Event Management:

Functions

CUresult CUDAAPI cuEventCreate (CUevent *phEvent, unsigned int Flags)
 Creates an event.
CUresult CUDAAPI cuEventRecord (CUevent hEvent, CUstream hStream)
 Records an event.
CUresult CUDAAPI cuEventQuery (CUevent hEvent)
 Queries an event's status.
CUresult CUDAAPI cuEventSynchronize (CUevent hEvent)
 Waits for an event to complete.
CUresult CUDAAPI cuEventDestroy (CUevent hEvent)
 Destroys an event.
CUresult CUDAAPI cuEventElapsedTime (float *pMilliseconds, CUevent hStart, CUevent hEnd)
 Computes the elapsed time between two events.

Detailed Description

This section describes the event management functions of the low-level CUDA driver application programming interface.


Function Documentation

CUresult CUDAAPI cuEventCreate ( CUevent phEvent,
unsigned int  Flags 
)

Creates an event.

Creates an event *phEvent with the flags specified via Flags. Valid flags include:

Parameters:
phEvent- Returns newly created event
Flags- Event creation flags
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_OUT_OF_MEMORY
See also:
cuEventRecord, cuEventQuery, cuEventSynchronize, cuEventDestroy, cuEventElapsedTime
CUresult CUDAAPI cuEventDestroy ( CUevent  hEvent)

Destroys an event.

Destroys the event specified by hEvent.

Parameters:
hEvent- Event to destroy
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE
See also:
cuEventCreate, cuEventRecord, cuEventQuery, cuEventSynchronize, cuEventElapsedTime
CUresult CUDAAPI cuEventElapsedTime ( float *  pMilliseconds,
CUevent  hStart,
CUevent  hEnd 
)

Computes the elapsed time between two events.

Computes the elapsed time between two events (in milliseconds with a resolution of around 0.5 microseconds).

If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used the same stream handle). This happens because the cuEventRecord() operation takes place asynchronously and there is no guarantee that the measured latency is actually just between the two events. Any number of other different stream operations could execute in between the two measured events, thus altering the timing in a significant way.

If cuEventRecord() has not been called on either event then CUDA_ERROR_INVALID_HANDLE is returned. If cuEventRecord() has been called on both events but one or both of them has not yet been completed (that is, cuEventQuery() would return CUDA_ERROR_NOT_READY on at least one of the events), CUDA_ERROR_NOT_READY is returned. If either event was created with the CU_EVENT_DISABLE_TIMING flag, then this function will return CUDA_ERROR_INVALID_HANDLE.

Parameters:
pMilliseconds- Time between hStart and hEnd in ms
hStart- Starting event
hEnd- Ending event
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_NOT_READY
See also:
cuEventCreate, cuEventRecord, cuEventQuery, cuEventSynchronize, cuEventDestroy
CUresult CUDAAPI cuEventQuery ( CUevent  hEvent)

Queries an event's status.

Query the status of all device work preceding the most recent call to cuEventRecord() (in the appropriate compute streams, as specified by the arguments to cuEventRecord()).

If this work has successfully been completed by the device, or if cuEventRecord() has not been called on hEvent, then CUDA_SUCCESS is returned. If this work has not yet been completed by the device then CUDA_ERROR_NOT_READY is returned.

Parameters:
hEvent- Event to query
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_READY
See also:
cuEventCreate, cuEventRecord, cuEventSynchronize, cuEventDestroy, cuEventElapsedTime
CUresult CUDAAPI cuEventRecord ( CUevent  hEvent,
CUstream  hStream 
)

Records an event.

Records an event. If hStream is non-zero, the event is recorded after all preceding operations in hStream have been completed; otherwise, it is recorded after all preceding operations in the CUDA context have been completed. Since operation is asynchronous, cuEventQuery and/or cuEventSynchronize() must be used to determine when the event has actually been recorded.

If cuEventRecord() has previously been called on hEvent, then this call will overwrite any existing state in hEvent. Any subsequent calls which examine the status of hEvent will only examine the completion of this most recent call to cuEventRecord().

Parameters:
hEvent- Event to record
hStream- Stream to record event for
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_VALUE
See also:
cuEventCreate, cuEventQuery, cuEventSynchronize, cuStreamWaitEvent, cuEventDestroy, cuEventElapsedTime
CUresult CUDAAPI cuEventSynchronize ( CUevent  hEvent)

Waits for an event to complete.

Wait until the completion of all device work preceding the most recent call to cuEventRecord() (in the appropriate compute streams, as specified by the arguments to cuEventRecord()).

If cuEventRecord() has not been called on hEvent, CUDA_SUCCESS is returned immediately.

Waiting for an event that was created with the CU_EVENT_BLOCKING_SYNC flag will cause the calling CPU thread to block until the event has been completed by the device. If the CU_EVENT_BLOCKING_SYNC flag has not been set, then the CPU thread will busy-wait until the event has been completed by the device.

Parameters:
hEvent- Event to wait for
Returns:
CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE
See also:
cuEventCreate, cuEventRecord, cuEventQuery, cuEventDestroy, cuEventElapsedTime
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines