Event Management
- Provided by: nvidia-cuda-dev (Version: 10.1.243-3)
- Source: nvidia-cuda-toolkit
- Report a bug
\brief event management functions of the low-level CUDA driver API (cuda.h)
This section describes the event management functions of the low-level CUDA driver application programming interface.
Creates an event *phEvent for the current context with the flags specified via Flags. Valid flags include:
Parameters:
Returns:
Note:
See also:
Destroys the event specified by hEvent.
An event may be destroyed before it is complete (i.e., while cuEventQuery() would return CUDA_ERROR_NOT_READY). In this case, the call does not block on completion of the event, and any associated resources will automatically be released asynchronously at completion.
Parameters:
Returns:
Note:
See also:
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:
Returns:
Note:
See also:
Queries the status of all work currently captured by hEvent. See cuEventRecord() for details on what is captured by an event.
Returns CUDA_SUCCESS if all captured work has been completed, or CUDA_ERROR_NOT_READY if any captured work is incomplete.
For the purposes of Unified Memory, a return value of CUDA_SUCCESS is equivalent to having called cuEventSynchronize().
Parameters:
Returns:
Note:
See also:
Captures in hEvent the contents of hStream at the time of this call. hEvent and hStream must be from the same context. Calls such as cuEventQuery() or cuStreamWaitEvent() will then examine or wait for completion of the work that was captured. Uses of hStream after this call do not modify hEvent. See note on default stream behavior for what is captured in the default case.
cuEventRecord() can be called multiple times on the same event and will overwrite the previously captured state. Other APIs such as cuStreamWaitEvent() use the most recently captured state at the time of the API call, and are not affected by later calls to cuEventRecord(). Before the first call to cuEventRecord(), an event represents an empty set of work, so for example cuEventQuery() would return CUDA_SUCCESS.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Waits until the completion of all work currently captured in hEvent. See cuEventRecord() for details on what is captured by an event.
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:
Returns:
Note:
See also:
Generated automatically by Doxygen from the source code.