Method: OpenCL.enqueue_task

Defined in:
lib/opencl_ruby_ffi/CommandQueue.rb

.enqueue_task(command_queue, kernel, options = {}) ⇒ Object

Enqueues a kernel as a task

Attributes

  • command_queue - CommandQueue used to execute the command

  • 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



919
920
921
922
923
924
925
926
927
928
929
930
931
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 919

def self.enqueue_task( command_queue, kernel, options = {} )
  if command_queue.device.platform.version_number < 2.0 then
    num_events, events = get_event_wait_list( options )
    event = MemoryPointer::new( Event )
    error = clEnqueueTask( command_queue, kernel, num_events, events, event )
    error_check(error)
    return Event::new(event.read_pointer, false)
  else
    opts = options.dup
    opts[:local_work_size] = [1]
    return enqueue_ndrange_kernel( command_queue, kernel, [1], opts )
  end
end