opencl_ruby_ffi 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 409ed20eac2dc9aa0d410563053699e18528cd62471903fd862ee2f31bb60a81
4
- data.tar.gz: 670b281a4ab283be7a8c429474008e9e280987e8d81bc5222a853c32a10a569b
3
+ metadata.gz: 5b82499588d782647276b70a17225849c4468bb0c3619191fcba4bb15729318a
4
+ data.tar.gz: 3b015990606ee221a9e7288b2f1b99bfdae814ae3016f8142fb1044df3b3ec3b
5
5
  SHA512:
6
- metadata.gz: 9301ea0a86feed2d72684a63366ad1b6862cd8238497854b768044814940c3f7ec39a7badfa11d56cead96d0c01fddb64092b56d1399d5a8395ce6d9305754f9
7
- data.tar.gz: 8fa725c1e61931b3d9cdff0cf5d557055398ecf058d56289a72bca1ee3d2e54f80d279266e2185177ac59f9386f32422054e6437e19f23f452a65c060c45fe0c
6
+ metadata.gz: 28148b57ac0b7cf8e8b619ed50e94c0bf5af77cfebad6fdae788efc23e90850bfe439a64f50270573367729a7fd47751a1fe3d75e8dd5b0405c9ffeb2b4012f6
7
+ data.tar.gz: 6b11039332b1c93141c350ab5b0a642521d0019e5bc1670af22daad333d85a4f32db8fa18d7bba5d2032944300ecdba6167903f623661f448b74fe45bd4a6948
@@ -2,6 +2,7 @@ require "opencl_ruby_ffi/opencl_types.rb"
2
2
  require "opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb"
3
3
  require "opencl_ruby_ffi/opencl_arithmetic_gen.rb"
4
4
  require "opencl_ruby_ffi/opencl_ruby_ffi_base.rb"
5
+ require "opencl_ruby_ffi/opencl_ruby_ffi_library.rb"
5
6
  require "opencl_ruby_ffi/Context.rb"
6
7
  require "opencl_ruby_ffi/Platform.rb"
7
8
  require "opencl_ruby_ffi/Device.rb"
@@ -47,13 +47,13 @@ module OpenCL
47
47
  end
48
48
 
49
49
  # Creates a new ImageFormat from an image channel order and data type
50
- def initialize( image_channel_order, image_channel_data_type = nil )
51
- if image_channel_order.is_a?(FFI::Pointer) and image_channel_data_type.nil? then
50
+ def initialize( image_channel_order = nil, image_channel_data_type = nil )
51
+ if image_channel_order.is_a?(FFI::Pointer) then
52
52
  super(image_channel_order)
53
53
  else
54
54
  super()
55
- self[:image_channel_order] = image_channel_order
56
- self[:image_channel_data_type] = image_channel_data_type
55
+ self[:image_channel_order] = image_channel_order if image_channel_order
56
+ self[:image_channel_data_type] = image_channel_data_type if image_channel_data_type
57
57
  end
58
58
  end
59
59
 
@@ -98,18 +98,22 @@ module OpenCL
98
98
  :buffer, Mem.ptr
99
99
 
100
100
  # Creates anew ImageDesc using the values provided by the user
101
- def initialize( image_type, image_width, image_height, image_depth, image_array_size, image_row_pitch, image_slice_pitch, num_mip_levels, num_samples, buffer )
102
- super()
103
- self[:image_type] = image_type
104
- self[:image_width] = image_width
105
- self[:image_height] = image_height
106
- self[:image_depth] = image_depth
107
- self[:image_array_size] = image_array_size
108
- self[:image_row_pitch] = image_row_pitch
109
- self[:image_slice_pitch] = image_slice_pitch
110
- self[:num_mip_levels] = num_mip_levels
111
- self[:num_samples] = num_samples
112
- self[:buffer] = buffer
101
+ def initialize( image_type = nil, image_width = nil, image_height = nil, image_depth = nil, image_array_size = nil, image_row_pitch = nil, image_slice_pitch = nil, num_mip_levels = nil, num_samples = nil, buffer = nil )
102
+ if (image_type.is_a?(FFI::Pointer))
103
+ super(image_type)
104
+ else
105
+ super()
106
+ self[:image_type] = image_type if image_type
107
+ self[:image_width] = image_width if image_width
108
+ self[:image_height] = image_height if image_height
109
+ self[:image_depth] = image_depth if image_depth
110
+ self[:image_array_size] = image_array_size if image_array_size
111
+ self[:image_row_pitch] = image_row_pitch if image_row_pitch
112
+ self[:image_slice_pitch] = image_slice_pitch if image_slice_pitch
113
+ self[:num_mip_levels] = num_mip_levels if num_mip_levels
114
+ self[:num_samples] = num_samples if num_samples
115
+ self[:buffer] = buffer if buffer
116
+ end
113
117
  end
