pyopencl 2024.2.2__cp312-cp312-win_amd64.whl → 2024.2.4__cp312-cp312-win_amd64.whl

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.

Potentially problematic release.


This version of pyopencl might be problematic. Click here for more details.

Files changed (102) hide show
  1. pyopencl/__init__.py +16 -4
  2. pyopencl/_cl.cp312-win_amd64.pyd +0 -0
  3. pyopencl/algorithm.py +3 -1
  4. pyopencl/bitonic_sort.py +2 -0
  5. pyopencl/characterize/__init__.py +23 -0
  6. pyopencl/compyte/.git +1 -0
  7. pyopencl/compyte/.github/workflows/autopush.yml +21 -0
  8. pyopencl/compyte/.github/workflows/ci.yml +30 -0
  9. pyopencl/compyte/.gitignore +21 -0
  10. pyopencl/compyte/ndarray/Makefile +31 -0
  11. pyopencl/compyte/ndarray/gpu_ndarray.h +35 -0
  12. pyopencl/compyte/ndarray/pygpu_language.h +207 -0
  13. pyopencl/compyte/ndarray/pygpu_language_cuda.cu +622 -0
  14. pyopencl/compyte/ndarray/pygpu_language_opencl.cpp +317 -0
  15. pyopencl/compyte/ndarray/pygpu_ndarray.cpp +1546 -0
  16. pyopencl/compyte/ndarray/pygpu_ndarray.h +71 -0
  17. pyopencl/compyte/ndarray/pygpu_ndarray_object.h +232 -0
  18. pyopencl/compyte/setup.cfg +9 -0
  19. pyopencl/tools.py +60 -56
  20. pyopencl/version.py +7 -3
  21. {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.4.dist-info}/METADATA +105 -105
  22. pyopencl-2024.2.4.dist-info/RECORD +59 -0
  23. {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.4.dist-info}/WHEEL +1 -1
  24. pyopencl-2024.2.2.data/data/CITATION.cff +0 -74
  25. pyopencl-2024.2.2.data/data/CMakeLists.txt +0 -83
  26. pyopencl-2024.2.2.data/data/Makefile.in +0 -21
  27. pyopencl-2024.2.2.data/data/README.rst +0 -70
  28. pyopencl-2024.2.2.data/data/README_SETUP.txt +0 -34
  29. pyopencl-2024.2.2.data/data/aksetup_helper.py +0 -1013
  30. pyopencl-2024.2.2.data/data/configure.py +0 -6
  31. pyopencl-2024.2.2.data/data/contrib/cldis.py +0 -91
  32. pyopencl-2024.2.2.data/data/contrib/fortran-to-opencl/README +0 -29
  33. pyopencl-2024.2.2.data/data/contrib/fortran-to-opencl/translate.py +0 -1441
  34. pyopencl-2024.2.2.data/data/contrib/pyopencl.vim +0 -84
  35. pyopencl-2024.2.2.data/data/doc/Makefile +0 -23
  36. pyopencl-2024.2.2.data/data/doc/algorithm.rst +0 -214
  37. pyopencl-2024.2.2.data/data/doc/array.rst +0 -305
  38. pyopencl-2024.2.2.data/data/doc/conf.py +0 -26
  39. pyopencl-2024.2.2.data/data/doc/howto.rst +0 -105
  40. pyopencl-2024.2.2.data/data/doc/index.rst +0 -137
  41. pyopencl-2024.2.2.data/data/doc/make_constants.py +0 -561
  42. pyopencl-2024.2.2.data/data/doc/misc.rst +0 -885
  43. pyopencl-2024.2.2.data/data/doc/runtime.rst +0 -51
  44. pyopencl-2024.2.2.data/data/doc/runtime_const.rst +0 -30
  45. pyopencl-2024.2.2.data/data/doc/runtime_gl.rst +0 -78
  46. pyopencl-2024.2.2.data/data/doc/runtime_memory.rst +0 -527
  47. pyopencl-2024.2.2.data/data/doc/runtime_platform.rst +0 -184
  48. pyopencl-2024.2.2.data/data/doc/runtime_program.rst +0 -364
  49. pyopencl-2024.2.2.data/data/doc/runtime_queue.rst +0 -182
  50. pyopencl-2024.2.2.data/data/doc/subst.rst +0 -36
  51. pyopencl-2024.2.2.data/data/doc/tools.rst +0 -4
  52. pyopencl-2024.2.2.data/data/doc/types.rst +0 -42
  53. pyopencl-2024.2.2.data/data/examples/black-hole-accretion.py +0 -2227
  54. pyopencl-2024.2.2.data/data/examples/demo-struct-reduce.py +0 -75
  55. pyopencl-2024.2.2.data/data/examples/demo.py +0 -39
  56. pyopencl-2024.2.2.data/data/examples/demo_array.py +0 -32
  57. pyopencl-2024.2.2.data/data/examples/demo_array_svm.py +0 -37
  58. pyopencl-2024.2.2.data/data/examples/demo_elementwise.py +0 -34
  59. pyopencl-2024.2.2.data/data/examples/demo_elementwise_complex.py +0 -53
  60. pyopencl-2024.2.2.data/data/examples/demo_mandelbrot.py +0 -183
  61. pyopencl-2024.2.2.data/data/examples/demo_meta_codepy.py +0 -56
  62. pyopencl-2024.2.2.data/data/examples/demo_meta_template.py +0 -55
  63. pyopencl-2024.2.2.data/data/examples/dump-performance.py +0 -38
  64. pyopencl-2024.2.2.data/data/examples/dump-properties.py +0 -86
  65. pyopencl-2024.2.2.data/data/examples/gl_interop_demo.py +0 -84
  66. pyopencl-2024.2.2.data/data/examples/gl_particle_animation.py +0 -218
  67. pyopencl-2024.2.2.data/data/examples/ipython-demo.ipynb +0 -203
  68. pyopencl-2024.2.2.data/data/examples/median-filter.py +0 -99
  69. pyopencl-2024.2.2.data/data/examples/n-body.py +0 -1070
  70. pyopencl-2024.2.2.data/data/examples/narray.py +0 -37
  71. pyopencl-2024.2.2.data/data/examples/noisyImage.jpg +0 -0
  72. pyopencl-2024.2.2.data/data/examples/pi-monte-carlo.py +0 -1166
  73. pyopencl-2024.2.2.data/data/examples/svm.py +0 -82
  74. pyopencl-2024.2.2.data/data/examples/transpose.py +0 -229
  75. pyopencl-2024.2.2.data/data/pytest.ini +0 -3
  76. pyopencl-2024.2.2.data/data/src/bitlog.cpp +0 -51
  77. pyopencl-2024.2.2.data/data/src/bitlog.hpp +0 -83
  78. pyopencl-2024.2.2.data/data/src/clinfo_ext.h +0 -134
  79. pyopencl-2024.2.2.data/data/src/mempool.hpp +0 -444
  80. pyopencl-2024.2.2.data/data/src/pyopencl_ext.h +0 -77
  81. pyopencl-2024.2.2.data/data/src/tools.hpp +0 -90
  82. pyopencl-2024.2.2.data/data/src/wrap_cl.cpp +0 -61
  83. pyopencl-2024.2.2.data/data/src/wrap_cl.hpp +0 -5853
  84. pyopencl-2024.2.2.data/data/src/wrap_cl_part_1.cpp +0 -369
  85. pyopencl-2024.2.2.data/data/src/wrap_cl_part_2.cpp +0 -702
  86. pyopencl-2024.2.2.data/data/src/wrap_constants.cpp +0 -1274
  87. pyopencl-2024.2.2.data/data/src/wrap_helpers.hpp +0 -213
  88. pyopencl-2024.2.2.data/data/src/wrap_mempool.cpp +0 -738
  89. pyopencl-2024.2.2.data/data/test/add-vectors-32.spv +0 -0
  90. pyopencl-2024.2.2.data/data/test/add-vectors-64.spv +0 -0
  91. pyopencl-2024.2.2.data/data/test/empty-header.h +0 -1
  92. pyopencl-2024.2.2.data/data/test/test_algorithm.py +0 -1180
  93. pyopencl-2024.2.2.data/data/test/test_array.py +0 -2392
  94. pyopencl-2024.2.2.data/data/test/test_arrays_in_structs.py +0 -100
  95. pyopencl-2024.2.2.data/data/test/test_clmath.py +0 -529
  96. pyopencl-2024.2.2.data/data/test/test_clrandom.py +0 -75
  97. pyopencl-2024.2.2.data/data/test/test_enqueue_copy.py +0 -271
  98. pyopencl-2024.2.2.data/data/test/test_wrapper.py +0 -1565
  99. pyopencl-2024.2.2.dist-info/LICENSE +0 -282
  100. pyopencl-2024.2.2.dist-info/RECORD +0 -123
  101. pyopencl-2024.2.2.dist-info/top_level.txt +0 -1
  102. {pyopencl-2024.2.2.data/data → pyopencl-2024.2.4.dist-info/licenses}/LICENSE +0 -0
