opencl_ruby_ffi 0.6 → 0.7
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.
| 
         @@ -102,6 +102,7 @@ module OpenCL 
     | 
|
| 
       102 
102 
     | 
    
         
             
              def self.enqueue_map_image( command_queue, image, map_flags, options = {} )
         
     | 
| 
       103 
103 
     | 
    
         
             
                blocking = OpenCL::FALSE
         
     | 
| 
       104 
104 
     | 
    
         
             
                blocking = OpenCL::TRUE if options[:blocking] or options[:blocking_map]
         
     | 
| 
      
 105 
     | 
    
         
            +
                flags = OpenCL.get_flags( {:flags => map_flags} )
         
     | 
| 
       105 
106 
     | 
    
         | 
| 
       106 
107 
     | 
    
         
             
                origin, region = OpenCL.get_origin_region( image, options, :origin, :region )
         
     | 
| 
       107 
108 
     | 
    
         | 
| 
         @@ -110,7 +111,7 @@ module OpenCL 
     | 
|
| 
       110 
111 
     | 
    
         
             
                image_slice_pitch = FFI::MemoryPointer::new( :size_t )
         
     | 
| 
       111 
112 
     | 
    
         
             
                event = FFI::MemoryPointer::new( OpenCL::Event )
         
     | 
| 
       112 
113 
     | 
    
         
             
                error = FFI::MemoryPointer::new( :cl_int )
         
     | 