114
118
  end
115
119
 
@@ -119,10 +123,14 @@ module OpenCL
119
123
  :size, :size_t
120
124
 
121
125
  # Creates a new BufferRegion using the value provided by the user
122
- def initialize( origin, sz )
123
- super()
124
- self[:origin] = origin
125
- self[:size] = sz
126
+ def initialize( origin = nil, sz = nil )
127
+ if (origin.is_a?(FFI::Pointer))
128
+ super(origin)
129
+ else
130
+ super()
131
+ self[:origin] = origin if origin
132
+ self[:size] = sz if sz
133
+ end
126
134
  end
127
135
  end
128
136
 
@@ -1,27 +1,6 @@
1
1
  using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
2
2
  # Maps the OpenCL API using FFI
3
3
  module OpenCL
4
- begin
5
- if ENV["LIBOPENCL_SO"]
6
- ffi_lib ENV["LIBOPENCL_SO"]
7
- else
8
- raise LoadError
9
- end
10
- rescue LoadError => e
11
- begin
12
- ffi_lib "OpenCL"
13
- rescue LoadError => e
14
- begin
15
- ffi_lib "libOpenCL.so.1"
16
- rescue LoadError => e
17
- begin
18
- ffi_lib '/System/Library/Frameworks/OpenCL.framework/OpenCL'
19
- rescue LoadError => e
20
- raise "OpenCL implementation not found!"
21
- end
22
- end
23
- end
24
- end
25
4
  SUCCESS = 0
26
5
  DEVICE_NOT_FOUND = -1
27
6
  DEVICE_NOT_AVAILABLE = -2
@@ -1920,161 +1899,4 @@ EOF
1920
1899
  MAX_PACKETS = 0x1121
1921
1900
  PROPERTIES = 0x1122
1922
1901
  end
