Module: OpenCL::Device::OpenCL12
- Included in:
- OpenCL::Device
- Defined in:
- lib/opencl_ruby_ffi/Device.rb
Instance Method Summary collapse
-
#built_in_kernels ⇒ Object
Returns an Array of String corresponding to the Device built in kernel names.
-
#create_sub_devices(properties) ⇒ Object
Partitions the Device in serveral sub-devices.
-
#image_max_array_size ⇒ Object
Returns the OpenCL::Device::image_max_array_size info.
-
#image_max_buffer_size ⇒ Object
Returns the OpenCL::Device::image_max_buffer_size info.
-
#linker_available ⇒ Object
Returns the OpenCL::Device::linker_available info.
-
#parent_device ⇒ Object
Returns the parent Device if it exists.
-
#partition_affinity_domain ⇒ Object
Returns the OpenCL::Device::partition_affinity_domain info.
-
#partition_by_affinity_domain(affinity_domain = AFFINITY_DOMAIN_NEXT_PARTITIONABLE) ⇒ Object
Partitions the Device in serveral sub-devices by affinity domain.
-
#partition_by_counts(*compute_unit_count_list) ⇒ Object
Partitions the Device in serveral sub-devices each containing a specific number of compute units.
- #partition_by_names_intel(*compute_unit_name_list) ⇒ Object
-
#partition_equally(compute_unit_number = 1) ⇒ Object
Partitions the Device in serveral sub-devices containing compute_unit_number compute units.
-
#partition_max_sub_devices ⇒ Object
Returns the OpenCL::Device::partition_max_sub_devices info.
-
#partition_properties ⇒ Object
Returns the list of partition types supported by the Device.
-
#partition_type ⇒ Object
Returns a list of :cl_device_partition_property used to create the Device.
-
#preferred_interop_user_sync ⇒ Object
Returns the OpenCL::Device::preferred_interop_user_sync info.
-
#printf_buffer_size ⇒ Object
Returns the OpenCL::Device::printf_buffer_size info.
-
#reference_count ⇒ Object
Returns the OpenCL::Device::reference_count info.
Instance Method Details
#built_in_kernels ⇒ Object
Returns an Array of String corresponding to the Device built in kernel names
169 170 171 172 173 174 175 176 177 178 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 169 def built_in_kernels built_in_kernels_size = MemoryPointer::new( :size_t ) error = OpenCL.clGetDeviceInfo( self, BUILT_IN_KERNELS, 0, nil, built_in_kernels_size) error_check(error) ker = MemoryPointer::new( built_in_kernels_size.read_size_t ) error = OpenCL.clGetDeviceInfo( self, BUILT_IN_KERNELS, built_in_kernels_size.read_size_t, ker, nil) error_check(error) ker_string = ker.read_string return ker_string.split(";") end |
#create_sub_devices(properties) ⇒ Object
Partitions the Device in serveral sub-devices
Attributes
-
properties
- an Array of :cl_device_partition_property
Returns
an Array of Device
268 269 270 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 268 def create_sub_devices( properties ) return OpenCL.create_sub_devices( self, properties ) end |
#image_max_array_size ⇒ Object
Returns the OpenCL::Device::image_max_array_size info
181 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 181 get_info("Device", :size_t, "image_max_array_size") |
#image_max_buffer_size ⇒ Object
Returns the OpenCL::Device::image_max_buffer_size info
180 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 180 get_info("Device", :size_t, "image_max_buffer_size") |
#linker_available ⇒ Object
Returns the OpenCL::Device::linker_available info
182 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 182 get_info("Device", :cl_bool, "linker_available") |
#parent_device ⇒ Object
Returns the parent Device if it exists
185 186 187 188 189 190 191 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 185 def parent_device ptr = MemoryPointer::new( Device ) error = OpenCL.clGetDeviceInfo(self, PARENT_DEVICE, Device.size, ptr, nil) error_check(error) return nil if ptr.null? return Device::new(ptr.read_pointer) end |
#partition_affinity_domain ⇒ Object
Returns the OpenCL::Device::partition_affinity_domain info
210 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 210 get_info("Device", :cl_device_affinity_domain, "partition_affinity_domain") |
#partition_by_affinity_domain(affinity_domain = AFFINITY_DOMAIN_NEXT_PARTITIONABLE) ⇒ Object
Partitions the Device in serveral sub-devices by affinity domain
Attributes
-
affinity_domain
- the :cl_device_partition_property specifying the target affinity domain
Returns
an Array of Device
281 282 283 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 281 def partition_by_affinity_domain( affinity_domain = AFFINITY_DOMAIN_NEXT_PARTITIONABLE ) return OpenCL.create_sub_devices( self, [ PARTITION_BY_AFFINITY_DOMAIN, affinity_domain ] ) end |
#partition_by_counts(*compute_unit_count_list) ⇒ Object
Partitions the Device in serveral sub-devices each containing a specific number of compute units
Attributes
-
compute_unit_count_list
- an Array of compute unit counts
Returns
an Array of Device
307 308 309 310 311 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 307 def partition_by_counts( *compute_unit_count_list ) compute_unit_count_list = [1] if compute_unit_count_list == [] compute_unit_count_list.flatten! return OpenCL.create_sub_devices( self, [ PARTITION_BY_COUNTS] + compute_unit_count_list + [ PARTITION_BY_COUNTS_LIST_END ] ) end |
#partition_by_names_intel(*compute_unit_name_list) ⇒ Object
313 314 315 316 317 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 313 def partition_by_names_intel( *compute_unit_name_list ) compute_unit_name_list = [0] if compute_unit_name_list == [] compute_unit_name_list.flatten! return OpenCL.create_sub_devices( self, [ Partition::BY_NAMES_INTEL ] + compute_unit_name_list + [ Partition::BY_NAMES_LIST_END_INTEL ] ) end |
#partition_equally(compute_unit_number = 1) ⇒ Object
Partitions the Device in serveral sub-devices containing compute_unit_number compute units
Attributes
-
compute_unit_number
- the number of compute units in each sub-device
Returns
an Array of Device
294 295 296 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 294 def partition_equally( compute_unit_number = 1 ) return OpenCL.create_sub_devices( self, [ PARTITION_EQUALLY, compute_unit_number ] ) end |
#partition_max_sub_devices ⇒ Object
Returns the OpenCL::Device::partition_max_sub_devices info
193 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 193 get_info("Device", :cl_uint, "partition_max_sub_devices") |
#partition_properties ⇒ Object
Returns the list of partition types supported by the Device
198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 198 def partition_properties ptr1 = MemoryPointer::new( :size_t, 1) error = OpenCL.clGetDeviceInfo(self, PARTITION_PROPERTIES, 0, nil, ptr1) error_check(error) ptr2 = MemoryPointer::new( ptr1.read_size_t ) error = OpenCL.clGetDeviceInfo(self, PARTITION_PROPERTIES, ptr1.read_size_t, ptr2, nil) error_check(error) arr = ptr2.get_array_of_cl_device_partition_property(0, ptr1.read_size_t/ OpenCL.find_type(:cl_device_partition_property).size) arr.reject! { |e| e.null? } return arr.collect { |e| Partition::new(e.to_i) } end |
#partition_type ⇒ Object
Returns a list of :cl_device_partition_property used to create the Device
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 215 def partition_type ptr1 = MemoryPointer::new( :size_t, 1) error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPE, 0, nil, ptr1) error_check(error) ptr2 = MemoryPointer::new( ptr1.read_size_t ) error = OpenCL.clGetDeviceInfo(self, PARTITION_TYPE, ptr1.read_size_t, ptr2, nil) error_check(error) arr = ptr2.get_array_of_cl_device_partition_property(0, ptr1.read_size_t/ OpenCL.find_type(:cl_device_partition_property).size) return [] if arr.length == 0 ptype = arr.first.to_i arr_2 = [] arr_2.push( Partition::new(ptype) ) return arr_2 if arr.length == 1 case ptype when Partition::BY_NAMES_EXT i = 1 while arr[i].to_i - (0x1 << Pointer.size * 8) != Partition::BY_NAMES_LIST_END_EXT do arr_2.push( arr[i].to_i ) i += 1 return arr_2 if arr.length <= i end arr_2.push( Partition::new(Partition::BY_NAMES_LIST_END_EXT) ) arr_2.push( 0 ) when Partition::EQUALLY arr_2.push(arr[1].to_i) arr_2.push( 0 ) when Partition::BY_COUNTS i = 1 while arr[i].to_i != Partition::BY_COUNTS_LIST_END do arr_2.push( arr[i].to_i ) i += 1 return arr_2 if arr.length <= i end arr_2.push( Partition::new(Partition::BY_COUNTS_LIST_END) ) arr_2.push( 0 ) end return arr_2 end |
#preferred_interop_user_sync ⇒ Object
Returns the OpenCL::Device::preferred_interop_user_sync info
255 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 255 get_info("Device", :cl_bool, "preferred_interop_user_sync") |
#printf_buffer_size ⇒ Object
Returns the OpenCL::Device::printf_buffer_size info
254 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 254 get_info("Device", :size_t, "printf_buffer_size") |
#reference_count ⇒ Object
Returns the OpenCL::Device::reference_count info
256 |
# File 'lib/opencl_ruby_ffi/Device.rb', line 256 get_info("Device", :cl_uint, "reference_count") |