\class command_queue \brief A command queue. Command queues provide the interface for interacting with compute devices. The command_queue class provides methods to copy data to and from a compute device as well as execute compute kernels. Command queues are created for a compute device within a compute context. For example, to create a context and command queue for the default device on the sys
| 76 | /// |
| 77 | /// \see buffer, context, kernel |
| 78 | class command_queue |
| 79 | { |
| 80 | public: |
| 81 | enum properties { |
| 82 | enable_profiling = CL_QUEUE_PROFILING_ENABLE, |
| 83 | enable_out_of_order_execution = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
| 84 | #ifdef BOOST_COMPUTE_CL_VERSION_2_0 |
| 85 | , |
| 86 | on_device = CL_QUEUE_ON_DEVICE, |
| 87 | on_device_default = CL_QUEUE_ON_DEVICE_DEFAULT |
| 88 | #endif |
| 89 | }; |
| 90 | |
| 91 | enum map_flags { |
| 92 | map_read = CL_MAP_READ, |
| 93 | map_write = CL_MAP_WRITE |
| 94 | #ifdef BOOST_COMPUTE_CL_VERSION_1_2 |
| 95 | , |
| 96 | map_write_invalidate_region = CL_MAP_WRITE_INVALIDATE_REGION |
| 97 | #endif |
| 98 | }; |
| 99 | |
| 100 | #ifdef BOOST_COMPUTE_CL_VERSION_1_2 |
| 101 | enum mem_migration_flags { |
| 102 | migrate_to_host = CL_MIGRATE_MEM_OBJECT_HOST, |
| 103 | migrate_content_undefined = CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED |
| 104 | }; |
| 105 | #endif // BOOST_COMPUTE_CL_VERSION_1_2 |
| 106 | |
| 107 | /// Creates a null command queue. |
| 108 | command_queue() |
| 109 | : m_queue(0) |
| 110 | { |
| 111 | } |
| 112 | |
| 113 | explicit command_queue(cl_command_queue queue, bool retain = true) |
| 114 | : m_queue(queue) |
| 115 | { |
| 116 | if(m_queue && retain){ |
| 117 | clRetainCommandQueue(m_queue); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /// Creates a command queue in \p context for \p device with |
| 122 | /// \p properties. |
| 123 | /// |
| 124 | /// \see_opencl_ref{clCreateCommandQueue} |
| 125 | command_queue(const context &context, |
| 126 | const device &device, |
| 127 | cl_command_queue_properties properties = 0) |
| 128 | { |
| 129 | BOOST_ASSERT(device.id() != 0); |
| 130 | |
| 131 | cl_int error = 0; |
| 132 | |
| 133 | #ifdef BOOST_COMPUTE_CL_VERSION_2_0 |
| 134 | if (device.check_version(2, 0)){ |
| 135 | std::vector<cl_queue_properties> queue_properties; |
no outgoing calls
no test coverage detected