Method: OpenCL.enqueue_read_buffer

Defined in:
lib/opencl_ruby_ffi/CommandQueue.rb

.enqueue_read_buffer(command_queue, buffer, ptr, options = {}) ⇒ Object

Enqueues a command to read from a Buffer object to host memory

Attributes

  • command_queue - CommandQueue used to execute the read command

  • 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



535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 535

def self.enqueue_read_buffer( command_queue, buffer, ptr, options = {} )
  blocking = FALSE
  blocking = TRUE if options[:blocking] or options[:blocking_read]
  offset = 0
  offset = options[:offset] if options[:offset]
  size = buffer.size - offset
  size = options[:size] if options[:size]
  num_events, events = get_event_wait_list( options )
  event = MemoryPointer::new( Event )
  error = clEnqueueReadBuffer(command_queue, buffer, blocking, offset, size, ptr, num_events, events, event)
  error_check(error)
  return Event::new(event.read_pointer, false)
end