opencl_ruby_ffi 0.4 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,31 @@ module OpenCL
36
36
  DRIVER_VERSION = 0x102D
37
37
  # :startdoc:
38
38
 
39
- %w( BUILT_IN_KERNELS DRIVER_VERSION VERSION VENDOR PROFILE OPENCL_C_VERSION NAME EXTENSIONS ).each { |prop|
39
+ # Returns an Array of String corresponding to the Device extensions
40
+ def extensions
41
+ extensions_size = FFI::MemoryPointer::new( :size_t )
42
+ error = OpenCL.clGetDeviceInfo( self, OpenCL::Device::EXTENSIONS, 0, nil, extensions_size)
43
+ OpenCL.error_check(error)
44
+ ext = FFI::MemoryPointer::new( extensions_size.read_size_t )
45
+ error = OpenCL.clGetDeviceInfo( self, OpenCL::Device::EXTENSIONS, extensions_size.read_size_t, ext, nil)
46
+ OpenCL.error_check(error)
47
+ ext_string = ext.read_string
48
+ return ext_string.split(" ")
49
+ end
50
+
51
+ # Returns an Array of String corresponding to the Device built in kernel names
52
+ def built_in_kernels
53
+ built_in_kernels_size = FFI::MemoryPointer::new( :size_t )
54
+ error = OpenCL.clGetDeviceInfo( self, OpenCL::Device::BUILT_IN_KERNELS, 0, nil, built_in_kernels_size)
55
+ OpenCL.error_check(error)
56
+ ker = FFI::MemoryPointer::new( built_in_kernels_size.read_size_t )
57
+ error = OpenCL.clGetDeviceInfo( self, OpenCL::Device::BUILT_IN_KERNELS, built_in_kernels_size.read_size_t, ker, nil)
58
+ OpenCL.error_check(error)
59
+ ker_string = ext.read_string
60
+ return ker_string.split(";")
61
+ end
62
+
63
+ %w( BUILT_IN_KERNELS DRIVER_VERSION VERSION VENDOR PROFILE OPENCL_C_VERSION NAME ).each { |prop|
40
64
  eval OpenCL.get_info("Device", :string, prop)
41
65
  }
42
66
 
@@ -68,10 +68,38 @@ module OpenCL
68
68
 
69
69
  # Maps the cl_platform_id object of OpenCL
70
70
  class Platform
71
- %w(PROFILE VERSION NAME VENDOR EXTENSIONS).each { |prop|
71
+
72
+ ##
73
+ # :method: profile()
74
+ # Returns a String containing the profile name supported by the Platform
75
+
76
+ ##
77
+ # :method: version()
78
+ # Returns a String containing the version number
79
+
80
+ ##
81
+ # :method: name()
82
+ # Returns a String containing the Platform name
83
+
84
+ ##
85
+ # :mathod: vendor()
86
+ # Returns a String identifying the Platform vendor
87
+ %w(PROFILE VERSION NAME VENDOR).each { |prop|
72
88
  eval OpenCL.get_info("Platform", :string, prop)
73
89
  }
74
90
 
91
+ # Returns an Array of string corresponding to the Platform extensions
92
+ def extensions
93
+ extensions_size = FFI::MemoryPointer::new( :size_t )
94
+ error = OpenCL.clGetPlatformInfo( self, OpenCL::Platform::EXTENSIONS, 0, nil, extensions_size)
95
+ OpenCL.error_check(error)
96
+ ext = FFI::MemoryPointer::new( extensions_size.read_size_t )
97
+ error = OpenCL.clGetPlatformInfo( self, OpenCL::Platform::EXTENSIONS, extensions_size.read_size_t, ext, nil)
98
+ OpenCL.error_check(error)
99
+ ext_string = ext.read_string
100
+ return ext_string.split(" ")
101
+ end
102
+
75
103
  # Returns an Array of Device corresponding to the available devices on the Platform
76
104
  # The type of the desired devices can be specified
77
105
  def devices(type = OpenCL::Device::Type::ALL)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'opencl_ruby_ffi'
3
- s.version = "0.4"
3
+ s.version = "0.5"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://forge.imag.fr/projects/opencl-ruby/"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencl_ruby_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-24 00:00:00.000000000 Z
12
+ date: 2014-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: narray