Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages |
#include <itkOpenCLEvent.h>
OpenCLEvent class represents an OpenCL event object.
An event object can be used to track the execution status of a command. The API calls that enqueue commands to a command queue create a new event object that is returned in the event argument. In case of an error enqueuing the command in the command queue the event argument does not return an event object.
\table \row \o IsQueued() \o The command command has been enqueued in the command-queue. \row \o IsSubmitted() \o The enqueued command has been submitted by the host to the device associated with the command-queue. \row \o IsRunning() \o The command is currently executing on the OpenCL device. \row \o IsComplete() \o The command has successfully completed. \row \o IsError() \o The command has finished execution due to an error. \endtable
The method WaitForFinished() waits on the host thread for commands identified by event objects in event list to complete. A command is considered complete if its execution status is {CL_COMPLETE} or a negative value.
The events specified in OpenCLEventList act as synchronization points. The OpenCLEventList are used to control execution order:
The OpenCL functions that are submitted to a command-queue are enqueued in the order the calls are made but can be configured to execute in-order or out-of-order. The properties argument in context->CreateCommandQueue() can be used to specify the execution order.
If the {CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE} property of a command-queue is not set, the commands enqueued to a command-queue execute in order. For example, if an application calls buffer.ReadAsync() to execute event1 followed by a buffer.ReadAsync() to execute event2, the application can assume that event1 finishes first and then event2 is executed. If the OpenCLCommandQueue::IsOutOfOrder() property of a command-queue is set, then there is no guarantee that event1 will finish before event2 starts execution.
Definition at line 92 of file itkOpenCLEvent.h.
Public Types | |
typedef OpenCLEvent | Self |
Public Member Functions | |
cl_command_type | GetCommandType () const |
cl_event | GetEventId () const |
cl_ulong | GetFinishTime () const |
cl_ulong | GetQueueTime () const |
cl_ulong | GetRunTime () const |
cl_int | GetStatus () const |
cl_ulong | GetSubmitTime () const |
bool | IsComplete () const |
bool | IsError () const |
bool | IsNull () const |
bool | IsQueued () const |
bool | IsRunning () const |
bool | IsSubmitted () const |
OpenCLEvent () | |
OpenCLEvent (const cl_event id) | |
OpenCLEvent (const OpenCLEvent &other) | |
OpenCLEvent & | operator= (const OpenCLEvent &other) |
cl_int | SetCallback (cl_int type, void(CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *), void *user_data=nullptr) |
cl_int | WaitForFinished () |
~OpenCLEvent () | |
Private Attributes | |
cl_event | m_Id |
Friends | |
class | OpenCLUserEvent |
typedef OpenCLEvent itk::OpenCLEvent::Self |
Standard class typedefs.
Definition at line 97 of file itkOpenCLEvent.h.
itk::OpenCLEvent::OpenCLEvent | ( | ) |
Constructs a null OpenCL event object.
itk::OpenCLEvent::OpenCLEvent | ( | const cl_event | id | ) |
Constructs an OpenCL event object from the identifier id. This class takes over ownership of id and will release it in the destructor.
itk::OpenCLEvent::OpenCLEvent | ( | const OpenCLEvent & | other | ) |
Constructs a copy of other. The {clRetainEvent()} function will be called to update the reference count on GetEventId().
itk::OpenCLEvent::~OpenCLEvent | ( | ) |
Releases this OpenCL event object by calling {clReleaseEvent()}.
cl_command_type itk::OpenCLEvent::GetCommandType | ( | ) | const |
Returns the type of command that generated this event.
|
inline |
Returns the OpenCL identifier for this event.
Definition at line 123 of file itkOpenCLEvent.h.
cl_ulong itk::OpenCLEvent::GetFinishTime | ( | ) | const |
Returns the device time in nanoseconds when the command finished running on the device. The return value is only valid if the command has finished execution and profiling was enabled on the command queue.
cl_ulong itk::OpenCLEvent::GetQueueTime | ( | ) | const |
Returns the device time in nanoseconds when the command was queued for execution on the host. The return value is only valid if the command has finished execution and profiling was enabled on the command queue.
cl_ulong itk::OpenCLEvent::GetRunTime | ( | ) | const |
Returns the device time in nanoseconds when the command started running on the device. The return value is only valid if the command has finished execution and profiling was enabled on the command queue.
cl_int itk::OpenCLEvent::GetStatus | ( | ) | const |
Returns the status of this event, which is an error code or one of {CL_QUEUED},
{CL_SUBMITTED},
{CL_RUNNING} or
{CL_COMPLETE}.
cl_ulong itk::OpenCLEvent::GetSubmitTime | ( | ) | const |
Returns the device time in nanoseconds when the command was submitted by the host for execution on the device. The return value is only valid if the command has finished execution and profiling was enabled on the command queue.
|
inline |
Returns true if the command associated with this OpenCL event has completed execution on the device.
Definition at line 144 of file itkOpenCLEvent.h.
|
inline |
Returns true if an error has occurred on this OpenCL event.
Definition at line 148 of file itkOpenCLEvent.h.
|
inline |
Returns true if this OpenCL event object is null, false otherwise.
Definition at line 120 of file itkOpenCLEvent.h.
|
inline |
Returns true if the command associated with this OpenCL event has been queued for execution on the host, but has not yet been submitted to the device yet.
Definition at line 129 of file itkOpenCLEvent.h.
|
inline |
Returns true if the command associated with this OpenCL event is running on the device, but has not yet finished.
Definition at line 139 of file itkOpenCLEvent.h.
|
inline |
Returns true if the command associated with this OpenCL event has been submitted for execution on the device yet, but is not yet running.
Definition at line 134 of file itkOpenCLEvent.h.
OpenCLEvent & itk::OpenCLEvent::operator= | ( | const OpenCLEvent & | other | ) |
Assigns other to this OpenCL event object. The current GetEventId() will be released with {clReleaseEvent()}, and the new GetEventId() will be retained with
{clRetainEvent()}.
cl_int itk::OpenCLEvent::SetCallback | ( | cl_int | type, |
void(CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *) | , | ||
void * | user_data = nullptr |
||
) |
Registers a user callback function for a specific command execution status. If the execution of a command is terminated, the command-queue associated with this terminated command, and the associated context (and all other command-queues in this context) may no longer be available. The behavior of OpenCL API calls that use this context (and command-queues associated with this context) are now considered to be implementation defined. The user registered callback function specified when context is created can be used to report appropriate error information.
cl_int itk::OpenCLEvent::WaitForFinished | ( | ) |
Waits for this event to be signaled as finished. The calling thread is blocked until the event is signaled. This function returns immediately if the event is null.
|
friend |
friends from OpenCL core
Definition at line 205 of file itkOpenCLEvent.h.
|
private |
Definition at line 202 of file itkOpenCLEvent.h.
Generated on 1667476801 for elastix by 1.9.4 |