@@ -1,184 +0,0 @@
1
- .. include:: subst.rst
2
-
3
- OpenCL Runtime: Platforms, Devices and Contexts
4
- ===============================================
5
-
6
- .. currentmodule:: pyopencl
7
-
8
- Platform
9
- --------
10
-
11
- .. function:: get_platforms()
12
-
13
- Return a list of :class:`Platform` instances.
14
-
15
- .. class:: Platform
16
-
17
- .. attribute:: info
18
-
19
- Lower case versions of the :class:`platform_info` constants
20
- may be used as attributes on instances of this class
21
- to directly query info attributes.
22
-
23
- .. method:: get_info(param)
24
-
25
- See :class:`platform_info` for values of *param*.
26
-
27
- .. method:: get_devices(device_type=device_type.ALL)
28
-
29
- Return a list of devices matching *device_type*.
30
- See :class:`device_type` for values of *device_type*.
31
-
32
- .. versionchanged:: 2013.2
33
-
34
- This used to raise an exception if no matching
35
- devices were found. Now, it will simply return
36
- an empty list.
37
-
38
- .. automethod:: from_int_ptr
39
- .. autoattribute:: int_ptr
40
-
41
- |comparable|
42
-
43
- Device
44
- ------
45
-
46
- .. class:: Device
47
-
48
- Two instances of this class may be compared using *=="* and *"!="*.
49
-
50
- .. attribute:: info
51
-
52
- Lower case versions of the :class:`device_info` constants
53
- may be used as attributes on instances of this class
54
- to directly query info attributes.
55
-
56
- .. method:: get_info(param)
57
-
58
- See :class:`device_info` for values of *param*.
59
-
60
- .. automethod:: from_int_ptr
61
- .. autoattribute:: int_ptr
62
-
63
- .. attribute :: hashable_model_and_version_identifier
64
-
65
- An unspecified data type that can be used to (as precisely as possible,
66
- given identifying information available in OpenCL) identify a given
67
- model and software stack version of a compute device. Note that this
68
- identifier does not differentiate between different instances of the
69
- same device installed in a single host.
70
-
71
- The returned data type is hashable.
72
-
73
- .. versionadded:: 2020.1
74
-
75
- .. method:: create_sub_devices(properties)
76
-
77
- *properties* is an array of one (or more) of the forms::
78
-
79
- [ dpp.EQUALLY, 8]
80
- [ dpp.BY_COUNTS, 5, 7, 9, dpp.PARTITION_BY_COUNTS_LIST_END]
81
- [ dpp.BY_NAMES, 5, 7, 9, dpp.PARTITION_BY_NAMES_LIST_END]
82
- [ dpp.BY_AFFINITY_DOMAIN, dad.L1_CACHE]
83
-
84
- where ``dpp`` represents :class:`device_partition_property`
85
- and ``dad`` represent :class:`device_affinity_domain`.
86
-
87
- ``PROPERTIES_LIST_END_EXT`` is added automatically.
88
-
89
- Only available with CL 1.2.
90
-
91
- .. versionadded:: 2011.2
92
-
93
- .. method:: device_and_host_timer
94
-
95
- :returns: a tuple ``(device_timestamp, host_timestamp)``.
96
-
97
- Only available with CL 2.0.
98
-
99
- .. versionadded:: 2020.3
100
-
101
- .. method:: host_timer
102
-
103
- Only available with CL 2.0.
104
-
105
- .. versionadded:: 2020.3
106
-
107
- .. autofunction:: choose_devices
108
-
109
- Context
110
- -------
111
-
112
- .. class:: Context(devices=None, properties=None, dev_type=None, cache_dir=None)
113
-
114
- Create a new context. *properties* is a list of key-value
115
- tuples, where each key must be one of :class:`context_properties`.
116
- At most one of *devices* and *dev_type* may be not *None*, where
117
- *devices* is a list of :class:`Device` instances, and
118
- *dev_type* is one of the :class:`device_type` constants.
119
- If neither is specified, a context with a *dev_type* of
120
- :attr:`device_type.DEFAULT` is created.
121
-
122
- If *cache_dir* is not *None* - it will be used as default *cache_dir*
123
- for all its' :class:`Program` instances builds (see also :meth:`Program.build`).
124
-
125
- .. note::
126
-
127
- Calling the constructor with no arguments will fail for
128
- CL drivers that support the OpenCL ICD (which applies to most modern systems).
129
- If you want similar, just-give-me-a-context-already behavior, we recommend
130
- :func:`create_some_context`. See, e.g. this
131
- `explanation by AMD
132
- <https://web.archive.org/web/20101114195033/https://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71>`__.
133
-
134
- .. note::
135
-
136
- Because of how OpenCL changed in order to support Installable Client
137
- Drivers (ICDs) in OpenCL 1.1, the following will *look* reasonable
138
- but often actually not work::
139
-
140
- import pyopencl as cl
141
- ctx = cl.Context(dev_type=cl.device_type.ALL)
142
-
143
- Instead, make sure to choose a platform when choosing a device by type::
144
-
145
- import pyopencl as cl
146
-
147
- platforms = cl.get_platforms()
148
- ctx = cl.Context(
149
- dev_type=cl.device_type.ALL,
150
- properties=[(cl.context_properties.PLATFORM, platforms[0])])
151
-
152
- .. note::
153
-
154
- For
155
- ``context_properties.CL_GL_CONTEXT_KHR``,
156
- ``context_properties.CL_EGL_DISPLAY_KHR``,
157
- ``context_properties.CL_GLX_DISPLAY_KHR``,
158
- ``context_properties.CL_WGL_HDC_KHR``, and
159
- ``context_properties.CL_CGL_SHAREGROUP_KHR``
160
- ``context_properties.CL_CGL_SHAREGROUP_APPLE``
161
- the value in the key-value pair is a PyOpenGL context or display
162
- instance.
163
-
164
- .. versionchanged:: 0.91.2
165
- Constructor arguments *dev_type* added.
166
-
167
- .. attribute:: info
168
-
169
- Lower case versions of the :class:`context_info` constants
170
- may be used as attributes on instances of this class
171
- to directly query info attributes.
172
-
173
- .. method:: get_info(param)
174
-
175
- See :class:`context_info` for values of *param*.
176
-
177
- .. automethod:: from_int_ptr
178
- .. autoattribute:: int_ptr
179
-
180
- .. method:: set_default_device_command_queue(dev, queue)
181
-
182
- |comparable|
183
-
184
- .. autofunction:: create_some_context
@@ -1,364 +0,0 @@
1
- .. include:: subst.rst
2
-
3
- OpenCL Runtime: Programs and Kernels
4
- ====================================
5
-
6
- .. currentmodule:: pyopencl
7
-
8
- Program
9
- -------
10
-
11
- .. envvar:: PYOPENCL_NO_CACHE
12
-
13
- By default, PyOpenCL will use cached (on disk) "binaries" returned by the
14
- OpenCL runtime when calling :meth:`Program.build` on a program
15
- constructed with source. (It will depend on the ICD in use how much
16
- compilation work is saved by this.)
17
- By setting the environment variable :envvar:`PYOPENCL_NO_CACHE` to any
18
- string that :func:`pytools.strtobool` evaluates as ``True``, this caching
19
- is suppressed. No additional in-memory caching is performed. To retain the
20
- compiled version of a kernel in memory, simply retain the :class:`Program`
21
- and/or :class:`Kernel` objects.
22
-
23
- PyOpenCL will also cache "invokers", which are short snippets of Python
24
- that are generated to accelerate passing arguments to and enqueuing
25
- a kernel.
26
-
27
- .. versionadded:: 2013.1
28
-
29
- .. envvar:: PYOPENCL_COMPILER_OUTPUT
30
-
31
- When setting the environment variable :envvar:`PYOPENCL_COMPILER_OUTPUT`
32
- to any string that :func:`pytools.strtobool` evaluates as ``True``,
33
- PyOpenCL will show compiler messages emitted during program build.
34
-
35
- .. envvar:: PYOPENCL_BUILD_OPTIONS
36
-
37
- Any options found in the environment variable
38
- :envvar:`PYOPENCL_BUILD_OPTIONS` will be appended to *options*
39
- in :meth:`Program.build`.
40
-
41
- .. versionadded:: 2013.1
42
-
43
- .. class:: Program(context, src)
44
- Program(context, devices, binaries)
45
-
46
- *binaries* must contain one binary for each entry in *devices*.
47
- If *src* is a :class:`bytes` object starting with a valid `SPIR-V
48
- <https://www.khronos.org/spir>`__ magic number, it will be handed
49
- off to the OpenCL implementation as such, rather than as OpenCL C source
50
- code. (SPIR-V support requires OpenCL 2.1.)
51
-
52
- .. versionchanged:: 2016.2
53
-
54
- Add support for SPIR-V.
55
-
56
- .. attribute:: info
57
-
58
- Lower case versions of the :class:`program_info` constants
59
- may be used as attributes on instances of this class
60
- to directly query info attributes.
61
-
62
- .. method:: get_info(param)
63
-
64
- See :class:`program_info` for values of *param*.
65
-
66
- .. method:: get_build_info(device, param)
67
-
68
- See :class:`program_build_info` for values of *param*.
69
-
70
- .. method:: build(options=[], devices=None, cache_dir=None)
71
-
72
- *options* is a string of compiler flags.
73
- Returns *self*.
74
-
75
- If *cache_dir* is not None - built binaries are cached in an on-disk cache
76
- with given path.
77
- If passed *cache_dir* is None, but context of this program was created with
78
- not-None cache_dir - it will be used as cache directory.
79
- If passed *cache_dir* is None and context was created with None cache_dir:
80
- built binaries will be cached in an on-disk cache called
81
- :file:`pyopencl-compiler-cache-vN-uidNAME-pyVERSION` in the directory
82
- returned by :func:`tempfile.gettempdir`.
83
-
84
- See also :envvar:`PYOPENCL_NO_CACHE`, :envvar:`PYOPENCL_BUILD_OPTIONS`.
85
-
86
- .. versionchanged:: 2011.1
87
-
88
- *options* may now also be a :class:`list` of :class:`str`.
89
-
90
- .. method:: compile(self, options=[], devices=None, headers=[])
91
-
92
- :param headers: a list of tuples *(name, program)*.
93
-
94
- Only available with CL 1.2.
95
-
96
- .. versionadded:: 2011.2
97
-
98
- .. attribute:: kernel_name
99
-
100
- You may use ``program.kernel_name`` to obtain a :class:`Kernel`
101
- object from a program. Note that every lookup of this type
102
- produces a new kernel object, so that this **won't** work::
103
-
104
- prg.sum.set_args(a_g, b_g, res_g)
105
- ev = cl.enqueue_nd_range_kernel(queue, prg.sum, a_np.shape, None)
106
-
107
- Instead, either use the (recommended, stateless) calling interface::
108
-
109
- sum_knl = prg.sum
110
- sum_knl(queue, a_np.shape, None, a_g, b_g, res_g)
111
-
112
- or the long, stateful way around, if you prefer::
113
-
114
- sum_knl.set_args(a_g, b_g, res_g)
115
- ev = cl.enqueue_nd_range_kernel(queue, sum_knl, a_np.shape, None)
116
-
117
- The following will also work, however note that a number of caches that
118
- are important for efficient kernel enqueue are attached to the :class:`Kernel`
119
- object, and these caches will be ineffective in this usage pattern::
120
-
121
- prg.sum(queue, a_np.shape, None, a_g, b_g, res_g)
122
-
123
- Note that the :class:`Program` has to be built (see :meth:`build`) in
124
- order for this to work simply by attribute lookup.
125
-
126
- .. note::
127
-
128
- The :class:`program_info` attributes live
129
- in the same name space and take precedence over
130
- :class:`Kernel` names.
131
-
132
- .. method:: all_kernels()
133
-
134
- Returns a list of all :class:`Kernel` objects in the :class:`Program`.
135
-
136
- .. method:: set_specialization_constant(spec_id, buffer)
137
-
138
- Only available with CL 2.2 and newer.
139
-
140
- .. versionadded:: 2020.3
141
-
142
- .. automethod:: from_int_ptr
143
- .. autoattribute:: int_ptr
144
-
145
- |comparable|
146
-
147
- .. function:: create_program_with_built_in_kernels(context, devices, kernel_names)
148
-
149
- Only available with CL 1.2.
150
-
151
- .. versionadded:: 2011.2
152
-
153
- .. function:: link_program(context, programs, options=[], devices=None)
154
-
155
- Only available with CL 1.2.
156
-
157
- .. versionadded:: 2011.2
158
-
159
- .. function:: unload_platform_compiler(platform)
160
-
161
- Only available with CL 1.2.
162
-
163
- .. versionadded:: 2011.2
164
-
165
- Kernel
166
- ------
167
-
168
- .. class:: Kernel(program, name)
169
-
170
- .. attribute:: info
171
-
172
- Lower case versions of the :class:`kernel_info` constants
173
- may be used as attributes on instances of this class
174
- to directly query info attributes.
175
-
176
- .. method:: clone()
177
-
178
- Only available with CL 2.1.
179
-
180
- .. versionadded:: 2020.3
181
-
182
- .. method:: get_info(param)
183
-
184
- See :class:`kernel_info` for values of *param*.
185
-
186
- .. method:: get_work_group_info(param, device)
187
-
188
- See :class:`kernel_work_group_info` for values of *param*.
189
-
190
- .. method:: get_arg_info(arg_index, param)
191
-
192
- See :class:`kernel_arg_info` for values of *param*.
193
-
194
- Only available in OpenCL 1.2 and newer.
195
-
196
- .. method:: get_sub_group_info(self, device, param, input_value=None)
197
-
198
- When the OpenCL spec requests *input_value* to be of type ``size_t``,
199
- these may be passed directly as a number. When it requests
200
- *input_value* to be of type ``size_t *``, a tuple of integers
201
- may be passed.
202
-
203
- Only available in OpenCL 2.1 and newer.
204
-
205
- .. versionadded:: 2020.3
206
-
207
- .. method:: set_arg(self, index, arg)
208
-
209
- *arg* may be
210
-
211
- * *None*: This may be passed for ``__global`` memory references
212
- to pass a *NULL* pointer to the kernel.
213
- * Anything that satisfies the Python buffer interface,
214
- in particular :class:`numpy.ndarray`, :class:`str`,
215
- or :mod:`numpy`'s sized scalars, such as :class:`numpy.int32`
216
- or :class:`numpy.float64`.
217
-
218
- .. note::
219
-
220
- Note that Python's own :class:`int` or :class:`float`
221
- objects will not work out of the box. See
222
- :meth:`Kernel.set_scalar_arg_dtypes` for a way to make
223
- them work. Alternatively, the standard library module
224
- :mod:`struct` can be used to convert Python's native
225
- number types to binary data in a :class:`str`.
226
-
227
- * An instance of :class:`MemoryObject`. (e.g. :class:`Buffer`,
228
- :class:`Image`, etc.)
229
- * An instance of :class:`LocalMemory`.
230
- * An instance of :class:`Sampler`.
231
- * An instance of :class:`CommandQueue`. (CL 2.0 and higher only)
232
-
233
- .. method:: set_args(self, *args)
234
-
235
- Invoke :meth:`set_arg` on each element of *args* in turn.
236
-
237
- .. versionadded:: 0.92
238
-
239
- .. method:: set_scalar_arg_dtypes(arg_dtypes)
240
-
241
- Inform the wrapper about the sized types of scalar
242
- :class:`Kernel` arguments. For each argument,
243
- *arg_dtypes* contains an entry. For non-scalars,
244
- this must be *None*. For scalars, it must be an
245
- object acceptable to the :class:`numpy.dtype`
246
- constructor, indicating that the corresponding
247
- scalar argument is of that type.
248
-
249
- After invoking this function with the proper information,
250
- most suitable number types will automatically be
251
- cast to the right type for kernel invocation.
252
-
253
- .. note ::
254
-
255
- The information set by this method is attached to a single kernel
256
- instance. A new kernel instance is created every time you use
257
- `program.kernel` attribute access. The following will therefore not
258
- work::
259
-
260
- prg = cl.Program(...).build()
261
- prg.kernel.set_scalar_arg_dtypes(...)
262
- prg.kernel(queue, n_globals, None, args)
263
-
264
-
265
- .. method:: __call__(queue, global_size, local_size, *args, global_offset=None, wait_for=None, g_times_l=False, allow_empty_ndrange=False)
266
-
267
- Use :func:`enqueue_nd_range_kernel` to enqueue a kernel execution, after using
268
- :meth:`set_args` to set each argument in turn. See the documentation for
269
- :meth:`set_arg` to see what argument types are allowed.
270
-
271
- |glsize|
272
-
273
- |empty-nd-range|
274
-
275
- |std-enqueue-blurb|
276
-
277
- .. note::
278
-
279
- :meth:`__call__` is *not* thread-safe. It sets the arguments using :meth:`set_args`
280
- and then runs :func:`enqueue_nd_range_kernel`. Another thread could race it
281
- in doing the same things, with undefined outcome. This issue is inherited
282
- from the C-level OpenCL API. The recommended solution is to make a kernel
283
- (i.e. access ``prg.kernel_name``, which corresponds to making a new kernel)
284
- for every thread that may enqueue calls to the kernel.
285
-
286
- A solution involving implicit locks was discussed and decided against on the
287
- mailing list in `October 2012
288
- <https://lists.tiker.net/pipermail/pyopencl/2012-October/001311.html>`__.
289
-
290
- .. versionchanged:: 0.92
291
-
292
- *local_size* was promoted to third positional argument from being a
293
- keyword argument. The old keyword argument usage will continue to
294
- be accepted with a warning throughout the 0.92 release cycle.
295
- This is a backward-compatible change (just barely!) because
296
- *local_size* as third positional argument can only be a
297
- :class:`tuple` or *None*. :class:`tuple` instances are never valid
298
- :class:`Kernel` arguments, and *None* is valid as an argument, but
299
- its treatment in the wrapper had a bug (now fixed) that prevented
300
- it from working.
301
-
302
- .. versionchanged:: 2011.1
303
-
304
- Added the *g_times_l* keyword arg.
305
-
306
- .. versionchanged:: 2020.2
307
-
308
- Added the *allow_empty_ndrange* keyword argument.
309
-
310
- .. method:: capture_call(output_file, queue, global_size, local_size, *args, global_offset=None, wait_for=None, g_times_l=False)
311
-
312
- This method supports the exact same interface as :meth:`__call__`, but
313
- instead of invoking the kernel, it writes a self-contained PyOpenCL program
314
- to *filename* that reproduces this invocation. Data and kernel source code
315
- will be packaged up in *filename*'s source code.
316
-
317
- This is mainly intended as a debugging aid. For example, it can be used
318
- to automate the task of creating a small, self-contained test case for
319
- an observed problem. It can also help separate a misbehaving kernel from
320
- a potentially large or time-consuming outer code.
321
-
322
- :arg output_file: a a filename or a file-like to which the generated
323
- code is to be written.
324
-
325
- To use, simply change::
326
-
327
- evt = my_kernel(queue, gsize, lsize, arg1, arg2, ...)
328
-
329
- to::
330
-
331
- evt = my_kernel.capture_call("bug.py", queue, gsize, lsize, arg1, arg2, ...)
332
-
333
- .. versionadded:: 2013.1
334
-
335
- .. automethod:: from_int_ptr
336
- .. autoattribute:: int_ptr
337
-
338
- |comparable|
339
-
340
- .. class:: LocalMemory(size)
341
-
342
- A helper class to pass ``__local`` memory arguments to kernels.
343
-
344
- .. versionadded:: 0.91.2
345
-
346
- .. attribute:: size
347
-
348
- The size of local buffer in bytes to be provided.
349
-
350
- .. function:: enqueue_nd_range_kernel(queue, kernel, global_work_size, local_work_size, global_work_offset=None, wait_for=None, g_times_l=False, allow_empty_ndrange=False)
351
-
352
- |glsize|
353
-
354
- |empty-nd-range|
355
-
356
- |std-enqueue-blurb|
357
-
358
- .. versionchanged:: 2011.1
359
-
360
- Added the *g_times_l* keyword arg.
361
-
362
- .. versionchanged:: 2020.2
363
-
364
- Added the *allow_empty_ndrange* keyword argument.