\class event \brief An event corresponding to an operation on a compute device Event objects are used to track operations running on the device (such as kernel executions and memory transfers). Event objects are returned by the various \c enqueue_* methods of the command_queue class. Events can be used to synchronize operations between the host and the device. The \c wait() method will block exe
| 45 | /// |
| 46 | /// \see \ref future "future<T>", wait_list |
| 47 | class event |
| 48 | { |
| 49 | public: |
| 50 | /// \internal_ |
| 51 | enum execution_status { |
| 52 | complete = CL_COMPLETE, |
| 53 | running = CL_RUNNING, |
| 54 | submitted = CL_SUBMITTED, |
| 55 | queued = CL_QUEUED |
| 56 | }; |
| 57 | |
| 58 | /// \internal_ |
| 59 | enum command_type { |
| 60 | ndrange_kernel = CL_COMMAND_NDRANGE_KERNEL, |
| 61 | task = CL_COMMAND_TASK, |
| 62 | native_kernel = CL_COMMAND_NATIVE_KERNEL, |
| 63 | read_buffer = CL_COMMAND_READ_BUFFER, |
| 64 | write_buffer = CL_COMMAND_WRITE_BUFFER, |
| 65 | copy_buffer = CL_COMMAND_COPY_BUFFER, |
| 66 | read_image = CL_COMMAND_READ_IMAGE, |
| 67 | write_image = CL_COMMAND_WRITE_IMAGE, |
| 68 | copy_image = CL_COMMAND_COPY_IMAGE, |
| 69 | copy_image_to_buffer = CL_COMMAND_COPY_IMAGE_TO_BUFFER, |
| 70 | copy_buffer_to_image = CL_COMMAND_COPY_BUFFER_TO_IMAGE, |
| 71 | map_buffer = CL_COMMAND_MAP_BUFFER, |
| 72 | map_image = CL_COMMAND_MAP_IMAGE, |
| 73 | unmap_mem_object = CL_COMMAND_UNMAP_MEM_OBJECT, |
| 74 | marker = CL_COMMAND_MARKER, |
| 75 | aquire_gl_objects = CL_COMMAND_ACQUIRE_GL_OBJECTS, |
| 76 | release_gl_object = CL_COMMAND_RELEASE_GL_OBJECTS |
| 77 | #if defined(BOOST_COMPUTE_CL_VERSION_1_1) |
| 78 | , |
| 79 | read_buffer_rect = CL_COMMAND_READ_BUFFER_RECT, |
| 80 | write_buffer_rect = CL_COMMAND_WRITE_BUFFER_RECT, |
| 81 | copy_buffer_rect = CL_COMMAND_COPY_BUFFER_RECT |
| 82 | #endif |
| 83 | }; |
| 84 | |
| 85 | /// \internal_ |
| 86 | enum profiling_info { |
| 87 | profiling_command_queued = CL_PROFILING_COMMAND_QUEUED, |
| 88 | profiling_command_submit = CL_PROFILING_COMMAND_SUBMIT, |
| 89 | profiling_command_start = CL_PROFILING_COMMAND_START, |
| 90 | profiling_command_end = CL_PROFILING_COMMAND_END |
| 91 | }; |
| 92 | |
| 93 | /// Creates a null event object. |
| 94 | event() |
| 95 | : m_event(0) |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | explicit event(cl_event event, bool retain = true) |
| 100 | : m_event(event) |
| 101 | { |
| 102 | if(m_event && retain){ |
| 103 | clRetainEvent(event); |
| 104 | } |