CUDART_EVENT (3)
NAME
Event Management -Functions
cudaError_t cudaEventCreate (cudaEvent_t *event)
Creates an event object.
__cudart_builtin__ cudaError_t cudaEventCreateWithFlags (cudaEvent_t *event, unsigned int flags)
Creates an event object with the specified flags.
__cudart_builtin__ cudaError_t cudaEventDestroy (cudaEvent_t event)
Destroys an event object.
cudaError_t cudaEventElapsedTime (float *ms, cudaEvent_t start, cudaEvent_t end)
Computes the elapsed time between events.
cudaError_t cudaEventQuery (cudaEvent_t event)
Queries an event's status.
__cudart_builtin__ cudaError_t cudaEventRecord (cudaEvent_t event, cudaStream_t stream=0)
Records an event.
cudaError_t cudaEventSynchronize (cudaEvent_t event)
Waits for an event to complete.
Detailed Description
\brief event management functions of the CUDA runtime API (cuda_runtime_api.h)
This section describes the event management functions of the CUDA runtime application programming interface.
Function Documentation
cudaError_t cudaEventCreate (cudaEvent_t * event)
Creates an event object using cudaEventDefault.
Parameters:
- event - Newly created event
Returns:
- cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorLaunchFailure, cudaErrorMemoryAllocation
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C++ API), cudaEventCreateWithFlags, cudaEventRecord, cudaEventQuery, cudaEventSynchronize, cudaEventDestroy, cudaEventElapsedTime, cudaStreamWaitEvent
__cudart_builtin__ cudaError_t cudaEventCreateWithFlags (cudaEvent_t * event, unsigned int flags)
Creates an event object with the specified flags. Valid flags include:
- *
- cudaEventDefault: Default event creation flag.
- *
- cudaEventBlockingSync: Specifies that event should use blocking synchronization. A host thread that uses cudaEventSynchronize() to wait on an event created with this flag will block until the event actually completes.
- *
- cudaEventDisableTiming: Specifies that the created event does not need to record timing data. Events created with this flag specified and the cudaEventBlockingSync flag not specified will provide the best performance when used with cudaStreamWaitEvent() and cudaEventQuery().
- *
- cudaEventInterprocess: Specifies that the created event may be used as an interprocess event by cudaIpcGetEventHandle(). cudaEventInterprocess must be specified along with cudaEventDisableTiming.
Parameters:
-
event - Newly created event
flags - Flags for new event
Returns:
- cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorLaunchFailure, cudaErrorMemoryAllocation
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventSynchronize, cudaEventDestroy, cudaEventElapsedTime, cudaStreamWaitEvent
__cudart_builtin__ cudaError_t cudaEventDestroy (cudaEvent_t event)
Destroys the event specified by event.
In case event has been recorded but has not yet been completed when cudaEventDestroy() is called, the function will return immediately and the resources associated with event will be released automatically once the device has completed event.
Parameters:
- event - Event to destroy
Returns:
- cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorLaunchFailure
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventCreateWithFlags, cudaEventQuery, cudaEventSynchronize, cudaEventRecord, cudaEventElapsedTime
cudaError_t cudaEventElapsedTime (float * ms, cudaEvent_t start, cudaEvent_t end)
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 cudaEventRecord() 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 cudaEventRecord() has not been called on either event, then cudaErrorInvalidResourceHandle is returned. If cudaEventRecord() has been called on both events but one or both of them has not yet been completed (that is, cudaEventQuery() would return cudaErrorNotReady on at least one of the events), cudaErrorNotReady is returned. If either event was created with the cudaEventDisableTiming flag, then this function will return cudaErrorInvalidResourceHandle.
Parameters:
-
ms - Time between start and end in ms
start - Starting event
end - Ending event
Returns:
- cudaSuccess, cudaErrorNotReady, cudaErrorInvalidValue, cudaErrorInitializationError, cudaErrorInvalidResourceHandle, cudaErrorLaunchFailure
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventCreateWithFlags, cudaEventQuery, cudaEventSynchronize, cudaEventDestroy, cudaEventRecord
cudaError_t cudaEventQuery (cudaEvent_t event)
Query the status of all device work preceding the most recent call to cudaEventRecord() (in the appropriate compute streams, as specified by the arguments to cudaEventRecord()).
If this work has successfully been completed by the device, or if cudaEventRecord() has not been called on event, then cudaSuccess is returned. If this work has not yet been completed by the device then cudaErrorNotReady is returned.
For the purposes of Unified Memory, a return value of cudaSuccess is equivalent to having called cudaEventSynchronize().
Parameters:
- event - Event to query
Returns:
- cudaSuccess, cudaErrorNotReady, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorLaunchFailure
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventCreateWithFlags, cudaEventRecord, cudaEventSynchronize, cudaEventDestroy, cudaEventElapsedTime
__cudart_builtin__ cudaError_t cudaEventRecord (cudaEvent_t event, cudaStream_t stream = 0)
Records an event. See note about NULL stream behavior. Since operation is asynchronous, cudaEventQuery() or cudaEventSynchronize() must be used to determine when the event has actually been recorded.
If cudaEventRecord() has previously been called on event, then this call will overwrite any existing state in event. Any subsequent calls which examine the status of event will only examine the completion of this most recent call to cudaEventRecord().
Parameters:
-
event - Event to record
stream - Stream in which to record event
Returns:
- cudaSuccess, cudaErrorInvalidValue, cudaErrorInitializationError, cudaErrorInvalidResourceHandle, cudaErrorLaunchFailure
Note:
-
This function uses standard semantics.
Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventCreateWithFlags, cudaEventQuery, cudaEventSynchronize, cudaEventDestroy, cudaEventElapsedTime, cudaStreamWaitEvent
cudaError_t cudaEventSynchronize (cudaEvent_t event)
Wait until the completion of all device work preceding the most recent call to cudaEventRecord() (in the appropriate compute streams, as specified by the arguments to cudaEventRecord()).
If cudaEventRecord() has not been called on event, cudaSuccess is returned immediately.
Waiting for an event that was created with the cudaEventBlockingSync flag will cause the calling CPU thread to block until the event has been completed by the device. If the cudaEventBlockingSync flag has not been set, then the CPU thread will busy-wait until the event has been completed by the device.
Parameters:
- event - Event to wait for
Returns:
- cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidValue, cudaErrorInvalidResourceHandle, cudaErrorLaunchFailure
Note:
- Note that this function may also return error codes from previous, asynchronous launches.
See also:
- cudaEventCreate (C API), cudaEventCreateWithFlags, cudaEventRecord, cudaEventQuery, cudaEventDestroy, cudaEventElapsedTime
Author
Generated automatically by Doxygen from the source code.