| 
       113 
     | 
    
         
            -
                OpenCL.clEnqueueMapImage( command_queue, image, blocking,  
     | 
| 
      
 114 
     | 
    
         
            +
                OpenCL.clEnqueueMapImage( command_queue, image, blocking, flags, origin, region, image_row_pitch, image_slice_pitch, num_events, events, event, error )
         
     | 
| 
       114 
115 
     | 
    
         
             
                OpenCL.error_check( error.read_cl_int )
         
     | 
| 
       115 
116 
     | 
    
         
             
                ev = OpenCL::Event::new( event.read_ptr, false )
         
     | 
| 
       116 
117 
     | 
    
         
             
                return [ev, ptr, image_row_pitch.read_size_t, image_slice_pitch.read_size_t]
         
     | 
| 
         @@ -141,6 +142,8 @@ module OpenCL 
     | 
|
| 
       141 
142 
     | 
    
         
             
              def self.enqueue_map_buffer( command_queue, buffer, map_flags, options = {} )
         
     | 
| 
       142 
143 
     | 
    
         
             
                blocking = OpenCL::FALSE
         
     | 
| 
       143 
144 
     | 
    
         
             
                blocking = OpenCL::TRUE if options[:blocking] or options[:blocking_map]
         
     | 
| 
      
 145 
     | 
    
         
            +
                flags = OpenCL.get_flags( {:flags => map_flags} )
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
       144 
147 
     | 
    
         
             
                offset = 0
         
     | 
| 
       145 
148 
     | 
    
         
             
                offset = options[:offset] if options[:offset]
         
     | 
| 
       146 
149 
     | 
    
         
             
                size = buffer.size - offset
         
     | 
| 
         @@ -148,7 +151,7 @@ module OpenCL 
     | 
|
| 
       148 
151 
     | 
    
         
             
                num_events, events = OpenCL.get_event_wait_list( options )
         
     | 
| 
       149 
152 
     | 
    
         
             
                event = FFI::MemoryPointer::new( OpenCL::Event )
         
     | 
| 
       150 
153 
     | 
    
         
             
                error = FFI::MemoryPointer::new( :cl_int )
         
     | 
| 
       151 
     | 
    
         
            -
                ptr = OpenCL.clEnqueueMapBuffer( command_queue, buffer, blocking,  
     | 
| 
      
 154 
     | 
    
         
            +
                ptr = OpenCL.clEnqueueMapBuffer( command_queue, buffer, blocking, flags, offset, size, num_events, events, error )
         
     | 
| 
       152 
155 
     | 
    
         
             
                OpenCL.error_check( error.read_cl_int )
         
     | 
| 
       153 
156 
     | 
    
         
             
                ev = OpenCL::Event::new( event.read_ptr, false )
         
     | 
| 
       154 
157 
     | 
    
         
             
                return [ev, ptr]
         
     | 
| 
         @@ -14,14 +14,15 @@ module OpenCL 
     | 
|
| 
       14 
14 
     | 
    
         
             
              # * +:user_data+ - an FFI::Pointer or an object that can be converted into one using to_ptr. The pointer is passed to the callback.
         
     | 
| 
       15 
15 
     | 
    
         
             
              def self.create_context(devices, options = {}, &block)
         
     | 
| 
       16 
16 
     | 
    
         
             
                @@callbacks.push( block ) if block
         
     | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
       18 
     | 
    
         
            -
                 
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                devs = [devices].flatten
         
     | 
| 
      
 18 
     | 
    
         
            +
                pointer = FFI::MemoryPointer::new( Device, devs.size)
         
     | 
| 
      
 19 
     | 
    
         
            +
                devs.size.times { |indx|
         
     | 
| 
      
 20 
     | 
    
         
            +
                  pointer.put_pointer(indx, devs[indx])
         
     | 
| 
       20 
21 
     | 
    
         
             
                }
         
     | 
| 
       21 
22 
     | 
    
         
             
                properties = OpenCL.get_context_properties( options )
         
     | 
| 
       22 
23 
     | 
    
         
             
                user_data = options[:user_data]
         
     | 
| 
       23 
24 
     | 
    
         
             
                error = FFI::MemoryPointer::new( :cl_int )
         
     | 
| 
       24 
     | 
    
         
            -
                ptr = OpenCL.clCreateContext(properties,  
     | 
| 
      
 25 
     | 
    
         
            +
                ptr = OpenCL.clCreateContext(properties, devs.size, pointer, block, user_data, error)
         
     | 
| 
       25 
26 
     | 
    
         
             
                OpenCL.error_check(error.read_cl_int)
         
     | 
| 
       26 
27 
     | 
    
         
             
                return OpenCL::Context::new(ptr, false)
         
     | 
| 
       27 
28 
     | 
    
         
             
              end
         
     | 
| 
         @@ -10,7 +10,7 @@ module OpenCL 
     | 
|
| 
       10 
10 
     | 
    
         
             
              # ==== Returns
         
     | 
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              # an Array of Device
         
     | 
| 
       13 
     | 
    
         
            -
              def self.create_sub_devices( in_device, properties  
     | 
| 
      
 13 
     | 
    
         
            +
              def self.create_sub_devices( in_device, properties )
         
     | 
| 
       14 
14 
     | 
    
         
             
                OpenCL.error_check(OpenCL::INVALID_OPERATION) if in_device.platform.version_number < 1.2
         
     | 
| 
       15 
15 
     | 
    
         
             
                props = FFI::MemoryPointer::new( :cl_device_partition_property, properties.length + 1 )
         
     | 
| 
       16 
16 
     | 
    
         
             
                properties.each_with_index { |e,i|
         
     | 
| 
         @@ -189,7 +189,7 @@ module OpenCL 
     | 
|
| 
       189 
189 
     | 
    
         
             
              # * +strings+ - a single or an Array of String repesenting the program source code
         
     | 
| 
       190 
190 
     | 
    
         
             
              def self.create_program_with_source(context, strings)
         
     | 
| 
       191 
191 
     | 
    
         
             
                strs = nil
         
     | 
| 
       192 
     | 
    
         
            -
                if strings  
     | 
| 
      
 192 
     | 
    
         
            +
                if not strings then
         
     | 
| 
       193 
193 
     | 
    
         
             
                  raise OpenCL::Error::new(OpenCL::Error.getErrorString(OpenCL::Error::INVALID_VALUE))
         
     | 
| 
       194 
194 
     | 
    
         
             
                else
         
     | 
| 
       195 
195 
     | 
    
         
             
                  strs = [strings].flatten
         
     | 
    
        data/opencl_ruby_ffi.gemspec
    CHANGED
    
    
    
        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 
     | 
    
         
            +
              version: '0.7'
         
     | 
| 
       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- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-03-28 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: narray
         
     |