1923
- attach_function :clGetPlatformIDs, [:cl_uint,:pointer,:pointer], :cl_int
1924
- attach_function :clGetPlatformInfo, [Platform,:cl_platform_info,:size_t,:pointer,:pointer], :cl_int
1925
- attach_function :clGetDeviceIDs, [Platform,:cl_device_type,:cl_uint,:pointer,:pointer], :cl_int
1926
- attach_function :clGetDeviceInfo, [Device,:cl_device_info,:size_t,:pointer,:pointer], :cl_int
1927
- callback :clCreateContext_notify, [:string,:pointer,:size_t,:pointer], :void
1928
- attach_function :clCreateContext, [:pointer,:cl_uint,:pointer,:clCreateContext_notify,:pointer,:pointer], Context
1929
- callback :clCreateContextFromType_notify, [:string,:pointer,:size_t,:pointer], :void
1930
- attach_function :clCreateContextFromType, [:pointer,:cl_device_type,:clCreateContextFromType_notify,:pointer,:pointer], Context
1931
- attach_function :clRetainContext, [Context], :cl_int
1932
- attach_function :clReleaseContext, [Context], :cl_int
1933
- attach_function :clGetContextInfo, [Context,:cl_context_info,:size_t,:pointer,:pointer], :cl_int
1934
- attach_function :clRetainCommandQueue, [CommandQueue], :cl_int
1935
- attach_function :clReleaseCommandQueue, [CommandQueue], :cl_int
1936
- attach_function :clGetCommandQueueInfo, [CommandQueue,:cl_command_queue_info,:size_t,:pointer,:pointer], :cl_int
1937
- attach_function :clCreateBuffer, [Context,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
1938
- attach_function :clRetainMemObject, [Mem], :cl_int
1939
- attach_function :clReleaseMemObject, [Mem], :cl_int
1940
- attach_function :clGetSupportedImageFormats, [Context,:cl_mem_flags,:cl_mem_object_type,:cl_uint,:pointer,:pointer], :cl_int
1941
- attach_function :clGetMemObjectInfo, [Mem,:cl_mem_info,:size_t,:pointer,:pointer], :cl_int
1942
- attach_function :clGetImageInfo, [Mem,:cl_image_info,:size_t,:pointer,:pointer], :cl_int
1943
- attach_function :clRetainSampler, [Sampler], :cl_int
1944
- attach_function :clReleaseSampler, [Sampler], :cl_int
1945
- attach_function :clGetSamplerInfo, [Sampler,:cl_sampler_info,:size_t,:pointer,:pointer], :cl_int
1946
- attach_function :clCreateProgramWithSource, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
1947
- attach_function :clCreateProgramWithBinary, [Context,:cl_uint,:pointer,:pointer,:pointer,:pointer,:pointer], Program
1948
- attach_function :clRetainProgram, [Program], :cl_int
1949
- attach_function :clReleaseProgram, [Program], :cl_int
1950
- callback :clBuildProgram_notify, [Program.by_ref,:pointer], :void
1951
- attach_function :clBuildProgram, [Program,:cl_uint,:pointer,:pointer,:clBuildProgram_notify,:pointer], :cl_int
1952
- attach_function :clGetProgramInfo, [Program,:cl_program_info,:size_t,:pointer,:pointer], :cl_int
1953
- attach_function :clGetProgramBuildInfo, [Program,Device,:cl_program_build_info,:size_t,:pointer,:pointer], :cl_int
1954
- attach_function :clCreateKernel, [Program,:pointer,:pointer], Kernel
1955
- attach_function :clCreateKernelsInProgram, [Program,:cl_uint,:pointer,:pointer], :cl_int
1956
- attach_function :clRetainKernel, [Kernel], :cl_int
1957
- attach_function :clReleaseKernel, [Kernel], :cl_int
1958
- attach_function :clSetKernelArg, [Kernel,:cl_uint,:size_t,:pointer], :cl_int
1959
- attach_function :clGetKernelInfo, [Kernel,:cl_kernel_info,:size_t,:pointer,:pointer], :cl_int
1960
- attach_function :clGetKernelWorkGroupInfo, [Kernel,Device,:cl_kernel_work_group_info,:size_t,:pointer,:pointer], :cl_int
1961
- attach_function :clWaitForEvents, [:cl_uint,:pointer], :cl_int
1962
- attach_function :clGetEventInfo, [Event,:cl_event_info,:size_t,:pointer,:pointer], :cl_int
1963
- attach_function :clRetainEvent, [Event], :cl_int
1964
- attach_function :clReleaseEvent, [Event], :cl_int
1965
- attach_function :clGetEventProfilingInfo, [Event,:cl_profiling_info,:size_t,:pointer,:pointer], :cl_int
1966
- attach_function :clFlush, [CommandQueue], :cl_int
1967
- attach_function :clFinish, [CommandQueue], :cl_int
1968
- attach_function :clEnqueueReadBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1969
- attach_function :clEnqueueWriteBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1970
- attach_function :clEnqueueCopyBuffer, [CommandQueue,Mem,Mem,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1971
- attach_function :clEnqueueReadImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1972
- attach_function :clEnqueueWriteImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1973
- attach_function :clEnqueueCopyImage, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1974
- attach_function :clEnqueueCopyImageToBuffer, [CommandQueue,Mem,Mem,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1975
- attach_function :clEnqueueCopyBufferToImage, [CommandQueue,Mem,Mem,:size_t,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1976
- attach_function :clEnqueueMapBuffer, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:size_t,:size_t,:cl_uint,:pointer,:pointer,:pointer], :pointer
1977
- attach_function :clEnqueueMapImage, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:pointer,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer,:pointer], :pointer
1978
- attach_function :clEnqueueUnmapMemObject, [CommandQueue,Mem,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1979
- attach_function :clEnqueueNDRangeKernel, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1980
- callback :clEnqueueNativeKernel_notify, [:pointer], :void
1981
- attach_function :clEnqueueNativeKernel, [CommandQueue,:clEnqueueNativeKernel_notify,:pointer,:size_t,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1982
- attach_function :clCreateImage2D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
1983
- attach_function :clCreateImage3D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
1984
- attach_function :clEnqueueMarker, [CommandQueue,:pointer], :cl_int
1985
- attach_function :clEnqueueWaitForEvents, [CommandQueue,:cl_uint,:pointer], :cl_int
1986
- attach_function :clEnqueueBarrier, [CommandQueue], :cl_int
1987
- attach_function :clUnloadCompiler, [:void], :cl_int
1988
- attach_function :clGetExtensionFunctionAddress, [:pointer], :pointer
1989
- attach_function :clCreateCommandQueue, [Context,Device,:cl_command_queue_properties,:pointer], CommandQueue
1990
- attach_function :clCreateSampler, [Context,:cl_bool,:cl_addressing_mode,:cl_filter_mode,:pointer], Sampler
1991
- attach_function :clEnqueueTask, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer], :cl_int
1992
- attach_function :clCreateFromGLBuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
1993
- attach_function :clCreateFromGLRenderbuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
1994
- attach_function :clGetGLObjectInfo, [Mem,:pointer,:pointer], :cl_int
1995
- attach_function :clGetGLTextureInfo, [Mem,:cl_gl_texture_info,:size_t,:pointer,:pointer], :cl_int
1996
- attach_function :clEnqueueAcquireGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1997
- attach_function :clEnqueueReleaseGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1998
- attach_function :clCreateFromGLTexture2D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
1999
- attach_function :clCreateFromGLTexture3D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
2000
- begin # OpenCL 1.1
2001
- attach_function :clCreateSubBuffer, [Mem,:cl_mem_flags,:cl_buffer_create_type,:pointer,:pointer], Mem
2002
- attach_function :clEnqueueReadBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2003
- attach_function :clEnqueueWriteBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2004
- attach_function :clEnqueueCopyBufferRect, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
2005
- callback :clSetMemObjectDestructorCallback_notify, [:pointer,:pointer], :void
2006
- attach_function :clSetMemObjectDestructorCallback, [Mem,:clSetMemObjectDestructorCallback_notify,:pointer], :cl_int
2007
- attach_function :clCreateUserEvent, [Context,:pointer], Event
2008
- attach_function :clSetUserEventStatus, [Event,:cl_int], :cl_int
2009
- callback :clSetEventCallback_notify, [Event.by_ref,:cl_int,:pointer], :void
2010
- attach_function :clSetEventCallback, [Event,:cl_int,:clSetEventCallback_notify,:pointer], :cl_int
2011
- begin # OpenCL 1.2
2012
- attach_function :clCreateSubDevices, [Device,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2013
- attach_function :clRetainDevice, [Device], :cl_int
2014
- attach_function :clReleaseDevice, [Device], :cl_int
2015
- attach_function :clCreateImage, [Context,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
2016
- attach_function :clCreateProgramWithBuiltInKernels, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
2017
- callback :clCompileProgram_notify, [Program.by_ref,:pointer], :void
2018
- attach_function :clCompileProgram, [Program,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer,:clCompileProgram_notify,:pointer], :cl_int
2019
- callback :clLinkProgram_notify, [Program.by_ref,:pointer], :void
2020
- attach_function :clLinkProgram, [Context,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:clLinkProgram_notify,:pointer,:pointer], Program
2021
- attach_function :clUnloadPlatformCompiler, [Platform], :cl_int
2022
- attach_function :clGetKernelArgInfo, [Kernel,:cl_uint,:cl_kernel_arg_info,:size_t,:pointer,:pointer], :cl_int
2023
- attach_function :clEnqueueFillBuffer, [CommandQueue,Mem,:pointer,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
2024
- attach_function :clEnqueueFillImage, [CommandQueue,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2025
- attach_function :clEnqueueMigrateMemObjects, [CommandQueue,:cl_uint,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
2026
- attach_function :clEnqueueMarkerWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
2027
- attach_function :clEnqueueBarrierWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
2028
- attach_function :clGetExtensionFunctionAddressForPlatform, [Platform,:pointer], :pointer
2029
- attach_function :clCreateFromGLTexture, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
2030
- begin # OpenCL 2.0
2031
- attach_function :clCreateCommandQueueWithProperties, [Context,Device,:pointer,:pointer], CommandQueue
2032
- attach_function :clCreatePipe, [Context,:cl_mem_flags,:cl_uint,:cl_uint,:pointer,:pointer], Mem
2033
- attach_function :clGetPipeInfo, [Mem,:cl_pipe_info,:size_t,:pointer,:pointer], :cl_int
2034
- attach_function :clSVMAlloc, [Context,:cl_svm_mem_flags,:size_t,:cl_uint], :pointer
2035
- attach_function :clSVMFree, [Context,:pointer], :void
2036
- attach_function :clCreateSamplerWithProperties, [Context,:pointer,:pointer], Sampler
2037
- attach_function :clSetKernelArgSVMPointer, [Kernel,:cl_uint,:pointer], :cl_int
2038
- attach_function :clSetKernelExecInfo, [Kernel,:cl_kernel_exec_info,:size_t,:pointer], :cl_int
2039
- callback :clEnqueueSVMFree_notify, [CommandQueue.by_ref,:cl_uint,:pointer,:pointer], :void
2040
- attach_function :clEnqueueSVMFree, [CommandQueue,:cl_uint,:pointer,:clEnqueueSVMFree_notify,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2041
- attach_function :clEnqueueSVMMemcpy, [CommandQueue,:cl_bool,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
2042
- attach_function :clEnqueueSVMMemFill, [CommandQueue,:pointer,:pointer,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
2043
- attach_function :clEnqueueSVMMap, [CommandQueue,:cl_bool,:cl_map_flags,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
2044
- attach_function :clEnqueueSVMUnmap, [CommandQueue,:pointer,:cl_uint,:pointer,:pointer], :cl_int
2045
- begin # OpenCL 2.1
2046
- attach_function :clSetDefaultDeviceCommandQueue, [Context,Device,CommandQueue], :cl_int
2047
- attach_function :clGetDeviceAndHostTimer, [Device,:pointer,:pointer], :cl_int
2048
- attach_function :clGetHostTimer, [Device,:pointer], :cl_int
2049
- attach_function :clCreateProgramWithIL, [Context,:pointer,:size_t,:pointer], Program
2050
- attach_function :clCloneKernel, [Kernel,:pointer], Kernel
2051
- attach_function :clGetKernelSubGroupInfo, [Kernel,Device,:cl_kernel_sub_group_info,:size_t,:pointer,:size_t,:pointer,:pointer], :cl_int
2052
- attach_function :clEnqueueSVMMigrateMem, [CommandQueue,:cl_uint,:pointer,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
2053
- begin # OpenCL 2.2
2054
- callback :clSetProgramReleaseCallback_notify, [Program.by_ref,:pointer], :void
2055
- attach_function :clSetProgramReleaseCallback, [Program,:clSetProgramReleaseCallback_notify,:pointer], :cl_int
2056
- attach_function :clSetProgramSpecializationConstant, [Program,:cl_uint,:size_t,:pointer], :cl_int
2057
- begin # OpenCL 3.0
2058
- attach_function :clCreateBufferWithProperties, [Context,:pointer,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
2059
- attach_function :clCreateImageWithProperties, [Context,:pointer,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
2060
- callback :clSetContextDestructorCallback_notify, [Context.by_ref,:pointer], :void
2061
- attach_function :clSetContextDestructorCallback, [Context,:clSetContextDestructorCallback_notify,:pointer], :cl_int
2062
- rescue NotFoundError => e
2063
- warn "Warning OpenCL 2.2 loader detected!"
2064
- end
2065
- rescue NotFoundError => e
2066
- warn "Warning OpenCL 2.1 loader detected!"
2067
- end
2068
- rescue NotFoundError => e
2069
- warn "Warning OpenCL 2.0 loader detected!"
2070
- end
2071
- rescue NotFoundError => e
2072
- warn "Warning OpenCL 1.2 loader detected!"
2073
- end
2074
- rescue NotFoundError => e
2075
- warn "Warning OpenCL 1.1 loader detected!"
2076
- end
2077
- rescue NotFoundError => e
2078
- warn "Warning OpenCL 1.0 loader detected!"
2079
- end
2080
1902
  end
@@ -0,0 +1,181 @@
1
+ using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
2
+ module OpenCL
3
+ begin
4
+ if ENV["LIBOPENCL_SO"]
5
+ ffi_lib ENV["LIBOPENCL_SO"]
6
+ else
7
+ raise LoadError
8
+ end
9
+ rescue LoadError => e
10
+ begin
11
+ ffi_lib "OpenCL"
12
+ rescue LoadError => e
13
+ begin
14
+ ffi_lib "libOpenCL.so.1"
15
+ rescue LoadError => e
16
+ begin
17
+ ffi_lib '/System/Library/Frameworks/OpenCL.framework/OpenCL'
18
+ rescue LoadError => e
19
+ raise "OpenCL implementation not found!"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ attach_function :clGetPlatformIDs, [:cl_uint,:pointer,:pointer], :cl_int
25
+ attach_function :clGetPlatformInfo, [Platform,:cl_platform_info,:size_t,:pointer,:pointer], :cl_int
26
+ attach_function :clGetDeviceIDs, [Platform,:cl_device_type,:cl_uint,:pointer,:pointer], :cl_int
27
+ attach_function :clGetDeviceInfo, [Device,:cl_device_info,:size_t,:pointer,:pointer], :cl_int
28
+ callback :clCreateContext_notify, [:string,:pointer,:size_t,:pointer], :void
29
+ attach_function :clCreateContext, [:pointer,:cl_uint,:pointer,:clCreateContext_notify,:pointer,:pointer], Context
30
+ callback :clCreateContextFromType_notify, [:string,:pointer,:size_t,:pointer], :void
31
+ attach_function :clCreateContextFromType, [:pointer,:cl_device_type,:clCreateContextFromType_notify,:pointer,:pointer], Context
32
+ attach_function :clRetainContext, [Context], :cl_int
33
+ attach_function :clReleaseContext, [Context], :cl_int
34
+ attach_function :clGetContextInfo, [Context,:cl_context_info,:size_t,:pointer,:pointer], :cl_int
35
+ attach_function :clRetainCommandQueue, [CommandQueue], :cl_int
36
+ attach_function :clReleaseCommandQueue, [CommandQueue], :cl_int
37
+ attach_function :clGetCommandQueueInfo, [CommandQueue,:cl_command_queue_info,:size_t,:pointer,:pointer], :cl_int
38
+ attach_function :clCreateBuffer, [Context,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
39
+ attach_function :clRetainMemObject, [Mem], :cl_int
40
+ attach_function :clReleaseMemObject, [Mem], :cl_int
41
+ attach_function :clGetSupportedImageFormats, [Context,:cl_mem_flags,:cl_mem_object_type,:cl_uint,:pointer,:pointer], :cl_int
42
+ attach_function :clGetMemObjectInfo, [Mem,:cl_mem_info,:size_t,:pointer,:pointer], :cl_int
43
+ attach_function :clGetImageInfo, [Mem,:cl_image_info,:size_t,:pointer,:pointer], :cl_int
44
+ attach_function :clRetainSampler, [Sampler], :cl_int
45
+ attach_function :clReleaseSampler, [Sampler], :cl_int
46
+ attach_function :clGetSamplerInfo, [Sampler,:cl_sampler_info,:size_t,:pointer,:pointer], :cl_int
47
+ attach_function :clCreateProgramWithSource, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
48
+ attach_function :clCreateProgramWithBinary, [Context,:cl_uint,:pointer,:pointer,:pointer,:pointer,:pointer], Program
49
+ attach_function :clRetainProgram, [Program], :cl_int
50
+ attach_function :clReleaseProgram, [Program], :cl_int
51
+ callback :clBuildProgram_notify, [Program.by_ref,:pointer], :void
52
+ attach_function :clBuildProgram, [Program,:cl_uint,:pointer,:pointer,:clBuildProgram_notify,:pointer], :cl_int
53
+ attach_function :clGetProgramInfo, [Program,:cl_program_info,:size_t,:pointer,:pointer], :cl_int
54
+ attach_function :clGetProgramBuildInfo, [Program,Device,:cl_program_build_info,:size_t,:pointer,:pointer], :cl_int
55
+ attach_function :clCreateKernel, [Program,:pointer,:pointer], Kernel
56
+ attach_function :clCreateKernelsInProgram, [Program,:cl_uint,:pointer,:pointer], :cl_int
57
+ attach_function :clRetainKernel, [Kernel], :cl_int
58
+ attach_function :clReleaseKernel, [Kernel], :cl_int
59
+ attach_function :clSetKernelArg, [Kernel,:cl_uint,:size_t,:pointer], :cl_int
60
+ attach_function :clGetKernelInfo, [Kernel,:cl_kernel_info,:size_t,:pointer,:pointer], :cl_int
61
+ attach_function :clGetKernelWorkGroupInfo, [Kernel,Device,:cl_kernel_work_group_info,:size_t,:pointer,:pointer], :cl_int
62
+ attach_function :clWaitForEvents, [:cl_uint,:pointer], :cl_int
63
+ attach_function :clGetEventInfo, [Event,:cl_event_info,:size_t,:pointer,:pointer], :cl_int
64
+ attach_function :clRetainEvent, [Event], :cl_int
65
+ attach_function :clReleaseEvent, [Event], :cl_int
66
+ attach_function :clGetEventProfilingInfo, [Event,:cl_profiling_info,:size_t,:pointer,:pointer], :cl_int
67
+ attach_function :clFlush, [CommandQueue], :cl_int
68
+ attach_function :clFinish, [CommandQueue], :cl_int
69
+ attach_function :clEnqueueReadBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
70
+ attach_function :clEnqueueWriteBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
71
+ attach_function :clEnqueueCopyBuffer, [CommandQueue,Mem,Mem,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
72
+ attach_function :clEnqueueReadImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
73
+ attach_function :clEnqueueWriteImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
74
+ attach_function :clEnqueueCopyImage, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
75
+ attach_function :clEnqueueCopyImageToBuffer, [CommandQueue,Mem,Mem,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
76
+ attach_function :clEnqueueCopyBufferToImage, [CommandQueue,Mem,Mem,:size_t,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
77
+ attach_function :clEnqueueMapBuffer, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:size_t,:size_t,:cl_uint,:pointer,:pointer,:pointer], :pointer
78
+ attach_function :clEnqueueMapImage, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:pointer,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer,:pointer], :pointer
79
+ attach_function :clEnqueueUnmapMemObject, [CommandQueue,Mem,:pointer,:cl_uint,:pointer,:pointer], :cl_int
80
+ attach_function :clEnqueueNDRangeKernel, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
81
+ callback :clEnqueueNativeKernel_notify, [:pointer], :void
82
+ attach_function :clEnqueueNativeKernel, [CommandQueue,:clEnqueueNativeKernel_notify,:pointer,:size_t,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
83
+ attach_function :clCreateImage2D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
84
+ attach_function :clCreateImage3D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
85
+ attach_function :clEnqueueMarker, [CommandQueue,:pointer], :cl_int
86
+ attach_function :clEnqueueWaitForEvents, [CommandQueue,:cl_uint,:pointer], :cl_int
87
+ attach_function :clEnqueueBarrier, [CommandQueue], :cl_int
88
+ attach_function :clUnloadCompiler, [:void], :cl_int
89
+ attach_function :clGetExtensionFunctionAddress, [:pointer], :pointer
90
+ attach_function :clCreateCommandQueue, [Context,Device,:cl_command_queue_properties,:pointer], CommandQueue
91
+ attach_function :clCreateSampler, [Context,:cl_bool,:cl_addressing_mode,:cl_filter_mode,:pointer], Sampler
92
+ attach_function :clEnqueueTask, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer], :cl_int
93
+ attach_function :clCreateFromGLBuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
94
+ attach_function :clCreateFromGLRenderbuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
95
+ attach_function :clGetGLObjectInfo, [Mem,:pointer,:pointer], :cl_int
96
+ attach_function :clGetGLTextureInfo, [Mem,:cl_gl_texture_info,:size_t,:pointer,:pointer], :cl_int
97
+ attach_function :clEnqueueAcquireGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
98
+ attach_function :clEnqueueReleaseGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
99
+ attach_function :clCreateFromGLTexture2D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
100
+ attach_function :clCreateFromGLTexture3D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
101
+ begin # OpenCL 1.1
102
+ attach_function :clCreateSubBuffer, [Mem,:cl_mem_flags,:cl_buffer_create_type,:pointer,:pointer], Mem
103
+ attach_function :clEnqueueReadBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
104
+ attach_function :clEnqueueWriteBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
105
+ attach_function :clEnqueueCopyBufferRect, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
106
+ callback :clSetMemObjectDestructorCallback_notify, [:pointer,:pointer], :void
107
+ attach_function :clSetMemObjectDestructorCallback, [Mem,:clSetMemObjectDestructorCallback_notify,:pointer], :cl_int
108
+ attach_function :clCreateUserEvent, [Context,:pointer], Event
109
+ attach_function :clSetUserEventStatus, [Event,:cl_int], :cl_int
110
+ callback :clSetEventCallback_notify, [Event.by_ref,:cl_int,:pointer], :void
111
+ attach_function :clSetEventCallback, [Event,:cl_int,:clSetEventCallback_notify,:pointer], :cl_int
112
+ begin # OpenCL 1.2
113
+ attach_function :clCreateSubDevices, [Device,:pointer,:cl_uint,:pointer,:pointer], :cl_int
114
+ attach_function :clRetainDevice, [Device], :cl_int
115
+ attach_function :clReleaseDevice, [Device], :cl_int
116
+ attach_function :clCreateImage, [Context,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
117
+ attach_function :clCreateProgramWithBuiltInKernels, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
118
+ callback :clCompileProgram_notify, [Program.by_ref,:pointer], :void
119
+ attach_function :clCompileProgram, [Program,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer,:clCompileProgram_notify,:pointer], :cl_int
120
+ callback :clLinkProgram_notify, [Program.by_ref,:pointer], :void
121
+ attach_function :clLinkProgram, [Context,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:clLinkProgram_notify,:pointer,:pointer], Program
122
+ attach_function :clUnloadPlatformCompiler, [Platform], :cl_int
123
+ attach_function :clGetKernelArgInfo, [Kernel,:cl_uint,:cl_kernel_arg_info,:size_t,:pointer,:pointer], :cl_int
124
+ attach_function :clEnqueueFillBuffer, [CommandQueue,Mem,:pointer,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
125
+ attach_function :clEnqueueFillImage, [CommandQueue,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
126
+ attach_function :clEnqueueMigrateMemObjects, [CommandQueue,:cl_uint,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
127
+ attach_function :clEnqueueMarkerWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
128
+ attach_function :clEnqueueBarrierWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
129
+ attach_function :clGetExtensionFunctionAddressForPlatform, [Platform,:pointer], :pointer
130
+ attach_function :clCreateFromGLTexture, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
131
+ begin # OpenCL 2.0
132
+ attach_function :clCreateCommandQueueWithProperties, [Context,Device,:pointer,:pointer], CommandQueue
133
+ attach_function :clCreatePipe, [Context,:cl_mem_flags,:cl_uint,:cl_uint,:pointer,:pointer], Mem
134
+ attach_function :clGetPipeInfo, [Mem,:cl_pipe_info,:size_t,:pointer,:pointer], :cl_int
135
+ attach_function :clSVMAlloc, [Context,:cl_svm_mem_flags,:size_t,:cl_uint], :pointer
136
+ attach_function :clSVMFree, [Context,:pointer], :void
137
+ attach_function :clCreateSamplerWithProperties, [Context,:pointer,:pointer], Sampler
138
+ attach_function :clSetKernelArgSVMPointer, [Kernel,:cl_uint,:pointer], :cl_int
139
+ attach_function :clSetKernelExecInfo, [Kernel,:cl_kernel_exec_info,:size_t,:pointer], :cl_int
140
+ callback :clEnqueueSVMFree_notify, [CommandQueue.by_ref,:cl_uint,:pointer,:pointer], :void
141
+ attach_function :clEnqueueSVMFree, [CommandQueue,:cl_uint,:pointer,:clEnqueueSVMFree_notify,:pointer,:cl_uint,:pointer,:pointer], :cl_int
142
+ attach_function :clEnqueueSVMMemcpy, [CommandQueue,:cl_bool,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
143
+ attach_function :clEnqueueSVMMemFill, [CommandQueue,:pointer,:pointer,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
144
+ attach_function :clEnqueueSVMMap, [CommandQueue,:cl_bool,:cl_map_flags,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
145
+ attach_function :clEnqueueSVMUnmap, [CommandQueue,:pointer,:cl_uint,:pointer,:pointer], :cl_int
146
+ begin # OpenCL 2.1
147
+ attach_function :clSetDefaultDeviceCommandQueue, [Context,Device,CommandQueue], :cl_int
148
+ attach_function :clGetDeviceAndHostTimer, [Device,:pointer,:pointer], :cl_int
149
+ attach_function :clGetHostTimer, [Device,:pointer], :cl_int
150
+ attach_function :clCreateProgramWithIL, [Context,:pointer,:size_t,:pointer], Program
151
+ attach_function :clCloneKernel, [Kernel,:pointer], Kernel
152
+ attach_function :clGetKernelSubGroupInfo, [Kernel,Device,:cl_kernel_sub_group_info,:size_t,:pointer,:size_t,:pointer,:pointer], :cl_int
153
+ attach_function :clEnqueueSVMMigrateMem, [CommandQueue,:cl_uint,:pointer,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
154
+ begin # OpenCL 2.2
155
+ callback :clSetProgramReleaseCallback_notify, [Program.by_ref,:pointer], :void
156
+ attach_function :clSetProgramReleaseCallback, [Program,:clSetProgramReleaseCallback_notify,:pointer], :cl_int
157
+ attach_function :clSetProgramSpecializationConstant, [Program,:cl_uint,:size_t,:pointer], :cl_int
158
+ begin # OpenCL 3.0
159
+ attach_function :clCreateBufferWithProperties, [Context,:pointer,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
160
+ attach_function :clCreateImageWithProperties, [Context,:pointer,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
161
+ callback :clSetContextDestructorCallback_notify, [Context.by_ref,:pointer], :void
162
+ attach_function :clSetContextDestructorCallback, [Context,:clSetContextDestructorCallback_notify,:pointer], :cl_int
163
+ rescue NotFoundError => e
164
+ warn "Warning OpenCL 2.2 loader detected!"
165
+ end
166
+ rescue NotFoundError => e
167
+ warn "Warning OpenCL 2.1 loader detected!"
168
+ end
169
+ rescue NotFoundError => e
170
+ warn "Warning OpenCL 2.0 loader detected!"
171
+ end
172
+ rescue NotFoundError => e
173
+ warn "Warning OpenCL 1.2 loader detected!"
174
+ end
175
+ rescue NotFoundError => e
176
+ warn "Warning OpenCL 1.1 loader detected!"
177
+ end
178
+ rescue NotFoundError => e
179
+ warn "Warning OpenCL 1.0 loader detected!"
180
+ end
181
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'opencl_ruby_ffi'
3
- s.version = "1.3.8"
3
+ s.version = "1.3.9"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "bvideau@anl.gov"
6
6
  s.homepage = "https://github.com/Nanosim-LIG/opencl-ruby"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencl_ruby_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Videau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-07 00:00:00.000000000 Z
11
+ date: 2021-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: narray
@@ -125,6 +125,7 @@ files:
125
125
  - lib/opencl_ruby_ffi/opencl_arithmetic_gen.rb
126
126
  - lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb
127
127
  - lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb
128
+ - lib/opencl_ruby_ffi/opencl_ruby_ffi_library.rb
128
129
  - lib/opencl_ruby_ffi/opencl_types.rb
129
130
  - opencl_ruby_ffi.gemspec
130
131
  - templates_custom/default/module/setup.rb