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 ]
377 378 379 380 381 382 383 384 385 386 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 377 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
401 402 403 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 401 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
361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 361 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
358 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 358 get_info("Program", :size_t, "num_kernels") |