pyopencl 2024.2.2__cp312-cp312-macosx_11_0_arm64.whl → 2024.2.5__cp312-cp312-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.
- pyopencl/__init__.py +16 -4
- pyopencl/_cl.cpython-312-darwin.so +0 -0
- pyopencl/algorithm.py +3 -1
- pyopencl/bitonic_sort.py +2 -0
- pyopencl/characterize/__init__.py +23 -0
- pyopencl/compyte/.git +1 -0
- pyopencl/compyte/.gitignore +21 -0
- pyopencl/compyte/ndarray/Makefile +31 -0
- pyopencl/compyte/ndarray/gpu_ndarray.h +35 -0
- pyopencl/compyte/ndarray/pygpu_language.h +207 -0
- pyopencl/compyte/ndarray/pygpu_language_cuda.cu +622 -0
- pyopencl/compyte/ndarray/pygpu_language_opencl.cpp +317 -0
- pyopencl/compyte/ndarray/pygpu_ndarray.cpp +1546 -0
- pyopencl/compyte/ndarray/pygpu_ndarray.h +71 -0
- pyopencl/compyte/ndarray/pygpu_ndarray_object.h +232 -0
- pyopencl/tools.py +60 -56
- pyopencl/version.py +9 -3
- {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.5.dist-info}/METADATA +14 -14
- pyopencl-2024.2.5.dist-info/RECORD +56 -0
- {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.5.dist-info}/WHEEL +1 -1
- pyopencl-2024.2.2.data/data/CITATION.cff +0 -74
- pyopencl-2024.2.2.data/data/CMakeLists.txt +0 -83
- pyopencl-2024.2.2.data/data/Makefile.in +0 -21
- pyopencl-2024.2.2.data/data/README.rst +0 -70
- pyopencl-2024.2.2.data/data/README_SETUP.txt +0 -34
- pyopencl-2024.2.2.data/data/aksetup_helper.py +0 -1013
- pyopencl-2024.2.2.data/data/configure.py +0 -6
- pyopencl-2024.2.2.data/data/contrib/cldis.py +0 -91
- pyopencl-2024.2.2.data/data/contrib/fortran-to-opencl/README +0 -29
- pyopencl-2024.2.2.data/data/contrib/fortran-to-opencl/translate.py +0 -1441
- pyopencl-2024.2.2.data/data/contrib/pyopencl.vim +0 -84
- pyopencl-2024.2.2.data/data/doc/Makefile +0 -23
- pyopencl-2024.2.2.data/data/doc/algorithm.rst +0 -214
- pyopencl-2024.2.2.data/data/doc/array.rst +0 -305
- pyopencl-2024.2.2.data/data/doc/conf.py +0 -26
- pyopencl-2024.2.2.data/data/doc/howto.rst +0 -105
- pyopencl-2024.2.2.data/data/doc/index.rst +0 -137
- pyopencl-2024.2.2.data/data/doc/make_constants.py +0 -561
- pyopencl-2024.2.2.data/data/doc/misc.rst +0 -885
- pyopencl-2024.2.2.data/data/doc/runtime.rst +0 -51
- pyopencl-2024.2.2.data/data/doc/runtime_const.rst +0 -30
- pyopencl-2024.2.2.data/data/doc/runtime_gl.rst +0 -78
- pyopencl-2024.2.2.data/data/doc/runtime_memory.rst +0 -527
- pyopencl-2024.2.2.data/data/doc/runtime_platform.rst +0 -184
- pyopencl-2024.2.2.data/data/doc/runtime_program.rst +0 -364
- pyopencl-2024.2.2.data/data/doc/runtime_queue.rst +0 -182
- pyopencl-2024.2.2.data/data/doc/subst.rst +0 -36
- pyopencl-2024.2.2.data/data/doc/tools.rst +0 -4
- pyopencl-2024.2.2.data/data/doc/types.rst +0 -42
- pyopencl-2024.2.2.data/data/examples/black-hole-accretion.py +0 -2227
- pyopencl-2024.2.2.data/data/examples/demo-struct-reduce.py +0 -75
- pyopencl-2024.2.2.data/data/examples/demo.py +0 -39
- pyopencl-2024.2.2.data/data/examples/demo_array.py +0 -32
- pyopencl-2024.2.2.data/data/examples/demo_array_svm.py +0 -37
- pyopencl-2024.2.2.data/data/examples/demo_elementwise.py +0 -34
- pyopencl-2024.2.2.data/data/examples/demo_elementwise_complex.py +0 -53
- pyopencl-2024.2.2.data/data/examples/demo_mandelbrot.py +0 -183
- pyopencl-2024.2.2.data/data/examples/demo_meta_codepy.py +0 -56
- pyopencl-2024.2.2.data/data/examples/demo_meta_template.py +0 -55
- pyopencl-2024.2.2.data/data/examples/dump-performance.py +0 -38
- pyopencl-2024.2.2.data/data/examples/dump-properties.py +0 -86
- pyopencl-2024.2.2.data/data/examples/gl_interop_demo.py +0 -84
- pyopencl-2024.2.2.data/data/examples/gl_particle_animation.py +0 -218
- pyopencl-2024.2.2.data/data/examples/ipython-demo.ipynb +0 -203
- pyopencl-2024.2.2.data/data/examples/median-filter.py +0 -99
- pyopencl-2024.2.2.data/data/examples/n-body.py +0 -1070
- pyopencl-2024.2.2.data/data/examples/narray.py +0 -37
- pyopencl-2024.2.2.data/data/examples/noisyImage.jpg +0 -0
- pyopencl-2024.2.2.data/data/examples/pi-monte-carlo.py +0 -1166
- pyopencl-2024.2.2.data/data/examples/svm.py +0 -82
- pyopencl-2024.2.2.data/data/examples/transpose.py +0 -229
- pyopencl-2024.2.2.data/data/pytest.ini +0 -3
- pyopencl-2024.2.2.data/data/src/bitlog.cpp +0 -51
- pyopencl-2024.2.2.data/data/src/bitlog.hpp +0 -83
- pyopencl-2024.2.2.data/data/src/clinfo_ext.h +0 -134
- pyopencl-2024.2.2.data/data/src/mempool.hpp +0 -444
- pyopencl-2024.2.2.data/data/src/pyopencl_ext.h +0 -77
- pyopencl-2024.2.2.data/data/src/tools.hpp +0 -90
- pyopencl-2024.2.2.data/data/src/wrap_cl.cpp +0 -61
- pyopencl-2024.2.2.data/data/src/wrap_cl.hpp +0 -5853
- pyopencl-2024.2.2.data/data/src/wrap_cl_part_1.cpp +0 -369
- pyopencl-2024.2.2.data/data/src/wrap_cl_part_2.cpp +0 -702
- pyopencl-2024.2.2.data/data/src/wrap_constants.cpp +0 -1274
- pyopencl-2024.2.2.data/data/src/wrap_helpers.hpp +0 -213
- pyopencl-2024.2.2.data/data/src/wrap_mempool.cpp +0 -738
- pyopencl-2024.2.2.data/data/test/add-vectors-32.spv +0 -0
- pyopencl-2024.2.2.data/data/test/add-vectors-64.spv +0 -0
- pyopencl-2024.2.2.data/data/test/empty-header.h +0 -1
- pyopencl-2024.2.2.data/data/test/test_algorithm.py +0 -1180
- pyopencl-2024.2.2.data/data/test/test_array.py +0 -2392
- pyopencl-2024.2.2.data/data/test/test_arrays_in_structs.py +0 -100
- pyopencl-2024.2.2.data/data/test/test_clmath.py +0 -529
- pyopencl-2024.2.2.data/data/test/test_clrandom.py +0 -75
- pyopencl-2024.2.2.data/data/test/test_enqueue_copy.py +0 -271
- pyopencl-2024.2.2.data/data/test/test_wrapper.py +0 -1565
- pyopencl-2024.2.2.dist-info/LICENSE +0 -282
- pyopencl-2024.2.2.dist-info/RECORD +0 -123
- pyopencl-2024.2.2.dist-info/top_level.txt +0 -1
- {pyopencl-2024.2.2.data/data → pyopencl-2024.2.5.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// Wrapper-helping odds and ends
|
|
2
|
-
//
|
|
3
|
-
// Copyright (C) 2009 Andreas Kloeckner
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person
|
|
6
|
-
// obtaining a copy of this software and associated documentation
|
|
7
|
-
// files (the "Software"), to deal in the Software without
|
|
8
|
-
// restriction, including without limitation the rights to use,
|
|
9
|
-
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
// copies of the Software, and to permit persons to whom the
|
|
11
|
-
// Software is furnished to do so, subject to the following
|
|
12
|
-
// conditions:
|
|
13
|
-
//
|
|
14
|
-
// The above copyright notice and this permission notice shall be
|
|
15
|
-
// included in all copies or substantial portions of the Software.
|
|
16
|
-
//
|
|
17
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19
|
-
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21
|
-
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22
|
-
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23
|
-
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24
|
-
// OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#ifndef PYCUDA_WRAP_HELPERS_HEADER_SEEN
|
|
28
|
-
#define PYCUDA_WRAP_HELPERS_HEADER_SEEN
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
#include <nanobind/nanobind.h>
|
|
32
|
-
#include <nanobind/stl/string.h>
|
|
33
|
-
#include <nanobind/stl/shared_ptr.h>
|
|
34
|
-
#include <nanobind/ndarray.h>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
namespace py = nanobind;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
#define ENUM_VALUE(NAME) \
|
|
41
|
-
value(#NAME, NAME)
|
|
42
|
-
|
|
43
|
-
// {{{ DEF_SIMPLE_XXX
|
|
44
|
-
|
|
45
|
-
#define DEF_SIMPLE_METHOD(NAME) \
|
|
46
|
-
def(#NAME, &cls::NAME)
|
|
47
|
-
|
|
48
|
-
#define DEF_SIMPLE_STATIC_METHOD(NAME) \
|
|
49
|
-
def_static(#NAME, &cls::NAME)
|
|
50
|
-
|
|
51
|
-
#define DEF_SIMPLE_METHOD_WITH_ARGS(NAME, ARGS) \
|
|
52
|
-
def(#NAME, &cls::NAME, boost::python::args ARGS)
|
|
53
|
-
|
|
54
|
-
#define DEF_SIMPLE_FUNCTION(NAME) \
|
|
55
|
-
m.def(#NAME, &NAME)
|
|
56
|
-
|
|
57
|
-
#define DEF_SIMPLE_FUNCTION_WITH_ARGS(NAME, ARGS) \
|
|
58
|
-
m.def(#NAME, &NAME, py::args ARGS)
|
|
59
|
-
|
|
60
|
-
#define DEF_SIMPLE_RO_MEMBER(NAME) \
|
|
61
|
-
def_readonly(#NAME, &cls::m_##NAME)
|
|
62
|
-
|
|
63
|
-
#define DEF_SIMPLE_RW_MEMBER(NAME) \
|
|
64
|
-
def_readwrite(#NAME, &cls::m_##NAME)
|
|
65
|
-
|
|
66
|
-
// }}}
|
|
67
|
-
|
|
68
|
-
// {{{ COPY_PY_XXX
|
|
69
|
-
|
|
70
|
-
#define COPY_PY_LIST(TYPE, NAME) \
|
|
71
|
-
{ \
|
|
72
|
-
for (auto it: py_##NAME) \
|
|
73
|
-
NAME.push_back(py::cast<TYPE>(it)); \
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#define COPY_PY_ARRAY(FUNC_NAME, TYPE, NAME, COUNTER) \
|
|
77
|
-
{ \
|
|
78
|
-
COUNTER = 0; \
|
|
79
|
-
for (auto it: py_##NAME) \
|
|
80
|
-
{ \
|
|
81
|
-
if (COUNTER == NAME.size()) \
|
|
82
|
-
throw error(FUNC_NAME, \
|
|
83
|
-
CL_INVALID_VALUE, "too many entries in " #NAME " argument"); \
|
|
84
|
-
NAME[COUNTER++] = py::cast<TYPE>(it); \
|
|
85
|
-
} \
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
#define COPY_PY_COORD_TRIPLE(NAME) \
|
|
89
|
-
size_t NAME[3] = {0, 0, 0}; \
|
|
90
|
-
{ \
|
|
91
|
-
py::sequence py_seq_##NAME = py::cast<py::sequence>(py_##NAME); \
|
|
92
|
-
size_t my_len = len(py_seq_##NAME); \
|
|
93
|
-
if (my_len > 3) \
|
|
94
|
-
throw error("transfer", CL_INVALID_VALUE, #NAME "has too many components"); \
|
|
95
|
-
for (size_t i = 0; i < my_len; ++i) \
|
|
96
|
-
NAME[i] = py::cast<size_t>(py_seq_##NAME[i]); \
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
#define COPY_PY_PITCH_TUPLE(NAME) \
|
|
100
|
-
size_t NAME[2] = {0, 0}; \
|
|
101
|
-
if (py_##NAME.ptr() != Py_None) \
|
|
102
|
-
{ \
|
|
103
|
-
py::sequence py_seq_##NAME = py::cast<py::sequence>(py_##NAME); \
|
|
104
|
-
size_t my_len = len(py_seq_##NAME); \
|
|
105
|
-
if (my_len > 2) \
|
|
106
|
-
throw error("transfer", CL_INVALID_VALUE, #NAME "has too many components"); \
|
|
107
|
-
for (size_t i = 0; i < my_len; ++i) \
|
|
108
|
-
NAME[i] = py::cast<size_t>(py_seq_##NAME[i]); \
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#define COPY_PY_REGION_TRIPLE(NAME) \
|
|
112
|
-
size_t NAME[3] = {1, 1, 1}; \
|
|
113
|
-
{ \
|
|
114
|
-
py::sequence py_seq_##NAME = py::cast<py::sequence>(py_##NAME); \
|
|
115
|
-
size_t my_len = len(py_seq_##NAME); \
|
|
116
|
-
if (my_len > 3) \
|
|
117
|
-
throw error("transfer", CL_INVALID_VALUE, #NAME "has too many components"); \
|
|
118
|
-
for (size_t i = 0; i < my_len; ++i) \
|
|
119
|
-
NAME[i] = py::cast<size_t>(py_seq_##NAME[i]); \
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// }}}
|
|
123
|
-
|
|
124
|
-
#define PYOPENCL_PARSE_NUMPY_ARRAY_SPEC \
|
|
125
|
-
PyArray_Descr *tp_descr; \
|
|
126
|
-
if (PyArray_DescrConverter(dtype.ptr(), &tp_descr) != NPY_SUCCEED) \
|
|
127
|
-
throw py::python_error(); \
|
|
128
|
-
\
|
|
129
|
-
std::vector<npy_intp> shape; \
|
|
130
|
-
try \
|
|
131
|
-
{ \
|
|
132
|
-
shape.push_back(py::cast<npy_intp>(py_shape)); \
|
|
133
|
-
} \
|
|
134
|
-
catch (py::cast_error &) \
|
|
135
|
-
{ \
|
|
136
|
-
COPY_PY_LIST(npy_intp, shape); \
|
|
137
|
-
} \
|
|
138
|
-
\
|
|
139
|
-
NPY_ORDER order = NPY_CORDER; \
|
|
140
|
-
PyArray_OrderConverter(py_order.ptr(), &order); \
|
|
141
|
-
\
|
|
142
|
-
int ary_flags = 0; \
|
|
143
|
-
if (order == NPY_FORTRANORDER) \
|
|
144
|
-
ary_flags |= NPY_FARRAY; \
|
|
145
|
-
else if (order == NPY_CORDER) \
|
|
146
|
-
ary_flags |= NPY_CARRAY; \
|
|
147
|
-
else \
|
|
148
|
-
throw std::runtime_error("unrecognized order specifier"); \
|
|
149
|
-
\
|
|
150
|
-
std::vector<npy_intp> strides; \
|
|
151
|
-
if (py_strides.ptr() != Py_None) \
|
|
152
|
-
{ \
|
|
153
|
-
COPY_PY_LIST(npy_intp, strides); \
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#define PYOPENCL_RETURN_VECTOR(ITEMTYPE, NAME) \
|
|
157
|
-
{ \
|
|
158
|
-
py::list pyopencl_result; \
|
|
159
|
-
for (ITEMTYPE item: NAME) \
|
|
160
|
-
pyopencl_result.append(item); \
|
|
161
|
-
return pyopencl_result; \
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
namespace
|
|
165
|
-
{
|
|
166
|
-
template <typename T>
|
|
167
|
-
inline py::object handle_from_new_ptr(T *ptr)
|
|
168
|
-
{
|
|
169
|
-
return py::cast(ptr, py::rv_policy::take_ownership);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
template <typename T, typename ClType>
|
|
173
|
-
inline T *from_int_ptr(intptr_t obj_ref, bool retain)
|
|
174
|
-
{
|
|
175
|
-
ClType clobj = (ClType) obj_ref;
|
|
176
|
-
return new T(clobj, retain);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
template <typename T>
|
|
180
|
-
inline intptr_t to_int_ptr(T const &obj)
|
|
181
|
-
{
|
|
182
|
-
return (intptr_t) obj.data();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
#define PYOPENCL_EXPOSE_TO_FROM_INT_PTR(CL_TYPENAME) \
|
|
187
|
-
.def_static("from_int_ptr", from_int_ptr<cls, CL_TYPENAME>, \
|
|
188
|
-
py::arg("int_ptr_value"), \
|
|
189
|
-
py::arg("retain")=true, \
|
|
190
|
-
"(static method) Return a new Python object referencing the C-level " \
|
|
191
|
-
":c:type:`" #CL_TYPENAME "` object at the location pointed to " \
|
|
192
|
-
"by *int_ptr_value*. The relevant ``clRetain*`` function " \
|
|
193
|
-
"will be called if *retain* is True." \
|
|
194
|
-
"If the previous owner of the object will *not* release the reference, " \
|
|
195
|
-
"*retain* should be set to *False*, to effectively transfer ownership to " \
|
|
196
|
-
":mod:`pyopencl`." \
|
|
197
|
-
"\n\n.. versionadded:: 2013.2\n" \
|
|
198
|
-
"\n\n.. versionchanged:: 2016.1\n\n *retain* added.") \
|
|
199
|
-
.def_prop_ro("int_ptr", to_int_ptr<cls>, \
|
|
200
|
-
"Return an integer corresponding to the pointer value " \
|
|
201
|
-
"of the underlying :c:type:`" #CL_TYPENAME "`. " \
|
|
202
|
-
"Use :meth:`from_int_ptr` to turn back into a Python object." \
|
|
203
|
-
"\n\n.. versionadded:: 2013.2\n") \
|
|
204
|
-
|
|
205
|
-
#define PYOPENCL_EXPOSE_EQUALITY_TESTS \
|
|
206
|
-
/* this relies on nanobind overload resolution going in order of registration */ \
|
|
207
|
-
.def("__eq__", [](cls const &self, cls const &other) { return self == other; }) \
|
|
208
|
-
.def("__eq__", [](cls const &self, py::object obj) { return false; }, py::arg("obj").none())
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
#endif
|
|
212
|
-
|
|
213
|
-
// vim: foldmethod=marker
|