Module: OpenCL::Program::OpenCL12
- Included in:
- OpenCL::Program
- Defined in:
- lib/opencl_ruby_ffi/Program.rb
Instance Method Summary collapse
-
#binary_type(devs = nil) ⇒ Object
Returns the BinaryType for each Device associated to the Program or the Device(s) specified.
-
#compile(options = {}, &block) ⇒ Object
Compiles the Program' sources.
-
#kernel_names ⇒ Object
Returns an Array of String representing the Kernel names inside the Program.
-
#num_kernels ⇒ Object
Returns the OpenCL::Program::num_kernels info.
Instance Method Details
#binary_type(devs = nil) ⇒ Object
Returns the BinaryType for each Device associated to the Program or the Device(s) specified. Returns an Array of tuple [ Device, BinaryType ]
457 458 459 460 461 462 463 464 465 466 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 457 def binary_type(devs = nil) devs = self.devices if not devs devs = [devs].flatten ptr = MemoryPointer::new( :cl_program_binary_type ) return devs.collect { |dev| error = OpenCL.clGetProgramBuildInfo(self, dev, BINARY_TYPE, ptr.size, ptr, nil) error_check(error) [dev, BinaryType::new(ptr.read_cl_program_binary_type)] } end |
#compile(options = {}, &block) ⇒ Object
Compiles the Program' sources
Attributes
-
options
- a Hash containing named options -
block
- if provided, a callback invoked when the Program is compiled. Signature of the callback is { |Program, Pointer to user_data| … }
Options
-
:device_list
- an Array of Device to build the program for -
:user_data
- a Pointer (or convertible to Pointer using to_ptr) to the memory area to pass to the callback -
:options
- a String containing the options to use for the compilation -
:input_headers
- a Hash containing pairs of : String: header_include_name => Program: header
481 482 483 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 481 def compile( = {}, &block) return OpenCL.compile_program(self, , &block) end |
#kernel_names ⇒ Object
Returns an Array of String representing the Kernel names inside the Program
441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 441 def kernel_names if context.platform.version_number < 1.2 then return kernels.collect(&:name) else kernel_names_size = MemoryPointer::new( :size_t ) error = OpenCL.clGetProgramInfo( self, KERNEL_NAMES, 0, nil, kernel_names_size) error_check(error) k_names = MemoryPointer::new( kernel_names_size.read_size_t ) error = OpenCL.clGetProgramInfo( self, KERNEL_NAMES, kernel_names_size.read_size_t, k_names, nil) error_check(error) k_names_string = k_names.read_string return k_names_string.split(";") end end |
#num_kernels ⇒ Object
Returns the OpenCL::Program::num_kernels info
438 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 438 get_info("Program", :size_t, "num_kernels") |