pyopencl 2024.2.2__cp311-cp311-macosx_11_0_arm64.whl → 2024.2.4__cp311-cp311-macosx_11_0_arm64.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.cpython-311-darwin.so +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 +14 -14
  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,84 +0,0 @@
1
- " Vim highlighting for PyOpenCL
2
- " -----------------------------
3
- "
4
- " (C) Andreas Kloeckner 2011, MIT license
5
- "
6
- " Uses parts of mako.vim by Armin Ronacher.
7
- "
8
- " Installation:
9
- " Just drop this file into ~/.vim/syntax/pyopencl.vim
10
- "
11
- " Then do
12
- " :set filetype=pyopencl
13
- " and use
14
- " """//CL// ...code..."""
15
- " for OpenCL code included in your Python file.
16
- "
17
- " You may also include a line
18
- " vim: filetype=pyopencl.python
19
- " at the end of your file to set the file type automatically.
20
- "
21
- " Optional: Install opencl.vim from
22
- " http://www.vim.org/scripts/script.php?script_id=3157
23
-
24
- runtime! syntax/python.vim
25
-
26
- unlet b:current_syntax
27
- try
28
- syntax include @clCode syntax/opencl.vim
29
- catch
30
- syntax include @clCode syntax/c.vim
31
- endtry
32
-
33
- unlet b:current_syntax
34
- syn include @pythonTop syntax/python.vim
35
-
36
- " {{{ mako
37
-
38
- syn region clmakoLine start="^\s*%" skip="\\$" end="$"
39
- syn region clmakoVariable start=#\${# end=#}# contains=@pythonTop
40
- syn region clmakoBlock start=#<%!# end=#%># keepend contains=@pythonTop
41
-
42
- syn match clmakoAttributeKey containedin=clmakoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
43
- syn region clmakoAttributeValue containedin=clmakoTag contained start=/"/ skip=/\\"/ end=/"/
44
- syn region clmakoAttributeValue containedin=clmakoTag contained start=/'/ skip=/\\'/ end=/'/
45
-
46
- syn region clmakoTag start="</\?%\(def\|call\|page\|include\|namespace\|inherit\|self:[_[:alnum:]]\+\)\>" end="/\?>"
47
-
48
- " The C highlighter's paren error detection screws up highlighting of
49
- " Mako variables in C parens--turn it off.
50
-
51
- syn clear cParen
52
- syn clear cParenError
53
- if !exists("c_no_bracket_error")
54
- syn clear cBracket
55
- endif
56
-
57
- syn cluster clmakoCode contains=clmakoLine,clmakoVariable,clmakoBlock,clmakoTag
58
-
59
- hi link clmakoLine Preproc
60
- hi link clmakoVariable Preproc
61
- hi link clmakoBlock Preproc
62
- hi link clmakoTag Define
63
- hi link clmakoAttributeKey String
64
- hi link clmakoAttributeValue String
65
-
66
- " }}}
67
-
68
- syn region pythonCLString
69
- \ start=+[uU]\=\z('''\|"""\)//CL\(:[a-zA-Z_0-9]\+\)\?//+ end="\z1" keepend
70
- \ contains=@clCode,@clmakoCode
71
-
72
- syn region pythonCLRawString
73
- \ start=+[uU]\=[rR]\z('''\|"""\)//CL\(:[a-zA-Z_0-9]\+\)\?//+ end="\z1" keepend
74
- \ contains=@clCode,@clmakoCode
75
-
76
- " Uncomment if you still want the code highlighted as a string.
77
- " hi link pythonCLString String
78
- " hi link pythonCLRawString String
79
-
80
- syntax sync fromstart
81
-
82
- let b:current_syntax = "pyopencl"
83
-
84
- " vim: foldmethod=marker
@@ -1,23 +0,0 @@
1
- # Minimal makefile for Sphinx documentation
2
- #
3
-
4
- # You can set these variables from the command line, and also
5
- # from the environment for the first two.
6
- SPHINXOPTS ?= -W -n
7
- SPHINXBUILD ?= python $(shell which sphinx-build)
8
- SOURCEDIR = .
9
- BUILDDIR = _build
10
-
11
- # Put it first so that "make" without argument is like "make help".
12
- help:
13
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
-
15
- constants:
16
- python make_constants.py > constants.inc
17
-
18
- .PHONY: help Makefile
19
-
20
- # Catch-all target: route all unknown targets to Sphinx using the new
21
- # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
22
- %: Makefile constants
23
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -1,214 +0,0 @@
1
- Parallel Algorithms
2
- ===================
3
-
4
- .. include:: subst.rst
5
-
6
- Element-wise expression evaluation ("map")
7
- ------------------------------------------
8
-
9
- .. module:: pyopencl.elementwise
10
-
11
- Evaluating involved expressions on :class:`pyopencl.array.Array` instances by
12
- using overloaded operators can be somewhat inefficient, because a new temporary
13
- is created for each intermediate result. The functionality in the module
14
- :mod:`pyopencl.elementwise` contains tools to help generate kernels that
15
- evaluate multi-stage expressions on one or several operands in a single pass.
16
-
17
- .. autoclass:: ElementwiseKernel
18
-
19
- Here's a usage example:
20
-
21
- .. literalinclude:: ../examples/demo_elementwise.py
22
-
23
- (You can find this example as
24
- :download:`examples/demo_elementwise.py <../examples/demo_elementwise.py>`
25
- in the PyOpenCL distribution.)
26
-
27
- .. _custom-reductions:
28
-
29
- Sums and counts ("reduce")
30
- --------------------------
31
-
32
- .. module:: pyopencl.reduction
33
-
34
- .. autoclass:: ReductionKernel
35
-
36
- Here's a usage example::
37
-
38
- a = pyopencl.array.arange(queue, 400, dtype=numpy.float32)
39
- b = pyopencl.array.arange(queue, 400, dtype=numpy.float32)
40
-
41
- krnl = ReductionKernel(ctx, numpy.float32, neutral="0",
42
- reduce_expr="a+b", map_expr="x[i]*y[i]",
43
- arguments="__global float *x, __global float *y")
44
-
45
- my_dot_prod = krnl(a, b).get()
46
-
47
- .. _custom-scan:
48
-
49
- Prefix Sums ("scan")
50
- --------------------
51
-
52
- .. module:: pyopencl.scan
53
-
54
- .. |scan_extra_args| replace:: a list of tuples *(name, value)* specifying
55
- extra arguments to pass to the scan procedure. For version 2013.1,
56
- *value* must be a of a :mod:`numpy` sized scalar type. As of version 2013.2,
57
- *value* may also be a :class:`pyopencl.array.Array`.
58
- .. |preamble| replace:: A snippet of C that is inserted into the compiled kernel
59
- before the actual kernel function. May be used for, e.g. type definitions
60
- or include statements.
61
-
62
- A prefix sum is a running sum of an array, as provided by
63
- e.g. :func:`numpy.cumsum`::
64
-
65
- >>> import numpy as np
66
- >>> a = [1,1,1,1,1,2,2,2,2,2]
67
- >>> np.cumsum(a)
68
- array([ 1, 2, 3, 4, 5, 7, 9, 11, 13, 15])
69
-
70
- This is a very simple example of what a scan can do. It turns out that scans
71
- are significantly more versatile. They are a basic building block of many
72
- non-trivial parallel algorithms. Many of the operations enabled by scans seem
73
- difficult to parallelize because of loop-carried dependencies.
74
-
75
- .. seealso::
76
-
77
- `Prefix sums and their applications <https://doi.org/10.1184/R1/6608579.v1>`__, by Guy Blelloch.
78
- This article gives an overview of some surprising applications of scans.
79
-
80
- :ref:`predefined-scans`
81
- These operations built into PyOpenCL are realized using
82
- :class:`GenericScanKernel`.
83
-
84
- Usage Example
85
- ^^^^^^^^^^^^^
86
-
87
- This example illustrates the implementation of a simplified version of
88
- :func:`pyopencl.algorithm.copy_if`,
89
- which copies integers from an array into the (variable-size) output if they are
90
- greater than 300::
91
-
92
- knl = GenericScanKernel(
93
- ctx, np.int32,
94
- arguments="__global int *ary, __global int *out",
95
- input_expr="(ary[i] > 300) ? 1 : 0",
96
- scan_expr="a+b", neutral="0",
97
- output_statement="""
98
- if (prev_item != item) out[item-1] = ary[i];
99
- """)
100
-
101
- out = a.copy()
102
- knl(a, out)
103
-
104
- a_host = a.get()
105
- out_host = a_host[a_host > 300]
106
-
107
- assert (out_host == out.get()[:len(out_host)]).all()
108
-
109
- The value being scanned over is a number of flags indicating whether each array
110
- element is greater than 300. These flags are computed by *input_expr*. The
111
- prefix sum over this array gives a running count of array items greater than
112
- 300. The *output_statement* the compares ``prev_item`` (the previous item's scan
113
- result, i.e. index) to ``item`` (the current item's scan result, i.e.
114
- index). If they differ, i.e. if the predicate was satisfied at this
115
- position, then the item is stored in the output at the computed index.
116
-
117
- This example does not make use of the following advanced features also available
118
- in PyOpenCL:
119
-
120
- * Segmented scans
121
-
122
- * Access to the previous item in *input_expr* (e.g. for comparisons)
123
- See the `implementation <https://github.com/inducer/pyopencl/blob/36afe57784368e8d2505bc7cad8df964ba3c0264/pyopencl/algorithm.py#L226>`__
124
- of :func:`pyopencl.algorithm.unique` for an example.
125
-
126
- Making Custom Scan Kernels
127
- ^^^^^^^^^^^^^^^^^^^^^^^^^^
128
-
129
- .. versionadded:: 2013.1
130
-
131
- .. autoclass:: GenericScanKernel
132
-
133
- Debugging aids
134
- ~~~~~~~~~~~~~~
135
-
136
- .. autoclass:: GenericDebugScanKernel
137
-
138
- .. _predefined-scans:
139
-
140
- Simple / Legacy Interface
141
- ^^^^^^^^^^^^^^^^^^^^^^^^^
142
-
143
- .. class:: ExclusiveScanKernel(ctx, dtype, scan_expr, neutral, name_prefix="scan", options=[], preamble="", devices=None)
144
-
145
- Generates a kernel that can compute a `prefix sum
146
- <https://en.wikipedia.org/wiki/Prefix_sum>`__
147
- using any associative operation given as *scan_expr*.
148
- *scan_expr* uses the formal values "a" and "b" to indicate two operands of
149
- an associative binary operation. *neutral* is the neutral element
150
- of *scan_expr*, obeying *scan_expr(a, neutral) == a*.
151
-
152
- *dtype* specifies the type of the arrays being operated on.
153
- *name_prefix* is used for kernel names to ensure recognizability
154
- in profiles and logs. *options* is a list of compiler options to use
155
- when building. *preamble* specifies a string of code that is
156
- inserted before the actual kernels. *devices* may be used to restrict
157
- the set of devices on which the kernel is meant to run. (defaults
158
- to all devices in the context *ctx*.
159
-
160
- .. method:: __call__(self, input_ary, output_ary=None, allocator=None, queue=None)
161
-
162
- .. class:: InclusiveScanKernel(ctx, dtype, scan_expr, neutral=None, name_prefix="scan", options=[], preamble="", devices=None)
163
-
164
- Works like :class:`ExclusiveScanKernel`.
165
-
166
- .. versionchanged:: 2013.1
167
- *neutral* is now always required.
168
-
169
- For the array ``[1, 2, 3]``, inclusive scan results in ``[1, 3, 6]``, and exclusive
170
- scan results in ``[0, 1, 3]``.
171
-
172
- Here's a usage example::
173
-
174
- knl = InclusiveScanKernel(context, np.int32, "a+b")
175
-
176
- n = 2**20-2**18+5
177
- rng = np.random.default_rng(seed=42)
178
- host_data = rng.integers(0, 10, size=n, dtype=np.int32)
179
- dev_data = cl_array.to_device(queue, host_data)
180
-
181
- knl(dev_data)
182
- assert (dev_data.get() == np.cumsum(host_data, axis=0)).all()
183
-
184
- Predicated copies ("partition", "unique", ...)
185
- ----------------------------------------------
186
-
187
- .. module:: pyopencl.algorithm
188
-
189
- .. autofunction:: copy_if
190
-
191
- .. autofunction:: remove_if
192
-
193
- .. autofunction:: partition
194
-
195
- .. autofunction:: unique
196
-
197
- Sorting (radix sort)
198
- --------------------
199
-
200
- .. autoclass:: RadixSort
201
-
202
- .. automethod:: __call__
203
-
204
- Building many variable-size lists
205
- ---------------------------------
206
-
207
- .. autoclass:: ListOfListsBuilder
208
-
209
- Bitonic Sort
210
- ------------
211
-
212
- .. module:: pyopencl.bitonic_sort
213
-
214
- .. autoclass:: BitonicSort
@@ -1,305 +0,0 @@
1
- Multi-dimensional arrays
2
- ========================
3
-
4
- .. module:: pyopencl.array
5
-
6
- The functionality in this module provides something of a work-alike for
7
- :mod:`numpy` arrays, but with all operations executed on the CL compute device.
8
-
9
- Data Types
10
- ----------
11
-
12
- PyOpenCL provides some amount of integration between the :mod:`numpy`
13
- type system, as represented by :class:`numpy.dtype`, and the types
14
- available in OpenCL. All the simple scalar types map straightforwardly
15
- to their CL counterparts.
16
-
17
- .. _vector-types:
18
-
19
- Vector Types
20
- ^^^^^^^^^^^^
21
-
22
- .. class :: vec
23
-
24
- All of OpenCL's supported vector types, such as ``float3`` and ``long4`` are
25
- available as :mod:`numpy` data types within this class. These
26
- :class:`numpy.dtype` instances have field names of ``x``, ``y``, ``z``, and ``w``
27
- just like their OpenCL counterparts. They will work both for parameter passing
28
- to kernels as well as for passing data back and forth between kernels and
29
- Python code. For each type, a ``make_type`` function is also provided (e.g.
30
- ``make_float3(x, y, z)``).
31
-
32
- If you want to construct a pre-initialized vector type you have three new
33
- functions to choose from:
34
-
35
- * ``zeros_type()``
36
- * ``ones_type()``
37
- * ``filled_type(fill_value)``
38
-
39
- .. versionadded:: 2014.1
40
-
41
- .. versionchanged:: 2014.1
42
-
43
- The ``make_type`` functions have a default value (0) for each component.
44
- Relying on the default values has been deprecated. Either specify all
45
- components or use one of th new flavors mentioned above for constructing
46
- a vector.
47
-
48
- Custom data types
49
- ^^^^^^^^^^^^^^^^^
50
-
51
- If you would like to use your own (struct/union/whatever) data types in array
52
- operations where you supply operation source code, define those types in the
53
- *preamble* passed to :class:`pyopencl.elementwise.ElementwiseKernel`,
54
- :class:`pyopencl.reduction.ReductionKernel` (or similar), and let PyOpenCL know
55
- about them using this function:
56
-
57
- .. currentmodule:: pyopencl.tools
58
-
59
- .. autofunction:: get_or_register_dtype
60
-
61
- .. exception:: TypeNameNotKnown
62
-
63
- .. versionadded:: 2013.1
64
-
65
- .. function:: register_dtype(dtype, name)
66
-
67
- .. versionchanged:: 2013.1
68
- This function has been deprecated. It is recommended that you develop
69
- against the new interface, :func:`get_or_register_dtype`.
70
-
71
- .. function:: dtype_to_ctype(dtype)
72
-
73
- Returns a C name registered for *dtype*.
74
-
75
- .. versionadded: 2013.1
76
-
77
- This function helps with producing C/OpenCL declarations for structured
78
- :class:`numpy.dtype` instances:
79
-
80
- .. autofunction:: match_dtype_to_c_struct
81
-
82
- A more complete example of how to use custom structured types can be
83
- found in :file:`examples/demo-struct-reduce.py` in the PyOpenCL
84
- distribution.
85
-
86
- .. currentmodule:: pyopencl.array
87
-
88
- Complex Numbers
89
- ^^^^^^^^^^^^^^^
90
-
91
- PyOpenCL's :class:`Array` type supports complex numbers out of the box, by
92
- simply using the corresponding :mod:`numpy` types.
93
-
94
- If you would like to use this support in your own kernels, here's how to
95
- proceed: Since OpenCL 1.2 (and earlier) do not specify native complex number
96
- support, PyOpenCL works around that deficiency. By saying::
97
-
98
- #include <pyopencl-complex.h>
99
-
100
- in your kernel, you get complex types ``cfloat_t`` and ``cdouble_t``, along with
101
- functions defined on them such as ``cfloat_mul(a, b)`` or ``cdouble_log(z)``.
102
- Elementwise kernels automatically include the header if your kernel has
103
- complex input or output.
104
- See the `source file
105
- <https://github.com/inducer/pyopencl/blob/main/pyopencl/cl/pyopencl-complex.h>`__
106
- for a precise list of what's available.
107
-
108
- If you need double precision support, please::
109
-
110
- #define PYOPENCL_DEFINE_CDOUBLE
111
-
112
- before including the header, as DP support apparently cannot be reliably
113
- autodetected.
114
-
115
- Under the hood, the complex types are struct types as defined in the header.
116
- Ideally, you should only access the structs through the provided functions,
117
- never directly.
118
-
119
- .. versionadded:: 2012.1
120
-
121
- .. versionchanged:: 2015.2
122
-
123
- **[INCOMPATIBLE]** Changed PyOpenCL's complex numbers from ``float2`` and
124
- ``double2`` OpenCL vector types to custom ``struct``. This was changed
125
- because it very easily introduced bugs where
126
-
127
- * complex*complex
128
- * real+complex
129
-
130
- *look* like they may do the right thing, but silently do the wrong thing.
131
-
132
- The :class:`Array` Class
133
- ------------------------
134
-
135
- .. autoclass:: Array
136
-
137
- .. autoexception:: ArrayHasOffsetError
138
-
139
- Constructing :class:`Array` Instances
140
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141
-
142
- .. autofunction:: to_device
143
- .. function:: empty(queue, shape, dtype, order="C", allocator=None, data=None)
144
-
145
- A synonym for the :class:`Array` constructor.
146
-
147
- .. autofunction:: zeros
148
- .. autofunction:: empty_like
149
- .. autofunction:: zeros_like
150
- .. autofunction:: arange
151
- .. autofunction:: take
152
- .. autofunction:: concatenate
153
- .. autofunction:: stack
154
-
155
- Manipulating :class:`Array` instances
156
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157
-
158
- .. autofunction:: transpose
159
- .. autofunction:: reshape
160
-
161
- Conditionals
162
- ^^^^^^^^^^^^
163
-
164
- .. autofunction:: if_positive
165
- .. autofunction:: maximum
166
- .. autofunction:: minimum
167
-
168
- Logical Operations
169
- ^^^^^^^^^^^^^^^^^^
170
-
171
- .. autofunction:: logical_and
172
- .. autofunction:: logical_or
173
- .. autofunction:: logical_not
174
-
175
- .. _reductions:
176
-
177
- Reductions
178
- ^^^^^^^^^^
179
-
180
- .. autofunction:: sum
181
- .. autofunction:: all
182
- .. autofunction:: any
183
- .. autofunction:: dot
184
- .. autofunction:: vdot
185
- .. autofunction:: subset_dot
186
- .. autofunction:: max
187
- .. autofunction:: min
188
- .. autofunction:: subset_max
189
- .. autofunction:: subset_min
190
-
191
- See also :ref:`custom-reductions`.
192
-
193
- Elementwise Functions on :class:`Array` Instances
194
- -------------------------------------------------
195
-
196
- .. module:: pyopencl.clmath
197
-
198
- The :mod:`pyopencl.clmath` module contains exposes array versions of the C
199
- functions available in the OpenCL standard. (See table 6.8 in the spec.)
200
-
201
- .. function:: acos(array, queue=None)
202
- .. function:: acosh(array, queue=None)
203
- .. function:: acospi(array, queue=None)
204
-
205
- .. function:: asin(array, queue=None)
206
- .. function:: asinh(array, queue=None)
207
- .. function:: asinpi(array, queue=None)
208
-
209
- .. function:: atan(array, queue=None)
210
- .. autofunction:: atan2
211
- .. function:: atanh(array, queue=None)
212
- .. function:: atanpi(array, queue=None)
213
- .. autofunction:: atan2pi
214
-
215
- .. function:: cbrt(array, queue=None)
216
- .. function:: ceil(array, queue=None)
217
- .. TODO: copysign
218
-
219
- .. function:: cos(array, queue=None)
220
- .. function:: cosh(array, queue=None)
221
- .. function:: cospi(array, queue=None)
222
-
223
- .. function:: erfc(array, queue=None)
224
- .. function:: erf(array, queue=None)
225
- .. function:: exp(array, queue=None)
226
- .. function:: exp2(array, queue=None)
227
- .. function:: exp10(array, queue=None)
228
- .. function:: expm1(array, queue=None)
229
-
230
- .. function:: fabs(array, queue=None)
231
- .. TODO: fdim
232
- .. function:: floor(array, queue=None)
233
- .. TODO: fma
234
- .. TODO: fmax
235
- .. TODO: fmin
236
-
237
- .. function:: fmod(arg, mod, queue=None)
238
-
239
- Return the floating point remainder of the division ``arg / mod``,
240
- for each element in ``arg`` and ``mod``.
241
-
242
- .. TODO: fract
243
-
244
-
245
- .. function:: frexp(arg, queue=None)
246
-
247
- Return a tuple ``(significands, exponents)`` such that
248
- ``arg == significand * 2**exponent``.
249
-
250
- .. TODO: hypot
251
-
252
- .. function:: ilogb(array, queue=None)
253
- .. function:: ldexp(significand, exponent, queue=None)
254
-
255
- Return a new array of floating point values composed from the
256
- entries of ``significand`` and ``exponent``, paired together as
257
- ``result = significand * 2**exponent``.
258
-
259
-
260
- .. function:: lgamma(array, queue=None)
261
- .. TODO: lgamma_r
262
-
263
- .. function:: log(array, queue=None)
264
- .. function:: log2(array, queue=None)
265
- .. function:: log10(array, queue=None)
266
- .. function:: log1p(array, queue=None)
267
- .. function:: logb(array, queue=None)
268
-
269
- .. TODO: mad
270
- .. TODO: maxmag
271
- .. TODO: minmag
272
-
273
-
274
- .. function:: modf(arg, queue=None)
275
-
276
- Return a :class:`tuple` ``(fracpart, intpart)`` of arrays containing the
277
- integer and fractional parts of ``arg``.
278
-
279
- .. function:: nan(array, queue=None)
280
-
281
- .. TODO: nextafter
282
- .. TODO: remainder
283
- .. TODO: remquo
284
-
285
- .. function:: rint(array, queue=None)
286
- .. TODO: rootn
287
- .. function:: round(array, queue=None)
288
-
289
- .. function:: sin(array, queue=None)
290
- .. TODO: sincos
291
- .. function:: sinh(array, queue=None)
292
- .. function:: sinpi(array, queue=None)
293
-
294
- .. function:: sqrt(array, queue=None)
295
-
296
- .. function:: tan(array, queue=None)
297
- .. function:: tanh(array, queue=None)
298
- .. function:: tanpi(array, queue=None)
299
- .. function:: tgamma(array, queue=None)
300
- .. function:: trunc(array, queue=None)
301
-
302
- Generating Arrays of Random Numbers
303
- -----------------------------------
304
-
305
- .. automodule:: pyopencl.clrandom
@@ -1,26 +0,0 @@
1
- from urllib.request import urlopen
2
-
3
-
4
- _conf_url = \
5
- "https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py"
6
- with urlopen(_conf_url) as _inf:
7
- exec(compile(_inf.read(), _conf_url, "exec"), globals())
8
-
9
- exclude_patterns = ["subst.rst"]
10
-
11
- copyright = "2009-21, Andreas Kloeckner"
12
-
13
- ver_dic = {}
14
- with open("../pyopencl/version.py") as ver_file:
15
- ver_src = ver_file.read()
16
- exec(compile(ver_src, "../pyopencl/version.py", "exec"), ver_dic)
17
- version = ".".join(str(x) for x in ver_dic["VERSION"])
18
- # The full version, including alpha/beta/rc tags.
19
- release = ver_dic["VERSION_TEXT"]
20
-
21
- intersphinx_mapping = {
22
- "python": ("https://docs.python.org/3", None),
23
- "numpy": ("https://numpy.org/doc/stable/", None),
24
- "mako": ("https://docs.makotemplates.org/en/latest", None),
25
- "pytools": ("https://documen.tician.de/pytools", None),
26
- }