Class: OpenCL::CommandQueue
- Inherits:
-
ExtendedStruct
- Object
- ManagedStruct
- ExtendedStruct
- OpenCL::CommandQueue
- Includes:
- KHRPriorityHints, KHRThrottleHints, OpenCL11, OpenCL12, OpenCL20, OpenCL21
- Defined in:
- lib/opencl_ruby_ffi/CommandQueue.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb,
lib/opencl_ruby_ffi/khr/priority_hints.rb,
lib/opencl_ruby_ffi/khr/priority_hints.rb,
lib/opencl_ruby_ffi/khr/throttle_hints.rb,
lib/opencl_ruby_ffi/khr/throttle_hints.rb
Overview
Maps the cl_command_queue object of OpenCL
Defined Under Namespace
Modules: KHRPriorityHints, KHRThrottleHints, OpenCL11, OpenCL12, OpenCL20, OpenCL21 Classes: PriorityKHR, Properties, ThrottleKHR
Constant Summary collapse
- OUT_OF_ORDER_EXEC_MODE_ENABLE =
(1 << 0)
- PROFILING_ENABLE =
(1 << 1)
- ON_DEVICE =
(1 << 2)
- ON_DEVICE_DEFAULT =
(1 << 3)
- CONTEXT =
0x1090- DEVICE =
0x1091- REFERENCE_COUNT =
0x1092- PROPERTIES =
0x1093- SIZE =
0x1094- DEVICE_DEFAULT =
0x1095- PRIORITY_KHR =
0x1096- PRIORITY_HIGH_KHR =
(1 << 0)
- PRIORITY_MED_KHR =
(1 << 1)
- PRIORITY_LOW_KHR =
(1 << 2)
- THROTTLE_KHR =
0x1097- THROTTLE_HIGH_KHR =
(1 << 0)
- THROTTLE_MED_KHR =
(1 << 1)
- THROTTLE_LOW_KHR =
(1 << 2)
Instance Method Summary collapse
-
#context ⇒ Object
Returns the Context associated to the CommandQueue.
-
#device ⇒ Object
Returns the Device associated to the CommandQueue.
-
#enqueue_acquire_gl_objects(mem_objects, options = {}) ⇒ Object
(also: #enqueue_acquire_GL_objects)
Acquire OpenCL Mem objects that have been created from OpenGL objects using the CommandQueue.
-
#enqueue_barrier(events) ⇒ Object
Enqueues a barrier on a list of envents using the CommandQueue.
-
#enqueue_copy_buffer(src_buffer, dst_buffer, options = {}) ⇒ Object
Enqueues a command to copy data from a Buffer object into another Buffer object using the CommandQueue.
-
#enqueue_copy_buffer_to_image(src_buffer, dst_image, options = {}) ⇒ Object
Enqueues a command to copy a Buffer into an Image using the CommandQueue.
-
#enqueue_copy_image(src_image, dst_image, options = {}) ⇒ Object
Enqueues a command to copy from an Image into an Image using the CommandQueue.
-
#enqueue_copy_image_to_buffer(src_image, dst_buffer, options = {}) ⇒ Object
Enqueues a command to copy an Image into a Buffer using the CommandQueue.
-
#enqueue_map_buffer(buffer, map_flags, options = {}) ⇒ Object
Enqueues a command to map a Buffer into host memory using the CommandQueue.
-
#enqueue_map_image(image, map_flags, options = {}) ⇒ Object
Enqueues a command to map an Image into host memory using the CommandQueue.
-
#enqueue_marker(events = []) ⇒ Object
Enqueues a marker using the CommandQueue.
-
#enqueue_native_kernel(options = {}, &func) ⇒ Object
Enqueues a native kernel in the CommandQueue.
-
#enqueue_ndrange_kernel(kernel, global_work_size, options = {}) ⇒ Object
(also: #enqueue_NDrange_kernel)
Enqueues a kernel as a ndrange using the CommandQueue.
-
#enqueue_read_buffer(buffer, ptr, options = {}) ⇒ Object
Enqueues a command to read from a Buffer object to host memory using the CommandQueue.
-
#enqueue_read_image(image, ptr, options = {}) ⇒ Object
Enqueues a command to copy from an Image into host memory using the CommandQueue.
-
#enqueue_release_gl_objects(mem_objects, options = {}) ⇒ Object
(also: #enqueue_release_GL_objects)
Release OpenCL Mem objects that have been created from OpenGL objects and previously acquired using the CommandQueue.
-
#enqueue_task(kernel, options = {}) ⇒ Object
Enqueues a kernel as a task using the CommandQueue.
-
#enqueue_unmap_mem_object(mem_obj, mapped_ptr, options = {}) ⇒ Object
Enqueues a command to unmap a previously mapped region of a memory object using the CommandQueue.
-
#enqueue_wait_for_events(events = []) ⇒ Object
Enqueues a barrier on a list of envents using the CommandQueue.
-
#enqueue_write_buffer(buffer, ptr, options = {}) ⇒ Object
Enqueues a command to write to a Buffer object from host memory using the CommandQueue.
-
#enqueue_write_image(image, ptr, options = {}) ⇒ Object
Enqueues a command to copy from host memory into an Image using the CommandQueue.
-
#finish ⇒ Object
Blocks until all the commands in the CommandQueue have completed.
-
#flush ⇒ Object
Issues all the commands in a CommandQueue to the Device.
-
#initialize(ptr, retain = true) ⇒ CommandQueue
constructor
Creates a new CommandQueue and retains it if specified and aplicable.
- #inspect ⇒ Object
-
#properties ⇒ Object
Returns the OpenCL::CommandQueue::properties info.
-
#reference_count ⇒ Object
Returns the OpenCL::CommandQueue::reference_count info.
Methods included from KHRThrottleHints
Methods included from KHRPriorityHints
Methods included from OpenCL21
#device_default, #enqueue_svm_migrate_mem
Methods included from OpenCL20
#enqueue_svm_free, #enqueue_svm_map, #enqueue_svm_memcpy, #enqueue_svm_memfill, #enqueue_svm_unmap, #size
Methods included from OpenCL12
#enqueue_fill_buffer, #enqueue_fill_image, #enqueue_migrate_mem_objects
Methods included from OpenCL11
#enqueue_copy_buffer_rect, #enqueue_read_buffer_rect, #enqueue_write_buffer_rect
Methods inherited from ExtendedStruct
Constructor Details
#initialize(ptr, retain = true) ⇒ CommandQueue
Creates a new CommandQueue and retains it if specified and aplicable
1125 1126 1127 1128 1129 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1125 def initialize(ptr, retain = true) super(ptr) OpenCL.clRetainCommandQueue(ptr) if retain #STDERR.puts "Allocating CommandQueue: #{ptr}" end |
Instance Method Details
#context ⇒ Object
Returns the Context associated to the CommandQueue
1073 1074 1075 1076 1077 1078 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1073 def context ptr = MemoryPointer::new( Context ) error = OpenCL.clGetCommandQueueInfo(self, CONTEXT, Context.size, ptr, nil) error_check(error) return Context::new( ptr.read_pointer ) end |
#device ⇒ Object
Returns the Device associated to the CommandQueue
1081 1082 1083 1084 1085 1086 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1081 def device ptr = MemoryPointer::new( Device ) error = OpenCL.clGetCommandQueueInfo(self, DEVICE, Device.size, ptr, nil) error_check(error) return Device::new( ptr.read_pointer ) end |
#enqueue_acquire_gl_objects(mem_objects, options = {}) ⇒ Object Also known as: enqueue_acquire_GL_objects
Acquire OpenCL Mem objects that have been created from OpenGL objects using the CommandQueue
Attributes
-
mem_objects- a single or an Array of Mem objects -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command
Returns
the Event associated with the command
1368 1369 1370 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1368 def enqueue_acquire_gl_objects( mem_objects, = {} ) return OpenCL.enqueue_acquire_gl_objects( self, mem_objects, ) end |
#enqueue_barrier(events) ⇒ Object
Enqueues a barrier on a list of envents using the CommandQueue
Attributes
-
events- a single or an Array of Event to wait upon before the barrier is considered finished
Returns
an Event if implementation version is >= 1.2, nil otherwise
1208 1209 1210 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1208 def ( events ) return OpenCL.( self, events ) end |
#enqueue_copy_buffer(src_buffer, dst_buffer, options = {}) ⇒ Object
Enqueues a command to copy data from a Buffer object into another Buffer object using the CommandQueue
Attributes
-
src_buffer- the Buffer to be read from -
dst_buffer- the Buffer to be written to -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:src_offset- if provided indicates the offset inside the src Buffer of the area to copy, else 0 -
:dst_offset- if provided indicates the offset inside the dst Buffer of the area to write to, else 0 -
:size- if provided indicates the size of data to copy, else the maximum possible is copied
Returns
the Event associated with the command
1195 1196 1197 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1195 def enqueue_copy_buffer( src_buffer, dst_buffer, = {} ) return OpenCL.enqueue_copy_buffer( self, src_buffer, dst_buffer, ) end |
#enqueue_copy_buffer_to_image(src_buffer, dst_image, options = {}) ⇒ Object
Enqueues a command to copy a Buffer into an Image using the CommandQueue
Attributes
-
src_buffer- the Buffer to be read from -
dst_image- the Image to be written to -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:dst_origin- if provided indicates the origin of the region to write into the Image, else [0, 0, 0] -
:region- if provided indicates the dimension of the region to copy, else the maximum region is copied -
:src_offset- if provided indicates the offset inside the Buffer, else 0
Returns
the Event associated with the command
1328 1329 1330 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1328 def enqueue_copy_buffer_to_image( src_buffer, dst_image, = {} ) return OpenCL.enqueue_copy_buffer_to_image( self, src_buffer, dst_image, ) end |
#enqueue_copy_image(src_image, dst_image, options = {}) ⇒ Object
Enqueues a command to copy from an Image into an Image using the CommandQueue
Attributes
-
src_image- the Image to be written to -
dst_image- the Image to be written to -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:src_origin- if provided indicates the origin of the region to read into the src Image, else [0, 0, 0] -
:dst_origin- if provided indicates the origin of the region to write into the dst Image, else [0, 0, 0] -
:region- if provided indicates the dimension of the region to copy, else the maximum region is copied
Returns
the Event associated with the command
1306 1307 1308 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1306 def enqueue_copy_image( src_image, dst_image, = {} ) return OpenCL.enqueue_copy_image( self, src_image, dst_image, ) end |
#enqueue_copy_image_to_buffer(src_image, dst_buffer, options = {}) ⇒ Object
Enqueues a command to copy an Image into a Buffer using the CommandQueue
Attributes
-
src_image- the Image to be read from -
dst_buffer- the Buffer to be written to -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:src_origin- if provided indicates the origin of the region to copy from the Image, else [0, 0, 0] -
:region- if provided indicates the dimension of the region to copy, else the maximum region is copied -
:dst_offset- if provided indicates the offset inside the Buffer, else 0
Returns
the Event associated with the command
1350 1351 1352 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1350 def enqueue_copy_image_to_buffer( src_image, dst_buffer, = {} ) return OpenCL.enqueue_copy_image_to_buffer( self, src_image, dst_buffer, ) end |
#enqueue_map_buffer(buffer, map_flags, options = {}) ⇒ Object
Enqueues a command to map a Buffer into host memory using the CommandQueue
Attributes
-
buffer- the Buffer object to map -
map_flags- a single or an Array of :cl_map_flags flags -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_map- if provided indicates if the command blocks until the region is mapped -
:blocking- if provided indicates if the command blocks until the region is mapped -
:offset- if provided the offset inside the Buffer region to map, else 0 -
:size- if provided the size of the region in the Buffer to map, else the largest possible size is used
Returns
an Array composed of [event, pointer] where:
-
event- the Event associated with the command -
pointer- a Pointer to the mapped memory region
1413 1414 1415 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1413 def enqueue_map_buffer( buffer, map_flags, = {} ) return OpenCL.enqueue_map_buffer( self, buffer, map_flags, ) end |
#enqueue_map_image(image, map_flags, options = {}) ⇒ Object
Enqueues a command to map an Image into host memory using the CommandQueue
Attributes
-
image- the Image object to map -
map_flags- a single or an Array of :cl_map_flags flags -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_map- if provided indicates if the command blocks until the region is mapped -
:blocking- if provided indicates if the command blocks until the region is mapped -
:origin- if provided the origin in the Image of the region to map, else [0, 0, 0] -
:region- if provided the region in the image to map, else the largest possible area is used
Returns
an Array composed of [event, pointer, image_row_pitch, image_slice_pitch] where:
-
event- the Event associated with the command -
pointer- a Pointer to the mapped memory region -
image_row_pitch- the row pitch of the mapped region -
image_slice_pitch- the slice pitch of the mapped region
1440 1441 1442 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1440 def enqueue_map_image( image, map_flags, = {} ) return OpenCL.enqueue_map_image( self, image, map_flags, ) end |
#enqueue_marker(events = []) ⇒ Object
Enqueues a marker using the CommandQueue
Attributes
-
events- an optional single or Array of Event to wait upon before the marker is considered finished, if not provided all previous command are waited for before the marker is considered finished (unavailable if implementation version < 1.2 )
Returns
an Event
1221 1222 1223 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1221 def enqueue_marker( events = [] ) return OpenCL.enqueue_marker( self, events ) end |
#enqueue_native_kernel(options = {}, &func) ⇒ Object
Enqueues a native kernel in the CommandQueue
Attributes
-
options- a hash containing named options -
func- a Proc object to execute
Options
-
:args- if provided, a list of arguments to pass to the kernel. Arguments should have a size method and be convertible to Pointer with to_ptr -
:mem_list- if provided, a hash containing Buffer objects and their index inside the argument list. -
:event_wait_list- if provided, a list of Event to wait upon before executing the command
Returns
the Event associated with the command
1479 1480 1481 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1479 def enqueue_native_kernel( = {}, &func ) return OpenCL.enqueue_native_kernel( self, , &func ) end |
#enqueue_ndrange_kernel(kernel, global_work_size, options = {}) ⇒ Object Also known as: enqueue_NDrange_kernel
Enqueues a kernel as a ndrange using the CommandQueue
Attributes
-
kernel- a Kernel object to execute -
global_work_size- dimensions of the work -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:local_work_size- if provided, dimensions of the local work group size -
:global_work_offset- if provided, offset inside the global work size
Returns
the Event associated with the command
1126 1127 1128 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1126 def enqueue_ndrange_kernel( kernel, global_work_size, = {} ) return OpenCL.enqueue_ndrange_kernel( self, kernel, global_work_size, ) end |
#enqueue_read_buffer(buffer, ptr, options = {}) ⇒ Object
Enqueues a command to read from a Buffer object to host memory using the CommandQueue
Attributes
-
buffer- the Buffer to be read from -
ptr- the Pointer (or convertible to Pointer using to_ptr) to the memory area to use -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_read- if provided indicates if the command blocks until the region is read -
:blocking- if provided indicates if the command blocks until the region is read -
:offset- if provided indicates the offset inside the Buffer of the area to read from, else 0 -
:size- if provided indicates the size of data to copy, else the maximum data is copied
Returns
the Event associated with the command
1173 1174 1175 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1173 def enqueue_read_buffer( buffer, ptr, = {} ) return OpenCL.enqueue_read_buffer( self, buffer, ptr, ) end |
#enqueue_read_image(image, ptr, options = {}) ⇒ Object
Enqueues a command to copy from an Image into host memory using the CommandQueue
Attributes
-
image- the Image to be written to -
ptr- the Pointer (or convertible to Pointer using to_ptr) to the memory area to use -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_read- if provided indicates if the command blocks until the region is read. -
:blocking- if provided indicates if the command blocks until the region is read -
:origin- if provided indicates the origin of the region to read from the Image, else [0, 0, 0] -
:region- if provided indicates the dimension of the region to copy, else the maximum region is copied -
:row_pitch- if provided indicates the row pitch inside the host area, else 0 -
:slice_pitch- if provided indicates the slice pitch inside the host area, else 0
Returns
the Event associated with the command
1284 1285 1286 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1284 def enqueue_read_image( image, ptr, = {} ) return OpenCL.enqueue_read_image( self, image, ptr, ) end |
#enqueue_release_gl_objects(mem_objects, options = {}) ⇒ Object Also known as: enqueue_release_GL_objects
Release OpenCL Mem objects that have been created from OpenGL objects and previously acquired using the CommandQueue
Attributes
-
mem_objects- a single or an Array of Mem objects -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command
Returns
the Event associated with the command
1387 1388 1389 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1387 def enqueue_release_gl_objects( mem_objects, = {} ) return OpenCL.enqueue_release_gl_objects( self, mem_objects, ) end |
#enqueue_task(kernel, options = {}) ⇒ Object
Enqueues a kernel as a task using the CommandQueue
Attributes
-
kernel- a Kernel object to execute -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command
Returns
the Event associated with the command
1105 1106 1107 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1105 def enqueue_task( kernel, = {} ) return OpenCL.enqueue_task( self, kernel, ) end |
#enqueue_unmap_mem_object(mem_obj, mapped_ptr, options = {}) ⇒ Object
Enqueues a command to unmap a previously mapped region of a memory object using the CommandQueue
Attributes
-
mem_obj- the Mem object that was previously mapped -
mapped_ptr- the Pointer previously returned by a map command -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command
Returns
the Event associated with the command
1459 1460 1461 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1459 def enqueue_unmap_mem_object( mem_obj, mapped_ptr, = {} ) return OpenCL.enqueue_unmap_mem_object( self, mem_obj, mapped_ptr, ) end |
#enqueue_wait_for_events(events = []) ⇒ Object
Enqueues a barrier on a list of envents using the CommandQueue
Attributes
-
events- a single or an Array of Event to wait upon before the barrier is considered finished
Returns
an Event if implementation version is >= 1.2, nil otherwise
1234 1235 1236 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1234 def enqueue_wait_for_events( events = [] ) return OpenCL.enqueue_wait_for_events( self, events ) end |
#enqueue_write_buffer(buffer, ptr, options = {}) ⇒ Object
Enqueues a command to write to a Buffer object from host memory using the CommandQueue
Attributes
-
buffer- the Buffer to be written to -
ptr- the Pointer (or convertible to Pointer using to_ptr) to the memory area to use -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_write- if provided indicates if the command blocks until the region is written. -
:blocking- if provided indicates if the command blocks until the region is written -
:offset- if provided indicates the offset inside the Buffer of the area to read from, else 0 -
:size- if provided indicates the size of data to copy, else the maximum data is copied
Returns
the Event associated with the command
1150 1151 1152 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1150 def enqueue_write_buffer( buffer, ptr, = {} ) return OpenCL.enqueue_write_buffer( self, buffer, ptr, ) end |
#enqueue_write_image(image, ptr, options = {}) ⇒ Object
Enqueues a command to copy from host memory into an Image using the CommandQueue
Attributes
-
image- the Image to be written to -
ptr- the Pointer (or convertible to Pointer using to_ptr) to the memory area to use -
options- a hash containing named options
Options
-
:event_wait_list- if provided, a list of Event to wait upon before executing the command -
:blocking_write- if provided indicates if the command blocks until the region is written. -
:blocking- if provided indicates if the command blocks until the region is written -
:origin- if provided indicates the origin of the region to write into the Image, else [0, 0, 0] -
:region- if provided indicates the dimension of the region to copy, else the maximum region is copied -
:input_row_pitch- if provided indicates the row pitch inside the host area, else 0 -
:input_slice_pitch- if provided indicates the slice pitch inside the host area, else 0
Returns
the Event associated with the command
1259 1260 1261 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1259 def enqueue_write_image( image, ptr, = {} ) return OpenCL.enqueue_write_image( self, image, ptr, ) end |
#finish ⇒ Object
Blocks until all the commands in the CommandQueue have completed
1484 1485 1486 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1484 def finish return OpenCL.finish(self) end |
#flush ⇒ Object
Issues all the commands in a CommandQueue to the Device
1489 1490 1491 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1489 def flush return OpenCL.flush( self ) end |
#inspect ⇒ Object
1067 1068 1069 1070 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1067 def inspect p = properties return "#<#{self.class.name}: -> #{device.inspect}#{ 0 != p.to_i ? " (#{p})" : ""}>" end |
#properties ⇒ Object
Returns the OpenCL::CommandQueue::properties info
1089 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1089 get_info("CommandQueue", :cl_command_queue_properties, "properties") |
#reference_count ⇒ Object
Returns the OpenCL::CommandQueue::reference_count info
1088 |
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 1088 get_info("CommandQueue", :cl_uint, "reference_count") |