Module: OpenCL::Kernel::OpenCL12

Included in:
OpenCL::Kernel
Defined in:
lib/opencl_ruby_ffi/Kernel.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject

returns a String containing the attributes qualifier used at kernel definition



297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/opencl_ruby_ffi/Kernel.rb', line 297

def attributes
  @_attributes ||= begin
    attributes_size = MemoryPointer::new( :size_t )
    error = OpenCL.clGetKernelInfo( self, ATTRIBUTES, 0, nil, attributes_size)
    error_check(error)
    attr = MemoryPointer::new( attributes_size.read_size_t )
    error = OpenCL.clGetKernelInfo( self, ATTRIBUTES, attributes_size.read_size_t, attr, nil)
    error_check(error)
    attr_string = attr.read_string
    attr_string.split(" ")
  end
end

#global_work_size(device = program.devices.first) ⇒ Object



310
311
312
313
314
315
# File 'lib/opencl_ruby_ffi/Kernel.rb', line 310

def global_work_size(device = program.devices.first)
  ptr = MemoryPointer::new( :size_t, 3 )
  error = OpenCL.clGetKernelWorkGroupInfo(self, device, GLOBAL_WORK_SIZE, ptr.size, ptr, nil)
  error_check(error)
  return ptr.get_array_of_size_t(0,3)
end