opencl-bindings 1.0.0pre
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.
- checksums.yaml +7 -0
- data/ChangeLog +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/lib/opencl.rb +1347 -0
- data/lib/opencl_ext.rb +311 -0
- data/lib/opencl_gl.rb +119 -0
- data/lib/opencl_gl_ext.rb +115 -0
- data/sample/hello.cl +19 -0
- data/sample/hello.rb +69 -0
- data/sample/hello_clu.rb +59 -0
- data/sample/util/clu.rb +1470 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a2a39de40dd57f9441d6da9894bc715a9c18718
|
4
|
+
data.tar.gz: 1c2df968aa6128ffa56e8cdaa579cf8a7a4c481f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bc4c3f5d0cac798970453ce8af577e950073884dfd98c94d21ccd2fa0df4e1f1d9bc8a90b86c9439966f80439bfb7213753d2330b65fbd303419fc638ef3734
|
7
|
+
data.tar.gz: ed0e08663cde64ca257b9eb26513329e25456f88fdbc37094e10cfff2d57366d29f8d904471d6427be68e7a88da0e7832a662e1e73ba4bfd514abe817b298545
|
data/ChangeLog
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
2015-11-21 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* sample/QJulia/qjulia_clu.rb: Added.
|
4
|
+
* sample/Particle/gl_particle_animation_clu.rb: Added.
|
5
|
+
* sample/hello_clu.rb: Added.
|
6
|
+
|
7
|
+
2015-11-17 vaiorabbit <http://twitter.com/vaiorabbit>
|
8
|
+
|
9
|
+
* lib/opencl_ext.rb: Added some symbols for APPLE extensions.
|
10
|
+
* lib/opencl.rb (CL_STRUCT_IMAGE_FORMAT, CL_STRUCT_IMAGE_DESC): Added structs for clGetSupportedImageFormats.
|
11
|
+
* sample/util/clu.rb: Simple wrapper.
|
12
|
+
|
13
|
+
2015-11-14 vaiorabbit <http://twitter.com/vaiorabbit>
|
14
|
+
|
15
|
+
* lib/opencl.rb (extern): A new argument 'func_addr' added. (On Windows, extern fails on some ext functions regardless of the result of 'clGetExtensionFunctionAddressForPlatform')
|
16
|
+
|
17
|
+
2015-11-12 vaiorabbit <http://twitter.com/vaiorabbit>
|
18
|
+
|
19
|
+
* sample/QJulia: Added.
|
20
|
+
|
21
|
+
2015-11-11 vaiorabbit <http://twitter.com/vaiorabbit>
|
22
|
+
|
23
|
+
* sample/Particle: Added.
|
24
|
+
|
25
|
+
2015-11-08 vaiorabbit <http://twitter.com/vaiorabbit>
|
26
|
+
|
27
|
+
* lib/opencl_gl_ext.rb: Added.
|
28
|
+
|
29
|
+
2015-11-07 vaiorabbit <http://twitter.com/vaiorabbit>
|
30
|
+
|
31
|
+
* lib/opencl_gl.rb: Added.
|
32
|
+
|
33
|
+
2015-11-05 vaiorabbit <http://twitter.com/vaiorabbit>
|
34
|
+
|
35
|
+
* sample/add_numbers: Added.
|
36
|
+
|
37
|
+
2015-11-03 vaiorabbit <http://twitter.com/vaiorabbit>
|
38
|
+
|
39
|
+
* sample: Added.
|
40
|
+
|
41
|
+
2015-10-25 vaiorabbit <http://twitter.com/vaiorabbit>
|
42
|
+
|
43
|
+
* (Announce) First release.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Ruby-OpenCL : Yet another OpenCL wrapper for Ruby
|
2
|
+
Copyright (c) 2015 vaiorabbit <http://twitter.com/vaiorabbit>
|
3
|
+
|
4
|
+
This software is provided 'as-is', without any express or implied
|
5
|
+
warranty. In no event will the authors be held liable for any damages
|
6
|
+
arising from the use of this software.
|
7
|
+
|
8
|
+
Permission is granted to anyone to use this software for any purpose,
|
9
|
+
including commercial applications, and to alter it and redistribute it
|
10
|
+
freely, subject to the following restrictions:
|
11
|
+
|
12
|
+
1. The origin of this software must not be misrepresented; you must not
|
13
|
+
claim that you wrote the original software. If you use this software
|
14
|
+
in a product, an acknowledgment in the product documentation would be
|
15
|
+
appreciated but is not required.
|
16
|
+
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
|
20
|
+
3. This notice may not be removed or altered from any source
|
21
|
+
distribution.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
<!-- -*- mode:markdown; coding:utf-8; -*- -->
|
2
|
+
|
3
|
+
# Yet another OpenCL wrapper for Ruby #
|
4
|
+
|
5
|
+
A Ruby binding for OpenCL 1.2
|
6
|
+
|
7
|
+
* Created : 2015-10-25
|
8
|
+
* Last modified : 2015-11-21
|
9
|
+
|
10
|
+
|
11
|
+
## Features ##
|
12
|
+
|
13
|
+
* Based on Fiddle (One of the Ruby standard libraries that wraps libffi)
|
14
|
+
* You don't need to build C extension library
|
15
|
+
|
16
|
+
* Interoperability with OpenGL
|
17
|
+
* My OpenGL gem (opengl-bindings ( https://github.com/vaiorabbit/ruby-opengl ) version 1.5.2 and later) provides some platform-specific APIs essential for context sharing.
|
18
|
+
* 'opengl-bindings' is also based on Fiddle.
|
19
|
+
* Supported Platforms: Windows, Mac OS X and Linux (X Window)
|
20
|
+
* See 'createContextWithGLInterop (sample/util/clu.rb)' for details.
|
21
|
+
|
22
|
+
|
23
|
+
## Prerequisites ##
|
24
|
+
|
25
|
+
* Fiddle
|
26
|
+
* A libffi wrapper
|
27
|
+
* Standard library since Ruby 2.0.0
|
28
|
+
* I recommend you to use Ruby 2.1.2 and later, which fixed Fiddle's memory leak issue (https://bugs.ruby-lang.org/issues/9599).
|
29
|
+
|
30
|
+
### For sample ###
|
31
|
+
|
32
|
+
Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
|
33
|
+
|
34
|
+
* GLFW
|
35
|
+
* http://www.glfw.org/
|
36
|
+
* http://www.glfw.org/download.html
|
37
|
+
|
38
|
+
* freeglut
|
39
|
+
* http://freeglut.sourceforge.net
|
40
|
+
* http://freeglut.sourceforge.net/index.php#download
|
41
|
+
|
42
|
+
|
43
|
+
## Installation ##
|
44
|
+
|
45
|
+
Via RubyGems ( https://rubygems.org/gems/opencl-bindings ):
|
46
|
+
|
47
|
+
$ gem install opencl-bindings
|
48
|
+
|
49
|
+
Or grab all library codes (`lib/*.rb') and use them by adding as one of the load paths like:
|
50
|
+
|
51
|
+
$ ruby -I ./lib your_app.rb
|
52
|
+
|
53
|
+
|
54
|
+
## How to use ##
|
55
|
+
|
56
|
+
See sample/hello.rb.
|
57
|
+
|
58
|
+
To get more samples, please visit:
|
59
|
+
https://github.com/vaiorabbit/ruby-opencl
|
60
|
+
|
61
|
+
|
62
|
+
## License ##
|
63
|
+
|
64
|
+
The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
|
65
|
+
|
66
|
+
Copyright (c) 2015 vaiorabbit <http://twitter.com/vaiorabbit>
|
67
|
+
|
68
|
+
This software is provided 'as-is', without any express or implied
|
69
|
+
warranty. In no event will the authors be held liable for any damages
|
70
|
+
arising from the use of this software.
|
71
|
+
|
72
|
+
Permission is granted to anyone to use this software for any purpose,
|
73
|
+
including commercial applications, and to alter it and redistribute it
|
74
|
+
freely, subject to the following restrictions:
|
75
|
+
|
76
|
+
1. The origin of this software must not be misrepresented; you must not
|
77
|
+
claim that you wrote the original software. If you use this software in a
|
78
|
+
product, an acknowledgment in the product documentation would be
|
79
|
+
appreciated but is not required.
|
80
|
+
|
81
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
82
|
+
misrepresented as being the original software.
|
83
|
+
|
84
|
+
3. This notice may not be removed or altered from any source distribution.
|
data/lib/opencl.rb
ADDED
@@ -0,0 +1,1347 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'fiddle/import'
|
3
|
+
|
4
|
+
# A Ruby binding for OpenCL 1.2
|
5
|
+
|
6
|
+
# Ref.: /Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenCL.framework/Headers
|
7
|
+
# : $ nm -gU /System/Library/Frameworks/OpenCL.framework/OpenCL
|
8
|
+
|
9
|
+
module OpenCL
|
10
|
+
|
11
|
+
extend Fiddle::Importer
|
12
|
+
|
13
|
+
#
|
14
|
+
# Fiddle's default 'extern' stores all methods into local variable '@func_map', that makes difficult to 'include OpenCL'.
|
15
|
+
# So I override it and replace '@func_map' into 'CL_FUNCTIONS_MAP'.
|
16
|
+
# Ref.: /lib/ruby/2.0.0/fiddle/import.rb
|
17
|
+
#
|
18
|
+
CL_FUNCTIONS_MAP = {}
|
19
|
+
|
20
|
+
@cl_dll = nil
|
21
|
+
|
22
|
+
# Ref.: CALL_TYPE_TO_ABI (Fiddle::Importer)
|
23
|
+
def call_sym_to_abi(sym)
|
24
|
+
if sym == :stdcall && const_defined?(Fiddle::STDCALL)
|
25
|
+
Fiddle::Function::STDCALL
|
26
|
+
else
|
27
|
+
Fiddle::Function::DEFAULT
|
28
|
+
end
|
29
|
+
end
|
30
|
+
private :call_sym_to_abi
|
31
|
+
|
32
|
+
def self.extern(signature, *opts, func_addr: nil)
|
33
|
+
symname, ctype, argtype = parse_signature(signature, @type_alias)
|
34
|
+
opt = parse_bind_options(opts)
|
35
|
+
f = (func_addr == nil) ? import_function(symname, ctype, argtype, opt[:call_type]) : Fiddle::Function.new(func_addr, argtype, ctype, call_sym_to_abi(opt[:call_type]), name: symname)
|
36
|
+
|
37
|
+
name = symname.gsub(/@.+/,'')
|
38
|
+
CL_FUNCTIONS_MAP[name] = f
|
39
|
+
begin
|
40
|
+
/^(.+?):(\d+)/ =~ caller.first
|
41
|
+
file, line = $1, $2.to_i
|
42
|
+
rescue
|
43
|
+
file, line = __FILE__, __LINE__+3
|
44
|
+
end
|
45
|
+
args_str="*args"
|
46
|
+
module_eval(<<-EOS, file, line)
|
47
|
+
def #{name}(*args, &block)
|
48
|
+
CL_FUNCTIONS_MAP['#{name}'].call(*args,&block)
|
49
|
+
end
|
50
|
+
EOS
|
51
|
+
module_function(name)
|
52
|
+
f
|
53
|
+
end
|
54
|
+
|
55
|
+
# define (from cl_platform.h)
|
56
|
+
|
57
|
+
# Macro names and corresponding values defined by OpenCL
|
58
|
+
|
59
|
+
CL_CHAR_BIT = 8
|
60
|
+
CL_SCHAR_MAX = 127
|
61
|
+
CL_SCHAR_MIN = (-127-1)
|
62
|
+
CL_CHAR_MAX = CL_SCHAR_MAX
|
63
|
+
CL_CHAR_MIN = CL_SCHAR_MIN
|
64
|
+
CL_UCHAR_MAX = 255
|
65
|
+
CL_SHRT_MAX = 32767
|
66
|
+
CL_SHRT_MIN = (-32767-1)
|
67
|
+
CL_USHRT_MAX = 65535
|
68
|
+
CL_INT_MAX = 2147483647
|
69
|
+
CL_INT_MIN = (-2147483647-1)
|
70
|
+
CL_UINT_MAX = 0xffffffff
|
71
|
+
CL_LONG_MAX = 0x7FFFFFFFFFFFFFFF
|
72
|
+
CL_LONG_MIN = (-0x7FFFFFFFFFFFFFFF - 1)
|
73
|
+
CL_ULONG_MAX = 0xFFFFFFFFFFFFFFFF
|
74
|
+
|
75
|
+
CL_FLT_DIG = 6
|
76
|
+
CL_FLT_MANT_DIG = 24
|
77
|
+
CL_FLT_MAX_10_EXP = +38
|
78
|
+
CL_FLT_MAX_EXP = +128
|
79
|
+
CL_FLT_MIN_10_EXP = -37
|
80
|
+
CL_FLT_MIN_EXP = -125
|
81
|
+
CL_FLT_RADIX = 2
|
82
|
+
CL_FLT_MAX = 3.4028234663852886e+38 # 0x1.fffffep127f, Math.ldexp(0x1fffffe, 127 - 4 * 6)
|
83
|
+
CL_FLT_MIN = 1.1754943508222875e-38 # 0x1.0p-126f, Math.ldexp(1.0, -126)
|
84
|
+
CL_FLT_EPSILON = 1.1920928955078125e-07 # 0x1.0p-23f, Math.ldexp(1.0, -23)
|
85
|
+
|
86
|
+
CL_DBL_DIG = 15
|
87
|
+
CL_DBL_MANT_DIG = 53
|
88
|
+
CL_DBL_MAX_10_EXP = +308
|
89
|
+
CL_DBL_MAX_EXP = +1024
|
90
|
+
CL_DBL_MIN_10_EXP = -307
|
91
|
+
CL_DBL_MIN_EXP = -1021
|
92
|
+
CL_DBL_RADIX = 2
|
93
|
+
CL_DBL_MAX = 1.7976931348623157e+308 # 0x1.fffffffffffffp1023, Math.ldexp(0x1fffffffffffff, 1023 - 4 * 13)
|
94
|
+
CL_DBL_MIN = 2.2250738585072014e-308 # 0x1.0p-1022, Math.ldexp(1.0, -1022)
|
95
|
+
CL_DBL_EPSILON = 2.220446049250313e-16 # 0x1.0p-52, Math.ldexp(1.0, -52)
|
96
|
+
|
97
|
+
CL_M_E = 2.718281828459045090796
|
98
|
+
CL_M_LOG2E = 1.442695040888963387005
|
99
|
+
CL_M_LOG10E = 0.434294481903251816668
|
100
|
+
CL_M_LN2 = 0.693147180559945286227
|
101
|
+
CL_M_LN10 = 2.302585092994045901094
|
102
|
+
CL_M_PI = 3.141592653589793115998
|
103
|
+
CL_M_PI_2 = 1.570796326794896557999
|
104
|
+
CL_M_PI_4 = 0.785398163397448278999
|
105
|
+
CL_M_1_PI = 0.318309886183790691216
|
106
|
+
CL_M_2_PI = 0.636619772367581382433
|
107
|
+
CL_M_2_SQRTPI = 1.128379167095512558561
|
108
|
+
CL_M_SQRT2 = 1.414213562373095145475
|
109
|
+
CL_M_SQRT1_2 = 0.707106781186547572737
|
110
|
+
|
111
|
+
CL_M_E_F = 2.71828174591064
|
112
|
+
CL_M_LOG2E_F = 1.44269502162933
|
113
|
+
CL_M_LOG10E_F = 0.43429449200630
|
114
|
+
CL_M_LN2_F = 0.69314718246460
|
115
|
+
CL_M_LN10_F = 2.30258512496948
|
116
|
+
CL_M_PI_F = 3.14159274101257
|
117
|
+
CL_M_PI_2_F = 1.57079637050629
|
118
|
+
CL_M_PI_4_F = 0.78539818525314
|
119
|
+
CL_M_1_PI_F = 0.31830987334251
|
120
|
+
CL_M_2_PI_F = 0.63661974668503
|
121
|
+
CL_M_2_SQRTPI_F = 1.12837922573090
|
122
|
+
CL_M_SQRT2_F = 1.41421353816986
|
123
|
+
CL_M_SQRT1_2_F = 0.70710676908493
|
124
|
+
|
125
|
+
CL_HUGE_VALF = 1e50
|
126
|
+
CL_HUGE_VAL = 1e500
|
127
|
+
CL_MAXFLOAT = CL_FLT_MAX
|
128
|
+
CL_INFINITY = CL_HUGE_VALF
|
129
|
+
CL_NAN = Float::NAN # (CL_INFINITY - CL_INFINITY)
|
130
|
+
|
131
|
+
# define (from cl.h)
|
132
|
+
|
133
|
+
# Error Codes
|
134
|
+
|
135
|
+
CL_SUCCESS = 0
|
136
|
+
CL_DEVICE_NOT_FOUND = -1
|
137
|
+
CL_DEVICE_NOT_AVAILABLE = -2
|
138
|
+
CL_COMPILER_NOT_AVAILABLE = -3
|
139
|
+
CL_MEM_OBJECT_ALLOCATION_FAILURE = -4
|
140
|
+
CL_OUT_OF_RESOURCES = -5
|
141
|
+
CL_OUT_OF_HOST_MEMORY = -6
|
142
|
+
CL_PROFILING_INFO_NOT_AVAILABLE = -7
|
143
|
+
CL_MEM_COPY_OVERLAP = -8
|
144
|
+
CL_IMAGE_FORMAT_MISMATCH = -9
|
145
|
+
CL_IMAGE_FORMAT_NOT_SUPPORTED = -10
|
146
|
+
CL_BUILD_PROGRAM_FAILURE = -11
|
147
|
+
CL_MAP_FAILURE = -12
|
148
|
+
CL_MISALIGNED_SUB_BUFFER_OFFSET = -13
|
149
|
+
CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14
|
150
|
+
CL_COMPILE_PROGRAM_FAILURE = -15
|
151
|
+
CL_LINKER_NOT_AVAILABLE = -16
|
152
|
+
CL_LINK_PROGRAM_FAILURE = -17
|
153
|
+
CL_DEVICE_PARTITION_FAILED = -18
|
154
|
+
CL_KERNEL_ARG_INFO_NOT_AVAILABLE = -19
|
155
|
+
|
156
|
+
CL_INVALID_VALUE = -30
|
157
|
+
CL_INVALID_DEVICE_TYPE = -31
|
158
|
+
CL_INVALID_PLATFORM = -32
|
159
|
+
CL_INVALID_DEVICE = -33
|
160
|
+
CL_INVALID_CONTEXT = -34
|
161
|
+
CL_INVALID_QUEUE_PROPERTIES = -35
|
162
|
+
CL_INVALID_COMMAND_QUEUE = -36
|
163
|
+
CL_INVALID_HOST_PTR = -37
|
164
|
+
CL_INVALID_MEM_OBJECT = -38
|
165
|
+
CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39
|
166
|
+
CL_INVALID_IMAGE_SIZE = -40
|
167
|
+
CL_INVALID_SAMPLER = -41
|
168
|
+
CL_INVALID_BINARY = -42
|
169
|
+
CL_INVALID_BUILD_OPTIONS = -43
|
170
|
+
CL_INVALID_PROGRAM = -44
|
171
|
+
CL_INVALID_PROGRAM_EXECUTABLE = -45
|
172
|
+
CL_INVALID_KERNEL_NAME = -46
|
173
|
+
CL_INVALID_KERNEL_DEFINITION = -47
|
174
|
+
CL_INVALID_KERNEL = -48
|
175
|
+
CL_INVALID_ARG_INDEX = -49
|
176
|
+
CL_INVALID_ARG_VALUE = -50
|
177
|
+
CL_INVALID_ARG_SIZE = -51
|
178
|
+
CL_INVALID_KERNEL_ARGS = -52
|
179
|
+
CL_INVALID_WORK_DIMENSION = -53
|
180
|
+
CL_INVALID_WORK_GROUP_SIZE = -54
|
181
|
+
CL_INVALID_WORK_ITEM_SIZE = -55
|
182
|
+
CL_INVALID_GLOBAL_OFFSET = -56
|
183
|
+
CL_INVALID_EVENT_WAIT_LIST = -57
|
184
|
+
CL_INVALID_EVENT = -58
|
185
|
+
CL_INVALID_OPERATION = -59
|
186
|
+
CL_INVALID_GL_OBJECT = -60
|
187
|
+
CL_INVALID_BUFFER_SIZE = -61
|
188
|
+
CL_INVALID_MIP_LEVEL = -62
|
189
|
+
CL_INVALID_GLOBAL_WORK_SIZE = -63
|
190
|
+
CL_INVALID_PROPERTY = -64
|
191
|
+
CL_INVALID_IMAGE_DESCRIPTOR = -65
|
192
|
+
CL_INVALID_COMPILER_OPTIONS = -66
|
193
|
+
CL_INVALID_LINKER_OPTIONS = -67
|
194
|
+
CL_INVALID_DEVICE_PARTITION_COUNT = -68
|
195
|
+
|
196
|
+
# OpenCL Version
|
197
|
+
CL_VERSION_1_0 = 1
|
198
|
+
CL_VERSION_1_1 = 1
|
199
|
+
CL_VERSION_1_2 = 1
|
200
|
+
|
201
|
+
# cl_bool
|
202
|
+
CL_FALSE = 0
|
203
|
+
CL_TRUE = 1
|
204
|
+
CL_BLOCKING = CL_TRUE
|
205
|
+
CL_NON_BLOCKING = CL_FALSE
|
206
|
+
|
207
|
+
# cl_platform_info
|
208
|
+
CL_PLATFORM_PROFILE = 0x0900
|
209
|
+
CL_PLATFORM_VERSION = 0x0901
|
210
|
+
CL_PLATFORM_NAME = 0x0902
|
211
|
+
CL_PLATFORM_VENDOR = 0x0903
|
212
|
+
CL_PLATFORM_EXTENSIONS = 0x0904
|
213
|
+
|
214
|
+
# cl_device_type - bitfield
|
215
|
+
CL_DEVICE_TYPE_DEFAULT = (1 << 0)
|
216
|
+
CL_DEVICE_TYPE_CPU = (1 << 1)
|
217
|
+
CL_DEVICE_TYPE_GPU = (1 << 2)
|
218
|
+
CL_DEVICE_TYPE_ACCELERATOR = (1 << 3)
|
219
|
+
CL_DEVICE_TYPE_CUSTOM = (1 << 4)
|
220
|
+
CL_DEVICE_TYPE_ALL = 0xFFFFFFFF
|
221
|
+
|
222
|
+
# cl_device_info
|
223
|
+
CL_DEVICE_TYPE = 0x1000
|
224
|
+
CL_DEVICE_VENDOR_ID = 0x1001
|
225
|
+
CL_DEVICE_MAX_COMPUTE_UNITS = 0x1002
|
226
|
+
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 0x1003
|
227
|
+
CL_DEVICE_MAX_WORK_GROUP_SIZE = 0x1004
|
228
|
+
CL_DEVICE_MAX_WORK_ITEM_SIZES = 0x1005
|
229
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 0x1006
|
230
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 0x1007
|
231
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT = 0x1008
|
232
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 0x1009
|
233
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 0x100A
|
234
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0x100B
|
235
|
+
CL_DEVICE_MAX_CLOCK_FREQUENCY = 0x100C
|
236
|
+
CL_DEVICE_ADDRESS_BITS = 0x100D
|
237
|
+
CL_DEVICE_MAX_READ_IMAGE_ARGS = 0x100E
|
238
|
+
CL_DEVICE_MAX_WRITE_IMAGE_ARGS = 0x100F
|
239
|
+
CL_DEVICE_MAX_MEM_ALLOC_SIZE = 0x1010
|
240
|
+
CL_DEVICE_IMAGE2D_MAX_WIDTH = 0x1011
|
241
|
+
CL_DEVICE_IMAGE2D_MAX_HEIGHT = 0x1012
|
242
|
+
CL_DEVICE_IMAGE3D_MAX_WIDTH = 0x1013
|
243
|
+
CL_DEVICE_IMAGE3D_MAX_HEIGHT = 0x1014
|
244
|
+
CL_DEVICE_IMAGE3D_MAX_DEPTH = 0x1015
|
245
|
+
CL_DEVICE_IMAGE_SUPPORT = 0x1016
|
246
|
+
CL_DEVICE_MAX_PARAMETER_SIZE = 0x1017
|
247
|
+
CL_DEVICE_MAX_SAMPLERS = 0x1018
|
248
|
+
CL_DEVICE_MEM_BASE_ADDR_ALIGN = 0x1019
|
249
|
+
CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 0x101A
|
250
|
+
CL_DEVICE_SINGLE_FP_CONFIG = 0x101B
|
251
|
+
CL_DEVICE_GLOBAL_MEM_CACHE_TYPE = 0x101C
|
252
|
+
CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0x101D
|
253
|
+
CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = 0x101E
|
254
|
+
CL_DEVICE_GLOBAL_MEM_SIZE = 0x101F
|
255
|
+
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 0x1020
|
256
|
+
CL_DEVICE_MAX_CONSTANT_ARGS = 0x1021
|
257
|
+
CL_DEVICE_LOCAL_MEM_TYPE = 0x1022
|
258
|
+
CL_DEVICE_LOCAL_MEM_SIZE = 0x1023
|
259
|
+
CL_DEVICE_ERROR_CORRECTION_SUPPORT = 0x1024
|
260
|
+
CL_DEVICE_PROFILING_TIMER_RESOLUTION = 0x1025
|
261
|
+
CL_DEVICE_ENDIAN_LITTLE = 0x1026
|
262
|
+
CL_DEVICE_AVAILABLE = 0x1027
|
263
|
+
CL_DEVICE_COMPILER_AVAILABLE = 0x1028
|
264
|
+
CL_DEVICE_EXECUTION_CAPABILITIES = 0x1029
|
265
|
+
CL_DEVICE_QUEUE_PROPERTIES = 0x102A
|
266
|
+
CL_DEVICE_NAME = 0x102B
|
267
|
+
CL_DEVICE_VENDOR = 0x102C
|
268
|
+
CL_DRIVER_VERSION = 0x102D
|
269
|
+
CL_DEVICE_PROFILE = 0x102E
|
270
|
+
CL_DEVICE_VERSION = 0x102F
|
271
|
+
CL_DEVICE_EXTENSIONS = 0x1030
|
272
|
+
CL_DEVICE_PLATFORM = 0x1031
|
273
|
+
CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032
|
274
|
+
# 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG
|
275
|
+
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034
|
276
|
+
CL_DEVICE_HOST_UNIFIED_MEMORY = 0x1035
|
277
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 0x1036
|
278
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 0x1037
|
279
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 0x1038
|
280
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 0x1039
|
281
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 0x103A
|
282
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0x103B
|
283
|
+
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C
|
284
|
+
CL_DEVICE_OPENCL_C_VERSION = 0x103D
|
285
|
+
CL_DEVICE_LINKER_AVAILABLE = 0x103E
|
286
|
+
CL_DEVICE_BUILT_IN_KERNELS = 0x103F
|
287
|
+
CL_DEVICE_IMAGE_MAX_BUFFER_SIZE = 0x1040
|
288
|
+
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE = 0x1041
|
289
|
+
CL_DEVICE_PARENT_DEVICE = 0x1042
|
290
|
+
CL_DEVICE_PARTITION_MAX_SUB_DEVICES = 0x1043
|
291
|
+
CL_DEVICE_PARTITION_PROPERTIES = 0x1044
|
292
|
+
CL_DEVICE_PARTITION_AFFINITY_DOMAIN = 0x1045
|
293
|
+
CL_DEVICE_PARTITION_TYPE = 0x1046
|
294
|
+
CL_DEVICE_REFERENCE_COUNT = 0x1047
|
295
|
+
CL_DEVICE_PREFERRED_INTEROP_USER_SYNC = 0x1048
|
296
|
+
CL_DEVICE_PRINTF_BUFFER_SIZE = 0x1049
|
297
|
+
CL_DEVICE_IMAGE_PITCH_ALIGNMENT = 0x104A
|
298
|
+
CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT = 0x104B
|
299
|
+
|
300
|
+
# cl_device_fp_config - bitfield
|
301
|
+
CL_FP_DENORM = (1 << 0)
|
302
|
+
CL_FP_INF_NAN = (1 << 1)
|
303
|
+
CL_FP_ROUND_TO_NEAREST = (1 << 2)
|
304
|
+
CL_FP_ROUND_TO_ZERO = (1 << 3)
|
305
|
+
CL_FP_ROUND_TO_INF = (1 << 4)
|
306
|
+
CL_FP_FMA = (1 << 5)
|
307
|
+
CL_FP_SOFT_FLOAT = (1 << 6)
|
308
|
+
CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT = (1 << 7)
|
309
|
+
|
310
|
+
# cl_device_mem_cache_type
|
311
|
+
CL_NONE = 0x0
|
312
|
+
CL_READ_ONLY_CACHE = 0x1
|
313
|
+
CL_READ_WRITE_CACHE = 0x2
|
314
|
+
|
315
|
+
# cl_device_local_mem_type
|
316
|
+
CL_LOCAL = 0x1
|
317
|
+
CL_GLOBAL = 0x2
|
318
|
+
|
319
|
+
# cl_device_exec_capabilities - bitfield
|
320
|
+
CL_EXEC_KERNEL = (1 << 0)
|
321
|
+
CL_EXEC_NATIVE_KERNEL = (1 << 1)
|
322
|
+
|
323
|
+
# cl_command_queue_properties - bitfield
|
324
|
+
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = (1 << 0)
|
325
|
+
CL_QUEUE_PROFILING_ENABLE = (1 << 1)
|
326
|
+
|
327
|
+
# cl_context_info
|
328
|
+
CL_CONTEXT_REFERENCE_COUNT = 0x1080
|
329
|
+
CL_CONTEXT_DEVICES = 0x1081
|
330
|
+
CL_CONTEXT_PROPERTIES = 0x1082
|
331
|
+
CL_CONTEXT_NUM_DEVICES = 0x1083
|
332
|
+
|
333
|
+
# cl_context_properties
|
334
|
+
CL_CONTEXT_PLATFORM = 0x1084
|
335
|
+
CL_CONTEXT_INTEROP_USER_SYNC = 0x1085
|
336
|
+
|
337
|
+
# cl_device_partition_property
|
338
|
+
CL_DEVICE_PARTITION_EQUALLY = 0x1086
|
339
|
+
CL_DEVICE_PARTITION_BY_COUNTS = 0x1087
|
340
|
+
CL_DEVICE_PARTITION_BY_COUNTS_LIST_END = 0x0
|
341
|
+
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN = 0x1088
|
342
|
+
|
343
|
+
# cl_device_affinity_domain
|
344
|
+
CL_DEVICE_AFFINITY_DOMAIN_NUMA = (1 << 0)
|
345
|
+
CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE = (1 << 1)
|
346
|
+
CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE = (1 << 2)
|
347
|
+
CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE = (1 << 3)
|
348
|
+
CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE = (1 << 4)
|
349
|
+
CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE = (1 << 5)
|
350
|
+
|
351
|
+
# cl_command_queue_info
|
352
|
+
CL_QUEUE_CONTEXT = 0x1090
|
353
|
+
CL_QUEUE_DEVICE = 0x1091
|
354
|
+
CL_QUEUE_REFERENCE_COUNT = 0x1092
|
355
|
+
CL_QUEUE_PROPERTIES = 0x1093
|
356
|
+
|
357
|
+
# cl_mem_flags - bitfield
|
358
|
+
CL_MEM_READ_WRITE = (1 << 0)
|
359
|
+
CL_MEM_WRITE_ONLY = (1 << 1)
|
360
|
+
CL_MEM_READ_ONLY = (1 << 2)
|
361
|
+
CL_MEM_USE_HOST_PTR = (1 << 3)
|
362
|
+
CL_MEM_ALLOC_HOST_PTR = (1 << 4)
|
363
|
+
CL_MEM_COPY_HOST_PTR = (1 << 5)
|
364
|
+
# reserved (1 << 6)
|
365
|
+
CL_MEM_HOST_WRITE_ONLY = (1 << 7)
|
366
|
+
CL_MEM_HOST_READ_ONLY = (1 << 8)
|
367
|
+
CL_MEM_HOST_NO_ACCESS = (1 << 9)
|
368
|
+
|
369
|
+
# cl_mem_migration_flags - bitfield
|
370
|
+
CL_MIGRATE_MEM_OBJECT_HOST = (1 << 0)
|
371
|
+
CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED = (1 << 1)
|
372
|
+
|
373
|
+
# cl_channel_order
|
374
|
+
CL_R = 0x10B0
|
375
|
+
CL_A = 0x10B1
|
376
|
+
CL_RG = 0x10B2
|
377
|
+
CL_RA = 0x10B3
|
378
|
+
CL_RGB = 0x10B4
|
379
|
+
CL_RGBA = 0x10B5
|
380
|
+
CL_BGRA = 0x10B6
|
381
|
+
CL_ARGB = 0x10B7
|
382
|
+
CL_INTENSITY = 0x10B8
|
383
|
+
CL_LUMINANCE = 0x10B9
|
384
|
+
CL_Rx = 0x10BA
|
385
|
+
CL_RGx = 0x10BB
|
386
|
+
CL_RGBx = 0x10BC
|
387
|
+
CL_DEPTH = 0x10BD
|
388
|
+
CL_DEPTH_STENCIL = 0x10BE
|
389
|
+
|
390
|
+
# cl_channel_type
|
391
|
+
CL_SNORM_INT8 = 0x10D0
|
392
|
+
CL_SNORM_INT16 = 0x10D1
|
393
|
+
CL_UNORM_INT8 = 0x10D2
|
394
|
+
CL_UNORM_INT16 = 0x10D3
|
395
|
+
CL_UNORM_SHORT_565 = 0x10D4
|
396
|
+
CL_UNORM_SHORT_555 = 0x10D5
|
397
|
+
CL_UNORM_INT_101010 = 0x10D6
|
398
|
+
CL_SIGNED_INT8 = 0x10D7
|
399
|
+
CL_SIGNED_INT16 = 0x10D8
|
400
|
+
CL_SIGNED_INT32 = 0x10D9
|
401
|
+
CL_UNSIGNED_INT8 = 0x10DA
|
402
|
+
CL_UNSIGNED_INT16 = 0x10DB
|
403
|
+
CL_UNSIGNED_INT32 = 0x10DC
|
404
|
+
CL_HALF_FLOAT = 0x10DD
|
405
|
+
CL_FLOAT = 0x10DE
|
406
|
+
CL_UNORM_INT24 = 0x10DF
|
407
|
+
|
408
|
+
# cl_mem_object_type
|
409
|
+
CL_MEM_OBJECT_BUFFER = 0x10F0
|
410
|
+
CL_MEM_OBJECT_IMAGE2D = 0x10F1
|
411
|
+
CL_MEM_OBJECT_IMAGE3D = 0x10F2
|
412
|
+
CL_MEM_OBJECT_IMAGE2D_ARRAY = 0x10F3
|
413
|
+
CL_MEM_OBJECT_IMAGE1D = 0x10F4
|
414
|
+
CL_MEM_OBJECT_IMAGE1D_ARRAY = 0x10F5
|
415
|
+
CL_MEM_OBJECT_IMAGE1D_BUFFER = 0x10F6
|
416
|
+
|
417
|
+
# cl_mem_info
|
418
|
+
CL_MEM_TYPE = 0x1100
|
419
|
+
CL_MEM_FLAGS = 0x1101
|
420
|
+
CL_MEM_SIZE = 0x1102
|
421
|
+
CL_MEM_HOST_PTR = 0x1103
|
422
|
+
CL_MEM_MAP_COUNT = 0x1104
|
423
|
+
CL_MEM_REFERENCE_COUNT = 0x1105
|
424
|
+
CL_MEM_CONTEXT = 0x1106
|
425
|
+
CL_MEM_ASSOCIATED_MEMOBJECT = 0x1107
|
426
|
+
CL_MEM_OFFSET = 0x1108
|
427
|
+
|
428
|
+
# cl_image_info
|
429
|
+
CL_IMAGE_FORMAT = 0x1110
|
430
|
+
CL_IMAGE_ELEMENT_SIZE = 0x1111
|
431
|
+
CL_IMAGE_ROW_PITCH = 0x1112
|
432
|
+
CL_IMAGE_SLICE_PITCH = 0x1113
|
433
|
+
CL_IMAGE_WIDTH = 0x1114
|
434
|
+
CL_IMAGE_HEIGHT = 0x1115
|
435
|
+
CL_IMAGE_DEPTH = 0x1116
|
436
|
+
CL_IMAGE_ARRAY_SIZE = 0x1117
|
437
|
+
CL_IMAGE_BUFFER = 0x1118
|
438
|
+
CL_IMAGE_NUM_MIP_LEVELS = 0x1119
|
439
|
+
CL_IMAGE_NUM_SAMPLES = 0x111A
|
440
|
+
|
441
|
+
# cl_addressing_mode
|
442
|
+
CL_ADDRESS_NONE = 0x1130
|
443
|
+
CL_ADDRESS_CLAMP_TO_EDGE = 0x1131
|
444
|
+
CL_ADDRESS_CLAMP = 0x1132
|
445
|
+
CL_ADDRESS_REPEAT = 0x1133
|
446
|
+
CL_ADDRESS_MIRRORED_REPEAT = 0x1134
|
447
|
+
|
448
|
+
# cl_filter_mode
|
449
|
+
CL_FILTER_NEAREST = 0x1140
|
450
|
+
CL_FILTER_LINEAR = 0x1141
|
451
|
+
|
452
|
+
# cl_sampler_info
|
453
|
+
CL_SAMPLER_REFERENCE_COUNT = 0x1150
|
454
|
+
CL_SAMPLER_CONTEXT = 0x1151
|
455
|
+
CL_SAMPLER_NORMALIZED_COORDS = 0x1152
|
456
|
+
CL_SAMPLER_ADDRESSING_MODE = 0x1153
|
457
|
+
CL_SAMPLER_FILTER_MODE = 0x1154
|
458
|
+
|
459
|
+
# cl_map_flags - bitfield
|
460
|
+
CL_MAP_READ = (1 << 0)
|
461
|
+
CL_MAP_WRITE = (1 << 1)
|
462
|
+
CL_MAP_WRITE_INVALIDATE_REGION = (1 << 2)
|
463
|
+
|
464
|
+
# cl_program_info
|
465
|
+
CL_PROGRAM_REFERENCE_COUNT = 0x1160
|
466
|
+
CL_PROGRAM_CONTEXT = 0x1161
|
467
|
+
CL_PROGRAM_NUM_DEVICES = 0x1162
|
468
|
+
CL_PROGRAM_DEVICES = 0x1163
|
469
|
+
CL_PROGRAM_SOURCE = 0x1164
|
470
|
+
CL_PROGRAM_BINARY_SIZES = 0x1165
|
471
|
+
CL_PROGRAM_BINARIES = 0x1166
|
472
|
+
CL_PROGRAM_NUM_KERNELS = 0x1167
|
473
|
+
CL_PROGRAM_KERNEL_NAMES = 0x1168
|
474
|
+
|
475
|
+
# cl_program_build_info
|
476
|
+
CL_PROGRAM_BUILD_STATUS = 0x1181
|
477
|
+
CL_PROGRAM_BUILD_OPTIONS = 0x1182
|
478
|
+
CL_PROGRAM_BUILD_LOG = 0x1183
|
479
|
+
CL_PROGRAM_BINARY_TYPE = 0x1184
|
480
|
+
|
481
|
+
# cl_program_binary_type
|
482
|
+
CL_PROGRAM_BINARY_TYPE_NONE = 0x0
|
483
|
+
CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = 0x1
|
484
|
+
CL_PROGRAM_BINARY_TYPE_LIBRARY = 0x2
|
485
|
+
CL_PROGRAM_BINARY_TYPE_EXECUTABLE = 0x4
|
486
|
+
|
487
|
+
# cl_build_status
|
488
|
+
CL_BUILD_SUCCESS = 0
|
489
|
+
CL_BUILD_NONE = -1
|
490
|
+
CL_BUILD_ERROR = -2
|
491
|
+
CL_BUILD_IN_PROGRESS = -3
|
492
|
+
|
493
|
+
# cl_kernel_info
|
494
|
+
CL_KERNEL_FUNCTION_NAME = 0x1190
|
495
|
+
CL_KERNEL_NUM_ARGS = 0x1191
|
496
|
+
CL_KERNEL_REFERENCE_COUNT = 0x1192
|
497
|
+
CL_KERNEL_CONTEXT = 0x1193
|
498
|
+
CL_KERNEL_PROGRAM = 0x1194
|
499
|
+
CL_KERNEL_ATTRIBUTES = 0x1195
|
500
|
+
|
501
|
+
# cl_kernel_arg_info
|
502
|
+
CL_KERNEL_ARG_ADDRESS_QUALIFIER = 0x1196
|
503
|
+
CL_KERNEL_ARG_ACCESS_QUALIFIER = 0x1197
|
504
|
+
CL_KERNEL_ARG_TYPE_NAME = 0x1198
|
505
|
+
CL_KERNEL_ARG_TYPE_QUALIFIER = 0x1199
|
506
|
+
CL_KERNEL_ARG_NAME = 0x119A
|
507
|
+
|
508
|
+
# cl_kernel_arg_address_qualifier
|
509
|
+
CL_KERNEL_ARG_ADDRESS_GLOBAL = 0x119B
|
510
|
+
CL_KERNEL_ARG_ADDRESS_LOCAL = 0x119C
|
511
|
+
CL_KERNEL_ARG_ADDRESS_CONSTANT = 0x119D
|
512
|
+
CL_KERNEL_ARG_ADDRESS_PRIVATE = 0x119E
|
513
|
+
|
514
|
+
# cl_kernel_arg_access_qualifier
|
515
|
+
CL_KERNEL_ARG_ACCESS_READ_ONLY = 0x11A0
|
516
|
+
CL_KERNEL_ARG_ACCESS_WRITE_ONLY = 0x11A1
|
517
|
+
CL_KERNEL_ARG_ACCESS_READ_WRITE = 0x11A2
|
518
|
+
CL_KERNEL_ARG_ACCESS_NONE = 0x11A3
|
519
|
+
|
520
|
+
# cl_kernel_arg_type_qualifer
|
521
|
+
CL_KERNEL_ARG_TYPE_NONE = 0
|
522
|
+
CL_KERNEL_ARG_TYPE_CONST = (1 << 0)
|
523
|
+
CL_KERNEL_ARG_TYPE_RESTRICT = (1 << 1)
|
524
|
+
CL_KERNEL_ARG_TYPE_VOLATILE = (1 << 2)
|
525
|
+
|
526
|
+
# cl_kernel_work_group_info
|
527
|
+
CL_KERNEL_WORK_GROUP_SIZE = 0x11B0
|
528
|
+
CL_KERNEL_COMPILE_WORK_GROUP_SIZE = 0x11B1
|
529
|
+
CL_KERNEL_LOCAL_MEM_SIZE = 0x11B2
|
530
|
+
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x11B3
|
531
|
+
CL_KERNEL_PRIVATE_MEM_SIZE = 0x11B4
|
532
|
+
CL_KERNEL_GLOBAL_WORK_SIZE = 0x11B5
|
533
|
+
|
534
|
+
# cl_event_info
|
535
|
+
CL_EVENT_COMMAND_QUEUE = 0x11D0
|
536
|
+
CL_EVENT_COMMAND_TYPE = 0x11D1
|
537
|
+
CL_EVENT_REFERENCE_COUNT = 0x11D2
|
538
|
+
CL_EVENT_COMMAND_EXECUTION_STATUS = 0x11D3
|
539
|
+
CL_EVENT_CONTEXT = 0x11D4
|
540
|
+
|
541
|
+
# cl_command_type
|
542
|
+
CL_COMMAND_NDRANGE_KERNEL = 0x11F0
|
543
|
+
CL_COMMAND_TASK = 0x11F1
|
544
|
+
CL_COMMAND_NATIVE_KERNEL = 0x11F2
|
545
|
+
CL_COMMAND_READ_BUFFER = 0x11F3
|
546
|
+
CL_COMMAND_WRITE_BUFFER = 0x11F4
|
547
|
+
CL_COMMAND_COPY_BUFFER = 0x11F5
|
548
|
+
CL_COMMAND_READ_IMAGE = 0x11F6
|
549
|
+
CL_COMMAND_WRITE_IMAGE = 0x11F7
|
550
|
+
CL_COMMAND_COPY_IMAGE = 0x11F8
|
551
|
+
CL_COMMAND_COPY_IMAGE_TO_BUFFER = 0x11F9
|
552
|
+
CL_COMMAND_COPY_BUFFER_TO_IMAGE = 0x11FA
|
553
|
+
CL_COMMAND_MAP_BUFFER = 0x11FB
|
554
|
+
CL_COMMAND_MAP_IMAGE = 0x11FC
|
555
|
+
CL_COMMAND_UNMAP_MEM_OBJECT = 0x11FD
|
556
|
+
CL_COMMAND_MARKER = 0x11FE
|
557
|
+
CL_COMMAND_ACQUIRE_GL_OBJECTS = 0x11FF
|
558
|
+
CL_COMMAND_RELEASE_GL_OBJECTS = 0x1200
|
559
|
+
CL_COMMAND_READ_BUFFER_RECT = 0x1201
|
560
|
+
CL_COMMAND_WRITE_BUFFER_RECT = 0x1202
|
561
|
+
CL_COMMAND_COPY_BUFFER_RECT = 0x1203
|
562
|
+
CL_COMMAND_USER = 0x1204
|
563
|
+
CL_COMMAND_BARRIER = 0x1205
|
564
|
+
CL_COMMAND_MIGRATE_MEM_OBJECTS = 0x1206
|
565
|
+
CL_COMMAND_FILL_BUFFER = 0x1207
|
566
|
+
CL_COMMAND_FILL_IMAGE = 0x1208
|
567
|
+
|
568
|
+
# command execution status
|
569
|
+
CL_COMPLETE = 0x0
|
570
|
+
CL_RUNNING = 0x1
|
571
|
+
CL_SUBMITTED = 0x2
|
572
|
+
CL_QUEUED = 0x3
|
573
|
+
|
574
|
+
# cl_buffer_create_type
|
575
|
+
CL_BUFFER_CREATE_TYPE_REGION = 0x1220
|
576
|
+
|
577
|
+
# cl_profiling_info
|
578
|
+
CL_PROFILING_COMMAND_QUEUED = 0x1280
|
579
|
+
CL_PROFILING_COMMAND_SUBMIT = 0x1281
|
580
|
+
CL_PROFILING_COMMAND_START = 0x1282
|
581
|
+
CL_PROFILING_COMMAND_END = 0x1283
|
582
|
+
|
583
|
+
# struct (from cl.h)
|
584
|
+
|
585
|
+
# struct cl_image_format
|
586
|
+
# - cl_channel_order image_channel_order;
|
587
|
+
# - cl_channel_type image_channel_data_type;
|
588
|
+
CL_STRUCT_IMAGE_FORMAT = struct(["unsigned int image_channel_order",
|
589
|
+
"unsigned int image_channel_data_type"])
|
590
|
+
|
591
|
+
# struct cl_image_desc
|
592
|
+
# - cl_mem_object_type image_type;
|
593
|
+
# - size_t image_width;
|
594
|
+
# - size_t image_height;
|
595
|
+
# - size_t image_depth;
|
596
|
+
# - size_t image_array_size;
|
597
|
+
# - size_t image_row_pitch;
|
598
|
+
# - size_t image_slice_pitch;
|
599
|
+
# - cl_uint num_mip_levels;
|
600
|
+
# - cl_uint num_samples;
|
601
|
+
# - cl_mem buffer;
|
602
|
+
CL_STRUCT_IMAGE_DESC = struct(["unsigned int image_type",
|
603
|
+
"size_t image_width",
|
604
|
+
"size_t image_height",
|
605
|
+
"size_t image_depth",
|
606
|
+
"size_t image_array_size",
|
607
|
+
"size_t image_row_pitch",
|
608
|
+
"size_t image_slice_pitch",
|
609
|
+
"unsigned int num_mip_levels",
|
610
|
+
"unsigned int num_samples",
|
611
|
+
"void* buffer"])
|
612
|
+
|
613
|
+
# struct cl_buffer_region
|
614
|
+
# - size_t origin;
|
615
|
+
# - size_t size;
|
616
|
+
CL_BUFFER_REGION = struct(["size_t origin",
|
617
|
+
"size_t size"])
|
618
|
+
|
619
|
+
@@cl_import_done = false
|
620
|
+
|
621
|
+
# Load native library.
|
622
|
+
def self.load_lib(libpath = nil)
|
623
|
+
@@cl_dll = dlopen(libpath) # Fiddle::Handle.new(libpath, Fiddle::Handle::RTLD_LAZY|Fiddle::Handle::RTLD_GLOBAL)
|
624
|
+
dlload(@@cl_dll)
|
625
|
+
import_symbols() unless @@cl_import_done
|
626
|
+
end
|
627
|
+
|
628
|
+
def self.import_functions_cl
|
629
|
+
# function (from cl.h)
|
630
|
+
|
631
|
+
# Platform API
|
632
|
+
|
633
|
+
# cl_uint : num_entries
|
634
|
+
# cl_platform_id* : platforms
|
635
|
+
# cl_uint* : num_platforms
|
636
|
+
extern 'cl_int clGetPlatformIDs(cl_uint, cl_platform_id*, cl_uint*)'
|
637
|
+
|
638
|
+
# cl_platform_id : platform
|
639
|
+
# cl_platform_info : param_name
|
640
|
+
# size_t : param_value_size
|
641
|
+
# void * : param_value
|
642
|
+
# size_t * : param_value_size_ret
|
643
|
+
extern 'cl_int clGetPlatformInfo(cl_platform_id, cl_platform_info, size_t, void*, size_t*)'
|
644
|
+
|
645
|
+
# Device APIs
|
646
|
+
|
647
|
+
# cl_platform_id : platform
|
648
|
+
# cl_device_type : device_type
|
649
|
+
# cl_uint : num_entries
|
650
|
+
# cl_device_id * : devices
|
651
|
+
# cl_uint * : num_devices
|
652
|
+
extern 'cl_int clGetDeviceIDs(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*)'
|
653
|
+
|
654
|
+
# cl_device_id : device
|
655
|
+
# cl_device_info : param_name
|
656
|
+
# size_t : param_value_size
|
657
|
+
# void * : param_value
|
658
|
+
# size_t * : param_value_size_ret
|
659
|
+
extern 'cl_int clGetDeviceInfo(cl_device_id, cl_device_info, size_t, void*, size_t*)'
|
660
|
+
|
661
|
+
# cl_device_id : in_device
|
662
|
+
# const cl_device_partition_property * : properties
|
663
|
+
# cl_uint : num_devices
|
664
|
+
# cl_device_id * : out_devices
|
665
|
+
# cl_uint * : num_devices_ret
|
666
|
+
extern 'cl_int clCreateSubDevices(cl_device_id, const cl_device_partition_property*, cl_uint, cl_device_id*, cl_uint*)'
|
667
|
+
|
668
|
+
# cl_device_id : device
|
669
|
+
extern 'cl_int clRetainDevice(cl_device_id)'
|
670
|
+
|
671
|
+
# cl_device_id : device
|
672
|
+
extern 'cl_int clReleaseDevice(cl_device_id)'
|
673
|
+
|
674
|
+
# Context APIs
|
675
|
+
|
676
|
+
# cl_context_properties * : properties
|
677
|
+
# cl_uint : num_devices
|
678
|
+
# cl_device_id * : devices
|
679
|
+
# void * : pfn_notify(char *, void *, size_t, void *),
|
680
|
+
# void * : user_data
|
681
|
+
# cl_int * : errcode_ret
|
682
|
+
extern 'cl_context clCreateContext(cl_context_properties *, cl_uint, cl_device_id*, void*, void*, cl_int*)'
|
683
|
+
|
684
|
+
# cl_context_properties * : properties
|
685
|
+
# cl_device_type : device_type
|
686
|
+
# void * : pfn_notify(char *, void *, size_t, void *)
|
687
|
+
# void * : user_data
|
688
|
+
# cl_int * : errcode_ret
|
689
|
+
extern 'cl_context clCreateContextFromType(cl_context_properties*, cl_device_type, void*, void*, cl_int*)'
|
690
|
+
|
691
|
+
# cl_context : context
|
692
|
+
extern 'cl_int clRetainContext(cl_context)'
|
693
|
+
|
694
|
+
# cl_context : context
|
695
|
+
extern 'cl_int clReleaseContext(cl_context)'
|
696
|
+
|
697
|
+
# cl_context : context
|
698
|
+
# cl_context_info : param_name
|
699
|
+
# size_t : param_value_size
|
700
|
+
# void * : param_value
|
701
|
+
# size_t * : param_value_size_ret
|
702
|
+
extern 'cl_int clGetContextInfo(cl_context, cl_context_info, size_t, void*, size_t*)'
|
703
|
+
|
704
|
+
# Command Queue APIs
|
705
|
+
|
706
|
+
# cl_context : context
|
707
|
+
# cl_device_id : device
|
708
|
+
# cl_command_queue_properties : properties
|
709
|
+
# cl_int * : errcode_ret
|
710
|
+
extern 'cl_command_queue clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)'
|
711
|
+
|
712
|
+
# cl_command_queue : command_queue
|
713
|
+
extern 'cl_int clRetainCommandQueue(cl_command_queue)'
|
714
|
+
|
715
|
+
# cl_command_queue : command_queue
|
716
|
+
extern 'cl_int clReleaseCommandQueue(cl_command_queue)'
|
717
|
+
|
718
|
+
# cl_command_queue : command_queue
|
719
|
+
# cl_command_queue_info : param_name
|
720
|
+
# size_t : param_value_size
|
721
|
+
# void * : param_value
|
722
|
+
# size_t * : param_value_size_ret
|
723
|
+
extern 'cl_int clGetCommandQueueInfo(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*)'
|
724
|
+
|
725
|
+
# Memory Object APIs
|
726
|
+
|
727
|
+
# cl_context : context
|
728
|
+
# cl_mem_flags : flags
|
729
|
+
# size_t : size
|
730
|
+
# void * : host_ptr
|
731
|
+
# cl_int * : errcode_ret
|
732
|
+
extern 'cl_mem clCreateBuffer(cl_context, cl_mem_flags, size_t, void*, cl_int*)'
|
733
|
+
|
734
|
+
# cl_mem : buffer
|
735
|
+
# cl_mem_flags : flags
|
736
|
+
# cl_buffer_create_type : buffer_create_type
|
737
|
+
# const void * : buffer_create_info
|
738
|
+
# cl_int * : errcode_ret
|
739
|
+
extern 'cl_mem clCreateSubBuffer(cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *)'
|
740
|
+
|
741
|
+
# cl_context : context
|
742
|
+
# cl_mem_flags : flags
|
743
|
+
# const cl_image_format * : image_format
|
744
|
+
# const cl_image_desc * : image_desc
|
745
|
+
# void * : host_ptr
|
746
|
+
# cl_int * : errcode_ret
|
747
|
+
extern 'cl_mem clCreateImage(cl_context, cl_mem_flags, const cl_image_format*, const cl_image_desc*, void*, cl_int*)'
|
748
|
+
|
749
|
+
# cl_mem : memobj
|
750
|
+
extern 'cl_int clRetainMemObject(cl_mem)'
|
751
|
+
|
752
|
+
# cl_mem : memobj
|
753
|
+
extern 'cl_int clReleaseMemObject(cl_mem)'
|
754
|
+
|
755
|
+
# cl_context : context
|
756
|
+
# cl_mem_flags : flags
|
757
|
+
# cl_mem_object_type : image_type
|
758
|
+
# cl_uint : num_entries
|
759
|
+
# cl_image_format * : image_formats
|
760
|
+
# cl_uint * : num_image_formats
|
761
|
+
extern 'cl_int clGetSupportedImageFormats(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format*, cl_uint*)'
|
762
|
+
|
763
|
+
# cl_mem : memobj
|
764
|
+
# cl_mem_info : param_name
|
765
|
+
# size_t : param_value_size
|
766
|
+
# void * : param_value
|
767
|
+
# size_t * : param_value_size_ret
|
768
|
+
extern 'cl_int clGetMemObjectInfo(cl_mem, cl_mem_info, size_t, void*, size_t*)'
|
769
|
+
|
770
|
+
# cl_mem : memobj
|
771
|
+
# cl_image_info : param_name
|
772
|
+
# size_t : param_value_size
|
773
|
+
# void * : param_value
|
774
|
+
# size_t * : param_value_size_ret
|
775
|
+
extern 'cl_int clGetImageInfo(cl_mem, cl_image_info, size_t, void*, size_t*)'
|
776
|
+
|
777
|
+
# cl_mem : memobj
|
778
|
+
# void * : pfn_notify(cl_mem, void*)
|
779
|
+
# void * : user_data
|
780
|
+
extern 'cl_int clSetMemObjectDestructorCallback(cl_mem, void*, void*)'
|
781
|
+
|
782
|
+
# Sampler APIs
|
783
|
+
|
784
|
+
# cl_context : context
|
785
|
+
# cl_bool : normalized_coords
|
786
|
+
# cl_addressing_mode : addressing_mode
|
787
|
+
# cl_filter_mode : filter_mode
|
788
|
+
# cl_int * : errcode_ret
|
789
|
+
extern 'cl_sampler clCreateSampler(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*)'
|
790
|
+
|
791
|
+
# cl_sampler : sampler
|
792
|
+
extern 'cl_int clRetainSampler(cl_sampler)'
|
793
|
+
|
794
|
+
# cl_sampler : sampler
|
795
|
+
extern 'cl_int clReleaseSampler(cl_sampler)'
|
796
|
+
|
797
|
+
# cl_sampler : sampler
|
798
|
+
# cl_sampler_info : param_name
|
799
|
+
# size_t : param_value_size
|
800
|
+
# void * : param_value
|
801
|
+
# size_t * : param_value_size_ret
|
802
|
+
extern 'cl_int clGetSamplerInfo(cl_sampler, cl_sampler_info, size_t, void*, size_t*)'
|
803
|
+
|
804
|
+
# Program Object APIs
|
805
|
+
|
806
|
+
# cl_context : context
|
807
|
+
# cl_uint : count
|
808
|
+
# const char ** : strings
|
809
|
+
# const size_t * : lengths
|
810
|
+
# cl_int * : errcode_ret
|
811
|
+
extern 'cl_program clCreateProgramWithSource(cl_context, cl_uint, const char **, const size_t *, cl_int *)'
|
812
|
+
|
813
|
+
# cl_context : context
|
814
|
+
# cl_uint : num_devices
|
815
|
+
# const cl_device_id * : device_list
|
816
|
+
# const size_t * : lengths
|
817
|
+
# const unsigned char ** : binaries
|
818
|
+
# cl_int * : binary_status
|
819
|
+
# cl_int * : errcode_ret
|
820
|
+
extern 'cl_program clCreateProgramWithBinary(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *)'
|
821
|
+
|
822
|
+
# cl_context : context
|
823
|
+
# cl_uint : num_devices
|
824
|
+
# const cl_device_id * : device_list
|
825
|
+
# const char * : kernel_names
|
826
|
+
# cl_int * : errcode_ret
|
827
|
+
extern 'cl_program clCreateProgramWithBuiltInKernels(cl_context, cl_uint, const cl_device_id *, const char *, cl_int *)'
|
828
|
+
|
829
|
+
# cl_program : program
|
830
|
+
extern 'cl_int clRetainProgram(cl_program)'
|
831
|
+
|
832
|
+
# cl_program : program
|
833
|
+
extern 'cl_int clReleaseProgram(cl_program)'
|
834
|
+
|
835
|
+
# cl_program : program
|
836
|
+
# cl_uint : num_devices
|
837
|
+
# const cl_device_id * : device_list
|
838
|
+
# const char * : options
|
839
|
+
# void * : pfn_notify(cl_program, void*)
|
840
|
+
# void * : user_data
|
841
|
+
extern 'cl_int clBuildProgram(cl_program, cl_uint, const cl_device_id *, const char *, void *, void *)'
|
842
|
+
|
843
|
+
# cl_program : program
|
844
|
+
# cl_uint : num_devices
|
845
|
+
# const cl_device_id * : device_list
|
846
|
+
# const char * : options
|
847
|
+
# cl_uint : num_input_headers
|
848
|
+
# const cl_program * : input_headers
|
849
|
+
# const char ** : header_include_names
|
850
|
+
# void * : pfn_notify(cl_program, void*)
|
851
|
+
# void * : user_data
|
852
|
+
extern 'cl_int clCompileProgram(cl_program, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, const char **, void *, void *)'
|
853
|
+
|
854
|
+
# cl_context : context
|
855
|
+
# cl_uint : num_devices
|
856
|
+
# const cl_device_id * : device_list
|
857
|
+
# const char * : options
|
858
|
+
# cl_uint : num_input_programs
|
859
|
+
# const cl_program * : input_programs
|
860
|
+
# void * : pfn_notify(cl_program, void*)
|
861
|
+
# void * : user_data
|
862
|
+
# cl_int * : errcode_ret
|
863
|
+
extern 'cl_program clLinkProgram(cl_context, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, void *, void *, cl_int *)'
|
864
|
+
|
865
|
+
|
866
|
+
# cl_platform_id : platform
|
867
|
+
extern 'cl_int clUnloadPlatformCompiler(cl_platform_id)'
|
868
|
+
|
869
|
+
# cl_program : program
|
870
|
+
# cl_program_info : param_name
|
871
|
+
# size_t : param_value_size
|
872
|
+
# void * : param_value
|
873
|
+
# size_t * : param_value_size_ret
|
874
|
+
extern 'cl_int clGetProgramInfo(cl_program, cl_program_info, size_t, void *, size_t *)'
|
875
|
+
|
876
|
+
# cl_program : program
|
877
|
+
# cl_device_id : device
|
878
|
+
# cl_program_build_info : param_name
|
879
|
+
# size_t : param_value_size
|
880
|
+
# void * : param_value
|
881
|
+
# size_t * : param_value_size_ret
|
882
|
+
extern 'cl_int clGetProgramBuildInfo(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *)'
|
883
|
+
|
884
|
+
# Kernel Object APIs
|
885
|
+
|
886
|
+
# cl_program : program
|
887
|
+
# const char * : kernel_name
|
888
|
+
# cl_int * : errcode_ret
|
889
|
+
extern 'cl_kernel clCreateKernel(cl_program, const char *, cl_int *)'
|
890
|
+
|
891
|
+
# cl_program : program
|
892
|
+
# cl_uint : num_kernels
|
893
|
+
# cl_kernel * : kernels
|
894
|
+
# cl_uint * : num_kernels_ret
|
895
|
+
extern 'cl_int clCreateKernelsInProgram(cl_program, cl_uint, cl_kernel *, cl_uint *)'
|
896
|
+
|
897
|
+
# cl_kernel : kernel
|
898
|
+
extern 'cl_int clRetainKernel(cl_kernel)'
|
899
|
+
|
900
|
+
# cl_kernel : kernel
|
901
|
+
extern 'cl_int clReleaseKernel(cl_kernel)'
|
902
|
+
|
903
|
+
# cl_kernel : kernel
|
904
|
+
# cl_uint : arg_index
|
905
|
+
# size_t : arg_size
|
906
|
+
# const void * : arg_value
|
907
|
+
extern 'cl_int clSetKernelArg(cl_kernel, cl_uint, size_t, const void *)'
|
908
|
+
|
909
|
+
# cl_kernel : kernel
|
910
|
+
# cl_kernel_info : param_name
|
911
|
+
# size_t : param_value_size
|
912
|
+
# void * : param_value
|
913
|
+
# size_t * : param_value_size_ret
|
914
|
+
extern 'cl_int clGetKernelInfo(cl_kernel, cl_kernel_info, size_t, void *, size_t *)'
|
915
|
+
|
916
|
+
# cl_kernel : kernel
|
917
|
+
# cl_uint : arg_indx
|
918
|
+
# cl_kernel_arg_info : param_name
|
919
|
+
# size_t : param_value_size
|
920
|
+
# void * : param_value
|
921
|
+
# size_t * : param_value_size_ret
|
922
|
+
extern 'cl_int clGetKernelArgInfo(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void *, size_t *)'
|
923
|
+
|
924
|
+
# cl_kernel : kernel
|
925
|
+
# cl_device_id : device
|
926
|
+
# cl_kernel_work_group_info : param_name
|
927
|
+
# size_t : param_value_size
|
928
|
+
# void * : param_value
|
929
|
+
# size_t * : param_value_size_ret
|
930
|
+
extern 'cl_int clGetKernelWorkGroupInfo(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *)'
|
931
|
+
|
932
|
+
# Event Object APIs
|
933
|
+
|
934
|
+
# cl_uint : num_events
|
935
|
+
# const cl_event * : event_list
|
936
|
+
extern 'cl_int clWaitForEvents(cl_uint, const cl_event *)'
|
937
|
+
|
938
|
+
# cl_event : event
|
939
|
+
# cl_event_info : param_name
|
940
|
+
# size_t : param_value_size
|
941
|
+
# void * : param_value
|
942
|
+
# size_t * : param_value_size_ret
|
943
|
+
extern 'cl_int clGetEventInfo(cl_event, cl_event_info, size_t, void *, size_t *)'
|
944
|
+
|
945
|
+
# cl_context : context
|
946
|
+
# cl_int * : errcode_ret
|
947
|
+
extern 'cl_event clCreateUserEvent(cl_context, cl_int *)'
|
948
|
+
|
949
|
+
# cl_event : event
|
950
|
+
extern 'cl_int clRetainEvent(cl_event)'
|
951
|
+
|
952
|
+
# cl_event : event
|
953
|
+
extern 'cl_int clReleaseEvent(cl_event)'
|
954
|
+
|
955
|
+
# cl_event : event
|
956
|
+
# cl_int : execution_status
|
957
|
+
extern 'cl_int clSetUserEventStatus(cl_event, cl_int)'
|
958
|
+
|
959
|
+
# cl_event : event
|
960
|
+
# cl_int : command_exec_callback_type
|
961
|
+
# void * : pfn_notify(cl_event, cl_int, void)
|
962
|
+
# void * : user_data
|
963
|
+
extern 'cl_int clSetEventCallback(cl_event, cl_int, void *, void *)'
|
964
|
+
|
965
|
+
# Profiling APIs
|
966
|
+
|
967
|
+
# cl_event : event
|
968
|
+
# cl_profiling_info : param_name
|
969
|
+
# size_t : param_value_size
|
970
|
+
# void * : param_value
|
971
|
+
# size_t * : param_value_size_ret
|
972
|
+
extern 'cl_int clGetEventProfilingInfo(cl_event, cl_profiling_info, size_t, void *, size_t *)'
|
973
|
+
|
974
|
+
# Flush and Finish APIs
|
975
|
+
|
976
|
+
# cl_command_queue : command_queue
|
977
|
+
extern 'cl_int clFlush(cl_command_queue)'
|
978
|
+
|
979
|
+
# cl_command_queue : command_queue
|
980
|
+
extern 'cl_int clFinish(cl_command_queue)'
|
981
|
+
|
982
|
+
# Enqueued Commands APIs
|
983
|
+
|
984
|
+
# cl_command_queue : command_queue
|
985
|
+
# cl_mem : buffer
|
986
|
+
# cl_bool : blocking_read
|
987
|
+
# size_t : offset
|
988
|
+
# size_t : size
|
989
|
+
# void * : ptr
|
990
|
+
# cl_uint : num_events_in_wait_list
|
991
|
+
# const cl_event * : event_wait_list
|
992
|
+
# cl_event * : event
|
993
|
+
extern 'cl_int clEnqueueReadBuffer(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *)'
|
994
|
+
|
995
|
+
# cl_command_queue : command_queue
|
996
|
+
# cl_mem : buffer
|
997
|
+
# cl_bool : blocking_read
|
998
|
+
# const size_t * : buffer_offset
|
999
|
+
# const size_t * : host_offset
|
1000
|
+
# const size_t * : region
|
1001
|
+
# size_t : buffer_row_pitch
|
1002
|
+
# size_t : buffer_slice_pitch
|
1003
|
+
# size_t : host_row_pitch
|
1004
|
+
# size_t : host_slice_pitch
|
1005
|
+
# void * : ptr
|
1006
|
+
# cl_uint : num_events_in_wait_list
|
1007
|
+
# const cl_event * : event_wait_list
|
1008
|
+
# cl_event * : event
|
1009
|
+
extern 'cl_int clEnqueueReadBufferRect(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void *,cl_uint, const cl_event *, cl_event *)'
|
1010
|
+
|
1011
|
+
# cl_command_queue : command_queue
|
1012
|
+
# cl_mem : buffer
|
1013
|
+
# cl_bool : blocking_write
|
1014
|
+
# size_t : offset
|
1015
|
+
# size_t : size
|
1016
|
+
# const void * : ptr
|
1017
|
+
# cl_uint : num_events_in_wait_list
|
1018
|
+
# const cl_event * : event_wait_list
|
1019
|
+
# cl_event * : event
|
1020
|
+
extern 'cl_int clEnqueueWriteBuffer(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *)'
|
1021
|
+
|
1022
|
+
# cl_command_queue : command_queue
|
1023
|
+
# cl_mem : buffer
|
1024
|
+
# cl_bool : blocking_write
|
1025
|
+
# const size_t * : buffer_offset
|
1026
|
+
# const size_t * : host_offset
|
1027
|
+
# const size_t * : region
|
1028
|
+
# size_t : buffer_row_pitch
|
1029
|
+
# size_t : buffer_slice_pitch
|
1030
|
+
# size_t : host_row_pitch
|
1031
|
+
# size_t : host_slice_pitch
|
1032
|
+
# const void * : ptr
|
1033
|
+
# cl_uint : num_events_in_wait_list
|
1034
|
+
# const cl_event * : event_wait_list
|
1035
|
+
# cl_event * : event
|
1036
|
+
extern 'cl_int clEnqueueWriteBufferRect(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *)'
|
1037
|
+
|
1038
|
+
# cl_command_queue : command_queue
|
1039
|
+
# cl_mem : buffer
|
1040
|
+
# const void * : pattern
|
1041
|
+
# size_t : pattern_size
|
1042
|
+
# size_t : offset
|
1043
|
+
# size_t : size
|
1044
|
+
# cl_uint : num_events_in_wait_list
|
1045
|
+
# const cl_event * : event_wait_list
|
1046
|
+
# cl_event * : event
|
1047
|
+
extern 'cl_int clEnqueueFillBuffer(cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *)'
|
1048
|
+
|
1049
|
+
# cl_command_queue : command_queue
|
1050
|
+
# cl_mem : src_buffer
|
1051
|
+
# cl_mem : dst_buffer
|
1052
|
+
# size_t : src_offset
|
1053
|
+
# size_t : dst_offset
|
1054
|
+
# size_t : size
|
1055
|
+
# cl_uint : num_events_in_wait_list
|
1056
|
+
# const cl_event * : event_wait_list
|
1057
|
+
# cl_event * : event
|
1058
|
+
extern 'cl_int clEnqueueCopyBuffer(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *)'
|
1059
|
+
|
1060
|
+
# cl_command_queue : command_queue
|
1061
|
+
# cl_mem : src_buffer
|
1062
|
+
# cl_mem : dst_buffer
|
1063
|
+
# const size_t * : src_origin
|
1064
|
+
# const size_t * : dst_origin
|
1065
|
+
# const size_t * : region
|
1066
|
+
# size_t : src_row_pitch
|
1067
|
+
# size_t : src_slice_pitch
|
1068
|
+
# size_t : dst_row_pitch
|
1069
|
+
# size_t : dst_slice_pitch
|
1070
|
+
# cl_uint : num_events_in_wait_list
|
1071
|
+
# const cl_event * : event_wait_list
|
1072
|
+
# cl_event * : event
|
1073
|
+
extern 'cl_int clEnqueueCopyBufferRect(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *)'
|
1074
|
+
|
1075
|
+
# cl_command_queue : command_queue
|
1076
|
+
# cl_mem : image
|
1077
|
+
# cl_bool : blocking_read
|
1078
|
+
# const size_t * : origin[3]
|
1079
|
+
# const size_t * : region[3]
|
1080
|
+
# size_t : row_pitch
|
1081
|
+
# size_t : slice_pitch
|
1082
|
+
# void * : ptr
|
1083
|
+
# cl_uint : num_events_in_wait_list
|
1084
|
+
# const cl_event * : event_wait_list
|
1085
|
+
# cl_event * : event
|
1086
|
+
extern 'cl_int clEnqueueReadImage(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *)'
|
1087
|
+
|
1088
|
+
# cl_command_queue : command_queue
|
1089
|
+
# cl_mem : image
|
1090
|
+
# cl_bool : blocking_write
|
1091
|
+
# const size_t * : origin[3]
|
1092
|
+
# const size_t * : region[3]
|
1093
|
+
# size_t : input_row_pitch
|
1094
|
+
# size_t : input_slice_pitch
|
1095
|
+
# const void * : ptr
|
1096
|
+
# cl_uint : num_events_in_wait_list
|
1097
|
+
# const cl_event * : event_wait_list
|
1098
|
+
# cl_event * : event
|
1099
|
+
extern 'cl_int clEnqueueWriteImage(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint,const cl_event *, cl_event *)'
|
1100
|
+
|
1101
|
+
# cl_command_queue : command_queue
|
1102
|
+
# cl_mem : image
|
1103
|
+
# const void * : fill_color
|
1104
|
+
# const size_t * : origin[3]
|
1105
|
+
# const size_t * : region[3]
|
1106
|
+
# cl_uint : num_events_in_wait_list
|
1107
|
+
# const cl_event * : event_wait_list
|
1108
|
+
# cl_event * : event
|
1109
|
+
extern 'cl_int clEnqueueFillImage(cl_command_queue, cl_mem, const void *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *)'
|
1110
|
+
|
1111
|
+
# cl_command_queue : command_queue
|
1112
|
+
# cl_mem : src_image
|
1113
|
+
# cl_mem : dst_image
|
1114
|
+
# const size_t * : src_origin[3]
|
1115
|
+
# const size_t * : dst_origin[3]
|
1116
|
+
# const size_t * : region[3]
|
1117
|
+
# cl_uint : num_events_in_wait_list
|
1118
|
+
# const cl_event * : event_wait_list
|
1119
|
+
# cl_event * : event
|
1120
|
+
extern 'cl_int clEnqueueCopyImage(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *)'
|
1121
|
+
|
1122
|
+
# cl_command_queue : command_queue
|
1123
|
+
# cl_mem : src_image
|
1124
|
+
# cl_mem : dst_buffer
|
1125
|
+
# const size_t * : src_origin[3]
|
1126
|
+
# const size_t * : region[3]
|
1127
|
+
# size_t : dst_offset
|
1128
|
+
# cl_uint : num_events_in_wait_list
|
1129
|
+
# const cl_event * : event_wait_list
|
1130
|
+
# cl_event * : event
|
1131
|
+
extern 'cl_int clEnqueueCopyImageToBuffer(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *)'
|
1132
|
+
|
1133
|
+
# cl_command_queue : command_queue
|
1134
|
+
# cl_mem : src_buffer
|
1135
|
+
# cl_mem : dst_image
|
1136
|
+
# size_t : src_offset
|
1137
|
+
# const size_t * : dst_origin[3]
|
1138
|
+
# const size_t * : region[3]
|
1139
|
+
# cl_uint : num_events_in_wait_list
|
1140
|
+
# const cl_event * : event_wait_list
|
1141
|
+
# cl_event * : event
|
1142
|
+
extern 'cl_int clEnqueueCopyBufferToImage(cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *)'
|
1143
|
+
|
1144
|
+
# cl_command_queue : command_queue
|
1145
|
+
# cl_mem : buffer
|
1146
|
+
# cl_bool : blocking_map
|
1147
|
+
# cl_map_flags : map_flags
|
1148
|
+
# size_t : offset
|
1149
|
+
# size_t : size
|
1150
|
+
# cl_uint : num_events_in_wait_list
|
1151
|
+
# const cl_event * : event_wait_list
|
1152
|
+
# cl_event * : event
|
1153
|
+
# cl_int * : errcode_ret
|
1154
|
+
extern 'void * clEnqueueMapBuffer(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *)'
|
1155
|
+
|
1156
|
+
# cl_command_queue : command_queue
|
1157
|
+
# cl_mem : image
|
1158
|
+
# cl_bool : blocking_map
|
1159
|
+
# cl_map_flags : map_flags
|
1160
|
+
# const size_t * : origin[3]
|
1161
|
+
# const size_t * : region[3]
|
1162
|
+
# size_t * : image_row_pitch
|
1163
|
+
# size_t * : image_slice_pitch
|
1164
|
+
# cl_uint : num_events_in_wait_list
|
1165
|
+
# const cl_event * : event_wait_list
|
1166
|
+
# cl_event * : event
|
1167
|
+
# cl_int * : errcode_ret
|
1168
|
+
extern 'void * clEnqueueMapImage(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *)'
|
1169
|
+
|
1170
|
+
# cl_command_queue : command_queue
|
1171
|
+
# cl_mem : memobj
|
1172
|
+
# void * : mapped_ptr
|
1173
|
+
# cl_uint : num_events_in_wait_list
|
1174
|
+
# const cl_event * : event_wait_list
|
1175
|
+
# cl_event * : event
|
1176
|
+
extern 'cl_int clEnqueueUnmapMemObject(cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *)'
|
1177
|
+
|
1178
|
+
# cl_command_queue : command_queue
|
1179
|
+
# cl_uint : num_mem_objects
|
1180
|
+
# const cl_mem * : mem_objects
|
1181
|
+
# cl_mem_migration_flags : flags
|
1182
|
+
# cl_uint : num_events_in_wait_list
|
1183
|
+
# const cl_event * : event_wait_list
|
1184
|
+
# cl_event * : event
|
1185
|
+
extern 'cl_int clEnqueueMigrateMemObjects(cl_command_queue, cl_uint, const cl_mem *, cl_mem_migration_flags, cl_uint, const cl_event *, cl_event *)'
|
1186
|
+
|
1187
|
+
# cl_command_queue : command_queue
|
1188
|
+
# cl_kernel : kernel
|
1189
|
+
# cl_uint : work_dim
|
1190
|
+
# const size_t * : global_work_offset
|
1191
|
+
# const size_t * : global_work_size
|
1192
|
+
# const size_t * : local_work_size
|
1193
|
+
# cl_uint : num_events_in_wait_list
|
1194
|
+
# const cl_event * : event_wait_list
|
1195
|
+
# cl_event * : event
|
1196
|
+
extern 'cl_int clEnqueueNDRangeKernel(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *)'
|
1197
|
+
|
1198
|
+
# cl_command_queue : command_queue
|
1199
|
+
# cl_kernel : kernel
|
1200
|
+
# cl_uint : num_events_in_wait_list
|
1201
|
+
# const cl_event * : event_wait_list
|
1202
|
+
# cl_event * : event
|
1203
|
+
extern 'cl_int clEnqueueTask(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *)'
|
1204
|
+
|
1205
|
+
# cl_command_queue : command_queue
|
1206
|
+
# void * : user_func(void *)
|
1207
|
+
# void * : args
|
1208
|
+
# size_t : cb_args
|
1209
|
+
# cl_uint : num_mem_objects
|
1210
|
+
# const cl_mem * : mem_list
|
1211
|
+
# const void ** : args_mem_loc
|
1212
|
+
# cl_uint : num_events_in_wait_list
|
1213
|
+
# const cl_event * : event_wait_list
|
1214
|
+
# cl_event * : event
|
1215
|
+
extern 'cl_int clEnqueueNativeKernel(cl_command_queue, void *, void *, size_t, cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *)'
|
1216
|
+
|
1217
|
+
# cl_command_queue : command_queue
|
1218
|
+
# cl_uint : num_events_in_wait_list
|
1219
|
+
# const cl_event * : event_wait_list
|
1220
|
+
# cl_event * : event
|
1221
|
+
extern 'cl_int clEnqueueMarkerWithWaitList(cl_command_queue, cl_uint, const cl_event *, cl_event *)'
|
1222
|
+
|
1223
|
+
# cl_command_queue : command_queue
|
1224
|
+
# cl_uint : num_events_in_wait_list
|
1225
|
+
# const cl_event * : event_wait_list
|
1226
|
+
# cl_event * : event
|
1227
|
+
extern 'cl_int clEnqueueBarrierWithWaitList(cl_command_queue, cl_uint, const cl_event *, cl_event *)'
|
1228
|
+
|
1229
|
+
# Extension function access
|
1230
|
+
#
|
1231
|
+
# Returns the extension function address for the given function name,
|
1232
|
+
# or NULL if a valid function can not be found. The client must
|
1233
|
+
# check to make sure the address is not NULL, before using or
|
1234
|
+
# calling the returned function address.
|
1235
|
+
|
1236
|
+
# cl_platform_id : platform
|
1237
|
+
# const char * : func_name
|
1238
|
+
extern 'void * clGetExtensionFunctionAddressForPlatform(cl_platform_id, const char *)'
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
def self.import_symbols
|
1242
|
+
# type (from cl_platform.h)
|
1243
|
+
|
1244
|
+
# scalar types
|
1245
|
+
typealias 'cl_char', 'char'
|
1246
|
+
typealias 'cl_uchar', 'unsigned char'
|
1247
|
+
typealias 'cl_short', 'short'
|
1248
|
+
typealias 'cl_ushort', 'unsigned short'
|
1249
|
+
typealias 'cl_int', 'int'
|
1250
|
+
typealias 'cl_uint', 'unsigned int'
|
1251
|
+
typealias 'cl_long', 'long'
|
1252
|
+
typealias 'cl_ulong', 'unsigned long'
|
1253
|
+
|
1254
|
+
typealias 'cl_half', 'unsigned short'
|
1255
|
+
typealias 'cl_float', 'float'
|
1256
|
+
typealias 'cl_double', 'double'
|
1257
|
+
|
1258
|
+
typealias 'cl_GLuint', 'unsigned int'
|
1259
|
+
typealias 'cl_GLint', 'int'
|
1260
|
+
typealias 'cl_GLenum', 'unsigned int'
|
1261
|
+
|
1262
|
+
# type (from cl.h)
|
1263
|
+
|
1264
|
+
# opaque pointers
|
1265
|
+
typealias 'cl_platform_id', 'void*'
|
1266
|
+
typealias 'cl_device_id', 'void*'
|
1267
|
+
typealias 'cl_context', 'void*'
|
1268
|
+
typealias 'cl_command_queue', 'void*'
|
1269
|
+
typealias 'cl_mem', 'void*'
|
1270
|
+
typealias 'cl_program', 'void*'
|
1271
|
+
typealias 'cl_kernel', 'void*'
|
1272
|
+
typealias 'cl_event', 'void*'
|
1273
|
+
typealias 'cl_sampler', 'void*'
|
1274
|
+
|
1275
|
+
# aliases
|
1276
|
+
typealias 'cl_bool', 'cl_uint'
|
1277
|
+
typealias 'cl_bitfield', 'cl_ulong'
|
1278
|
+
typealias 'cl_device_type', 'cl_bitfield'
|
1279
|
+
typealias 'cl_platform_info', 'cl_uint'
|
1280
|
+
typealias 'cl_device_info', 'cl_uint'
|
1281
|
+
typealias 'cl_device_fp_config', 'cl_bitfield'
|
1282
|
+
typealias 'cl_device_mem_cache_type', 'cl_uint'
|
1283
|
+
typealias 'cl_device_local_mem_type', 'cl_uint'
|
1284
|
+
typealias 'cl_device_exec_capabilities', 'cl_bitfield'
|
1285
|
+
typealias 'cl_command_queue_properties', 'cl_bitfield'
|
1286
|
+
typealias 'cl_device_partition_property', 'intptr_t'
|
1287
|
+
typealias 'cl_device_affinity_domain', 'cl_bitfield'
|
1288
|
+
|
1289
|
+
typealias 'cl_context_properties', 'intptr_t'
|
1290
|
+
typealias 'cl_context_info', 'cl_uint'
|
1291
|
+
typealias 'cl_command_queue_info', 'cl_uint'
|
1292
|
+
typealias 'cl_channel_order', 'cl_uint'
|
1293
|
+
typealias 'cl_channel_type', 'cl_uint'
|
1294
|
+
typealias 'cl_mem_flags', 'cl_bitfield'
|
1295
|
+
typealias 'cl_mem_object_type', 'cl_uint'
|
1296
|
+
typealias 'cl_mem_info', 'cl_uint'
|
1297
|
+
typealias 'cl_mem_migration_flags', 'cl_bitfield'
|
1298
|
+
typealias 'cl_image_info', 'cl_uint'
|
1299
|
+
typealias 'cl_buffer_create_type', 'cl_uint'
|
1300
|
+
typealias 'cl_addressing_mode', 'cl_uint'
|
1301
|
+
typealias 'cl_filter_mode', 'cl_uint'
|
1302
|
+
typealias 'cl_sampler_info', 'cl_uint'
|
1303
|
+
typealias 'cl_map_flags', 'cl_bitfield'
|
1304
|
+
typealias 'cl_program_info', 'cl_uint'
|
1305
|
+
typealias 'cl_program_build_info', 'cl_uint'
|
1306
|
+
typealias 'cl_program_binary_type', 'cl_uint'
|
1307
|
+
typealias 'cl_build_status', 'cl_int'
|
1308
|
+
typealias 'cl_kernel_info', 'cl_uint'
|
1309
|
+
typealias 'cl_kernel_arg_info', 'cl_uint'
|
1310
|
+
typealias 'cl_kernel_arg_address_qualifier', 'cl_uint'
|
1311
|
+
typealias 'cl_kernel_arg_access_qualifier', 'cl_uint'
|
1312
|
+
typealias 'cl_kernel_arg_type_qualifier', 'cl_bitfield'
|
1313
|
+
typealias 'cl_kernel_work_group_info', 'cl_uint'
|
1314
|
+
typealias 'cl_event_info', 'cl_uint'
|
1315
|
+
typealias 'cl_command_type', 'cl_uint'
|
1316
|
+
typealias 'cl_profiling_info', 'cl_uint'
|
1317
|
+
|
1318
|
+
self.import_functions_cl()
|
1319
|
+
|
1320
|
+
@@cl_import_done = true
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
=begin
|
1326
|
+
Ruby-OpenCL : Yet another OpenCL wrapper for Ruby
|
1327
|
+
Copyright (c) 2015 vaiorabbit <http://twitter.com/vaiorabbit>
|
1328
|
+
|
1329
|
+
This software is provided 'as-is', without any express or implied
|
1330
|
+
warranty. In no event will the authors be held liable for any damages
|
1331
|
+
arising from the use of this software.
|
1332
|
+
|
1333
|
+
Permission is granted to anyone to use this software for any purpose,
|
1334
|
+
including commercial applications, and to alter it and redistribute it
|
1335
|
+
freely, subject to the following restrictions:
|
1336
|
+
|
1337
|
+
1. The origin of this software must not be misrepresented; you must not
|
1338
|
+
claim that you wrote the original software. If you use this software
|
1339
|
+
in a product, an acknowledgment in the product documentation would be
|
1340
|
+
appreciated but is not required.
|
1341
|
+
|
1342
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
1343
|
+
misrepresented as being the original software.
|
1344
|
+
|
1345
|
+
3. This notice may not be removed or altered from any source
|
1346
|
+
distribution.
|
1347
|
+
=end
|