pyopencl 2024.2.7__cp39-cp39-macosx_11_0_arm64.whl → 2024.3__cp39-cp39-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 +127 -122
- pyopencl/_cl.cpython-39-darwin.so +0 -0
- pyopencl/_mymako.py +3 -3
- pyopencl/algorithm.py +10 -7
- pyopencl/array.py +50 -40
- pyopencl/bitonic_sort.py +3 -1
- pyopencl/bitonic_sort_templates.py +1 -1
- pyopencl/cache.py +23 -22
- pyopencl/capture_call.py +5 -4
- pyopencl/clrandom.py +1 -0
- pyopencl/compyte/dtypes.py +4 -4
- pyopencl/compyte/pyproject.toml +54 -0
- pyopencl/elementwise.py +9 -2
- pyopencl/invoker.py +11 -9
- pyopencl/ipython_ext.py +1 -1
- pyopencl/reduction.py +16 -10
- pyopencl/scan.py +38 -22
- pyopencl/tools.py +23 -13
- {pyopencl-2024.2.7.dist-info → pyopencl-2024.3.dist-info}/METADATA +11 -8
- pyopencl-2024.3.dist-info/RECORD +42 -0
- {pyopencl-2024.2.7.dist-info → pyopencl-2024.3.dist-info}/WHEEL +1 -1
- pyopencl/compyte/.git +0 -1
- pyopencl/compyte/ndarray/Makefile +0 -31
- pyopencl/compyte/ndarray/__init__.py +0 -0
- pyopencl/compyte/ndarray/gen_elemwise.py +0 -1907
- pyopencl/compyte/ndarray/gen_reduction.py +0 -1511
- pyopencl/compyte/ndarray/gpu_ndarray.h +0 -35
- pyopencl/compyte/ndarray/pygpu_language.h +0 -207
- pyopencl/compyte/ndarray/pygpu_language_cuda.cu +0 -622
- pyopencl/compyte/ndarray/pygpu_language_opencl.cpp +0 -317
- pyopencl/compyte/ndarray/pygpu_ndarray.cpp +0 -1546
- pyopencl/compyte/ndarray/pygpu_ndarray.h +0 -71
- pyopencl/compyte/ndarray/pygpu_ndarray_object.h +0 -232
- pyopencl/compyte/ndarray/setup_opencl.py +0 -101
- pyopencl/compyte/ndarray/test_gpu_elemwise.py +0 -411
- pyopencl/compyte/ndarray/test_gpu_ndarray.py +0 -487
- pyopencl-2024.2.7.dist-info/RECORD +0 -56
- {pyopencl-2024.2.7.dist-info → pyopencl-2024.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,487 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
|
|
3
|
-
import numpy
|
|
4
|
-
import pygpu_ndarray as gpu_ndarray
|
|
5
|
-
|
|
6
|
-
enable_double = True
|
|
7
|
-
enable_double = False
|
|
8
|
-
|
|
9
|
-
dtypes_all = ["float32",
|
|
10
|
-
"int8", "int16", "int32", "int64",
|
|
11
|
-
"uint8", "uint16", "uint32", "uint64",
|
|
12
|
-
"complex64",
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
dtypes_no_complex = ["float32",
|
|
16
|
-
"int8", "int16", "int32", "int64",
|
|
17
|
-
"uint8", "uint16", "uint32", "uint64",
|
|
18
|
-
]
|
|
19
|
-
if enable_double:
|
|
20
|
-
dtypes_all += ["float64", "complex128"]
|
|
21
|
-
dtypes_no_complex += ["float64"]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def check_flags(x, y):
|
|
25
|
-
assert x.flags["C_CONTIGUOUS"] == y.flags["C_CONTIGUOUS"]
|
|
26
|
-
assert x.flags["F_CONTIGUOUS"] == y.flags["F_CONTIGUOUS"]
|
|
27
|
-
assert x.flags["WRITEABLE"] == y.flags["WRITEABLE"]
|
|
28
|
-
assert x.flags["OWNDATA"] == y.flags["OWNDATA"]
|
|
29
|
-
assert x.flags["ALIGNED"] == y.flags["ALIGNED"]
|
|
30
|
-
assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def check_meta(x, y):
|
|
34
|
-
assert x.shape == y.shape
|
|
35
|
-
assert x.dtype == y.dtype
|
|
36
|
-
assert x.strides == y.strides
|
|
37
|
-
check_flags(x, y)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def check_all(x, y):
|
|
41
|
-
check_meta(x, y)
|
|
42
|
-
assert numpy.allclose(numpy.asarray(x), numpy.asarray(y))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def gen_gpu_nd_array(shape_orig, dtype='float32', offseted_outer=False,
|
|
46
|
-
offseted_inner=False, sliced=1, order='c'):
|
|
47
|
-
if sliced is True:
|
|
48
|
-
sliced = 2
|
|
49
|
-
elif sliced is False:
|
|
50
|
-
sliced = 1
|
|
51
|
-
shape = numpy.asarray(shape_orig).copy()
|
|
52
|
-
if sliced != 1 and len(shape) > 0:
|
|
53
|
-
shape[0] *= numpy.absolute(sliced)
|
|
54
|
-
if offseted_outer and len(shape) > 0:
|
|
55
|
-
shape[0] += 1
|
|
56
|
-
if offseted_inner and len(shape) > 0:
|
|
57
|
-
shape[-1] += 1
|
|
58
|
-
|
|
59
|
-
a = numpy.random.rand(*shape) * 10
|
|
60
|
-
if dtype.startswith("u"):
|
|
61
|
-
a = numpy.absolute(a)
|
|
62
|
-
a = numpy.asarray(a, dtype=dtype)
|
|
63
|
-
assert order in ['c', 'f']
|
|
64
|
-
if order == 'f' and len(shape) > 0:
|
|
65
|
-
a = numpy.asfortranarray(a)
|
|
66
|
-
b = gpu_ndarray.GpuNdArrayObject(a)
|
|
67
|
-
if order == 'f' and len(shape) > 0 and b.size > 1:
|
|
68
|
-
assert b.flags['F_CONTIGUOUS']
|
|
69
|
-
|
|
70
|
-
if offseted_outer and len(shape) > 0:
|
|
71
|
-
b = b[1:]
|
|
72
|
-
a = a[1:]
|
|
73
|
-
assert b.offset != 0
|
|
74
|
-
if offseted_inner and len(shape) > 0:
|
|
75
|
-
# The b[..., 1:] act as the test for this subtensor case.
|
|
76
|
-
b = b[..., 1:]
|
|
77
|
-
a = a[..., 1:]
|
|
78
|
-
assert b.offset != 0
|
|
79
|
-
if sliced != 1 and len(shape) > 0:
|
|
80
|
-
a = a[::sliced]
|
|
81
|
-
b = b[::sliced]
|
|
82
|
-
|
|
83
|
-
if False and shape_orig == ():
|
|
84
|
-
assert a.shape == (1,)
|
|
85
|
-
assert b.shape == (1,)
|
|
86
|
-
else:
|
|
87
|
-
assert a.shape == shape_orig, (a.shape, shape_orig)
|
|
88
|
-
assert b.shape == shape_orig, (b.shape, shape_orig)
|
|
89
|
-
|
|
90
|
-
assert numpy.allclose(a, numpy.asarray(b))
|
|
91
|
-
|
|
92
|
-
return a, b
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def product(*args, **kwds):
|
|
96
|
-
# product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
|
|
97
|
-
# product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
|
|
98
|
-
pools = list(map(tuple, args)) * kwds.get('repeat', 1)
|
|
99
|
-
result = [[]]
|
|
100
|
-
for pool in pools:
|
|
101
|
-
result = [x + [y] for x in result for y in pool]
|
|
102
|
-
for prod in result:
|
|
103
|
-
yield tuple(prod)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def test_transfer():
|
|
107
|
-
for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
108
|
-
for dtype in dtypes_all:
|
|
109
|
-
for offseted in [True, False]:
|
|
110
|
-
a, b = gen_gpu_nd_array(shp, dtype, offseted)
|
|
111
|
-
c = numpy.asarray(b)
|
|
112
|
-
|
|
113
|
-
assert numpy.allclose(c, a)
|
|
114
|
-
assert a.shape == b.shape == c.shape
|
|
115
|
-
assert a.strides == b.strides == c.strides
|
|
116
|
-
assert a.dtype == b.dtype == c.dtype == dtype
|
|
117
|
-
assert c.flags.c_contiguous
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def test_transfer_not_contiguous():
|
|
121
|
-
"""
|
|
122
|
-
Test transfer when the input on the CPU is not contiguous
|
|
123
|
-
TODO: test when the input on the gpu is not contiguous
|
|
124
|
-
"""
|
|
125
|
-
for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
126
|
-
for dtype in dtypes_all:
|
|
127
|
-
a = numpy.random.rand(*shp) * 10
|
|
128
|
-
a = a[::-1]
|
|
129
|
-
b = gpu_ndarray.GpuNdArrayObject(a)
|
|
130
|
-
c = numpy.asarray(b)
|
|
131
|
-
|
|
132
|
-
assert numpy.allclose(c, a)
|
|
133
|
-
assert a.shape == b.shape == c.shape
|
|
134
|
-
# We copy a to a c contiguous array before the transfer
|
|
135
|
-
assert (-a.strides[0],) + a.strides[1:] == b.strides == c.strides
|
|
136
|
-
assert a.dtype == b.dtype == c.dtype
|
|
137
|
-
assert c.flags.c_contiguous
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def test_transfer_fortran():
|
|
141
|
-
for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
142
|
-
for dtype in dtypes_all:
|
|
143
|
-
a = numpy.random.rand(*shp) * 10
|
|
144
|
-
a_ = numpy.asfortranarray(a)
|
|
145
|
-
if len(shp) > 1:
|
|
146
|
-
assert a_.strides != a.strides
|
|
147
|
-
a = a_
|
|
148
|
-
b = gpu_ndarray.GpuNdArrayObject(a)
|
|
149
|
-
c = numpy.asarray(b)
|
|
150
|
-
|
|
151
|
-
assert a.shape == b.shape == c.shape
|
|
152
|
-
assert a.dtype == b.dtype == c.dtype
|
|
153
|
-
assert a.flags.f_contiguous
|
|
154
|
-
assert c.flags.f_contiguous
|
|
155
|
-
assert a.strides == b.strides == c.strides
|
|
156
|
-
assert numpy.allclose(c, a)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def test_ascontiguousarray():
|
|
160
|
-
for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
161
|
-
for dtype in dtypes_all:
|
|
162
|
-
for offseted_o in [True, False]:
|
|
163
|
-
for offseted_i in [True, True]:
|
|
164
|
-
for sliced in [1, 2, -1, -2]:
|
|
165
|
-
for order in ['f', 'c']:
|
|
166
|
-
#print shp, dtype, offseted_o, offseted_i,
|
|
167
|
-
#print sliced, order
|
|
168
|
-
cpu, gpu = gen_gpu_nd_array(shp, dtype, offseted_o,
|
|
169
|
-
offseted_i,
|
|
170
|
-
sliced, order)
|
|
171
|
-
|
|
172
|
-
a = numpy.ascontiguousarray(cpu)
|
|
173
|
-
b = gpu_ndarray.ascontiguousarray(gpu)
|
|
174
|
-
|
|
175
|
-
# numpy upcast with a view to 1d scalar.
|
|
176
|
-
if (sliced != 1 or shp == () or
|
|
177
|
-
(offseted_i and len(shp) > 1)):
|
|
178
|
-
assert b is not gpu
|
|
179
|
-
if sliced == 1 and not offseted_i:
|
|
180
|
-
assert ((a.data is cpu.data) ==
|
|
181
|
-
(b.bytes is gpu.bytes))
|
|
182
|
-
else:
|
|
183
|
-
assert b is gpu
|
|
184
|
-
|
|
185
|
-
assert a.shape == b.shape
|
|
186
|
-
assert a.dtype == b.dtype
|
|
187
|
-
assert a.flags.c_contiguous
|
|
188
|
-
assert b.flags['C_CONTIGUOUS']
|
|
189
|
-
assert a.strides == b.strides
|
|
190
|
-
assert numpy.allclose(cpu, a)
|
|
191
|
-
assert numpy.allclose(cpu, b)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
def test_asfortranarray():
|
|
195
|
-
for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
196
|
-
for dtype in dtypes_all:
|
|
197
|
-
for offseted_outer in [True, False]:
|
|
198
|
-
for offseted_inner in [True, False]:
|
|
199
|
-
for sliced in [1, 2, -1, -2]:
|
|
200
|
-
for order in ['f', 'c']:
|
|
201
|
-
#print shp, dtype, offseted_outer, offseted_inner, sliced, order
|
|
202
|
-
cpu, gpu = gen_gpu_nd_array(shp, dtype,
|
|
203
|
-
offseted_outer,
|
|
204
|
-
offseted_inner,
|
|
205
|
-
sliced,
|
|
206
|
-
order)
|
|
207
|
-
|
|
208
|
-
a = numpy.asfortranarray(cpu)
|
|
209
|
-
b = gpu_ndarray.asfortranarray(gpu)
|
|
210
|
-
|
|
211
|
-
# numpy upcast with a view to 1d scalar.
|
|
212
|
-
if (sliced != 1 or shp == () or
|
|
213
|
-
(offseted_outer and len(shp) > 1) or
|
|
214
|
-
(order != 'f' and len(shp) > 1)):
|
|
215
|
-
assert b is not gpu
|
|
216
|
-
if (sliced == 1 and not offseted_outer and
|
|
217
|
-
order != 'c'):
|
|
218
|
-
assert ((a.data is cpu.data) ==
|
|
219
|
-
(b.bytes is gpu.bytes))
|
|
220
|
-
else:
|
|
221
|
-
assert b is gpu
|
|
222
|
-
pass
|
|
223
|
-
|
|
224
|
-
assert a.shape == b.shape
|
|
225
|
-
assert a.dtype == b.dtype
|
|
226
|
-
assert a.flags.f_contiguous
|
|
227
|
-
if shp != ():
|
|
228
|
-
assert b.flags['F_CONTIGUOUS']
|
|
229
|
-
assert a.strides == b.strides
|
|
230
|
-
assert numpy.allclose(cpu, a)
|
|
231
|
-
assert numpy.allclose(cpu, b)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
def test_zeros():
|
|
235
|
-
for shp in [(), (0,), (5,),
|
|
236
|
-
(0, 0), (1, 0), (0, 1), (6, 7),
|
|
237
|
-
(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1),
|
|
238
|
-
(4, 8, 9), (1, 8, 9)]:
|
|
239
|
-
for order in ["C", "F"]:
|
|
240
|
-
for dtype in dtypes_all:
|
|
241
|
-
x = numpy.zeros(shp, dtype, order)
|
|
242
|
-
y = gpu_ndarray.zeros(shp, dtype, order)
|
|
243
|
-
check_all(x, y)
|
|
244
|
-
x = gpu_ndarray.zeros(()) # no dtype and order param
|
|
245
|
-
y = numpy.zeros(())
|
|
246
|
-
check_meta(x, y)
|
|
247
|
-
|
|
248
|
-
try:
|
|
249
|
-
gpu_ndarray.zeros()
|
|
250
|
-
assert False
|
|
251
|
-
except TypeError:
|
|
252
|
-
pass
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
def test_empty():
|
|
256
|
-
for shp in [(), (0,), (5,),
|
|
257
|
-
(0, 0), (1, 0), (0, 1), (6, 7),
|
|
258
|
-
(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1),
|
|
259
|
-
(4, 8, 9), (1, 8, 9)]:
|
|
260
|
-
for order in ["C", "F"]:
|
|
261
|
-
for dtype in dtypes_all:
|
|
262
|
-
x = numpy.empty(shp, dtype, order)
|
|
263
|
-
y = gpu_ndarray.empty(shp, dtype, order)
|
|
264
|
-
check_meta(x, y)
|
|
265
|
-
x = gpu_ndarray.empty(()) # no dtype and order param
|
|
266
|
-
y = numpy.empty(())
|
|
267
|
-
check_meta(x, y)
|
|
268
|
-
try:
|
|
269
|
-
gpu_ndarray.empty()
|
|
270
|
-
assert False
|
|
271
|
-
except TypeError:
|
|
272
|
-
pass
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def test_mapping_getitem_ellipsis():
|
|
276
|
-
for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
277
|
-
for dtype in dtypes_all:
|
|
278
|
-
for offseted in [True, False]:
|
|
279
|
-
a, a_gpu = gen_gpu_nd_array(shp, dtype, offseted)
|
|
280
|
-
|
|
281
|
-
b = a_gpu[...]
|
|
282
|
-
assert b.bytes == a_gpu.bytes
|
|
283
|
-
assert b.strides == a.strides
|
|
284
|
-
assert b.shape == a.shape
|
|
285
|
-
b_cpu = numpy.asarray(b)
|
|
286
|
-
assert numpy.allclose(a, b_cpu)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
def test_copy_view():
|
|
290
|
-
from ..array import may_share_memory
|
|
291
|
-
|
|
292
|
-
def check_memory_region(a, a_op, b, b_op):
|
|
293
|
-
assert numpy.may_share_memory(a, a_op) == may_share_memory(b, b_op)
|
|
294
|
-
|
|
295
|
-
if a_op.base is None:
|
|
296
|
-
assert b_op.base is None
|
|
297
|
-
else:
|
|
298
|
-
assert a_op.base is a
|
|
299
|
-
if b.base:
|
|
300
|
-
# We avoid having a series of object connected by base.
|
|
301
|
-
# This is to don't bloc the garbage collection.
|
|
302
|
-
assert b_op.base is b.base
|
|
303
|
-
else:
|
|
304
|
-
assert b_op.base is b
|
|
305
|
-
|
|
306
|
-
for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
307
|
-
for dtype in dtypes_all:
|
|
308
|
-
for offseted in [False, True]:
|
|
309
|
-
# order1 is the order of the original data
|
|
310
|
-
for order1 in ['c', 'f']:
|
|
311
|
-
# order2 is the order wanted after copy
|
|
312
|
-
for order2 in ['c', 'f']:
|
|
313
|
-
print(shp, dtype, offseted, order1, order2)
|
|
314
|
-
#TODO test copy unbroadcast!
|
|
315
|
-
a, b = gen_gpu_nd_array(shp, dtype, offseted,
|
|
316
|
-
order=order1)
|
|
317
|
-
|
|
318
|
-
assert numpy.allclose(a, numpy.asarray(b))
|
|
319
|
-
check_flags(a, b)
|
|
320
|
-
|
|
321
|
-
c = b.copy(order2)
|
|
322
|
-
assert numpy.allclose(a, numpy.asarray(c))
|
|
323
|
-
check_flags(c, a.copy(order2))
|
|
324
|
-
check_memory_region(a, a.copy(order2), b, c)
|
|
325
|
-
|
|
326
|
-
d = copy.copy(b)
|
|
327
|
-
assert numpy.allclose(a, numpy.asarray(d))
|
|
328
|
-
check_flags(d, copy.copy(a))
|
|
329
|
-
check_memory_region(a, copy.copy(a), b, d)
|
|
330
|
-
|
|
331
|
-
e = b.view()
|
|
332
|
-
assert numpy.allclose(a, numpy.asarray(e))
|
|
333
|
-
check_flags(e, a.view())
|
|
334
|
-
check_memory_region(a, a.view(), b, e)
|
|
335
|
-
|
|
336
|
-
f = copy.deepcopy(b)
|
|
337
|
-
assert numpy.allclose(a, numpy.asarray(f))
|
|
338
|
-
check_flags(f, copy.deepcopy(a))
|
|
339
|
-
check_memory_region(a, copy.deepcopy(a), b, f)
|
|
340
|
-
|
|
341
|
-
g = copy.copy(b.view())
|
|
342
|
-
assert numpy.allclose(a, numpy.asarray(g))
|
|
343
|
-
check_memory_region(a, copy.copy(a.view()), b, g)
|
|
344
|
-
check_flags(g, copy.copy(a.view()))
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
def test_len():
|
|
348
|
-
for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
|
|
349
|
-
for dtype in dtypes_all:
|
|
350
|
-
for offseted in [True, False]:
|
|
351
|
-
a, a_gpu = gen_gpu_nd_array(shp, dtype, offseted)
|
|
352
|
-
assert len(a_gpu) == shp[0]
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
def test_mapping_getitem_w_int():
|
|
356
|
-
def _cmp(x, y):
|
|
357
|
-
assert x.shape == y.shape
|
|
358
|
-
assert x.dtype == y.dtype
|
|
359
|
-
assert x.strides == y.strides
|
|
360
|
-
assert x.flags["C_CONTIGUOUS"] == y.flags["C_CONTIGUOUS"]
|
|
361
|
-
assert x.flags["F_CONTIGUOUS"] == y.flags["F_CONTIGUOUS"]
|
|
362
|
-
if x.flags["WRITEABLE"] != y.flags["WRITEABLE"]:
|
|
363
|
-
assert x.ndim == 0
|
|
364
|
-
assert not x.flags["OWNDATA"]
|
|
365
|
-
assert y.flags["OWNDATA"]
|
|
366
|
-
else:
|
|
367
|
-
assert x.flags["WRITEABLE"] == y.flags["WRITEABLE"]
|
|
368
|
-
assert x.flags["OWNDATA"] == y.flags["OWNDATA"]
|
|
369
|
-
assert x.flags["ALIGNED"] == y.flags["ALIGNED"]
|
|
370
|
-
assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"]
|
|
371
|
-
x = numpy.asarray(x)
|
|
372
|
-
assert x.shape == y.shape
|
|
373
|
-
assert x.dtype == y.dtype
|
|
374
|
-
assert x.strides == y.strides
|
|
375
|
-
if not numpy.all(x == y):
|
|
376
|
-
print(x)
|
|
377
|
-
print(y)
|
|
378
|
-
assert numpy.all(x == y), (x, y)
|
|
379
|
-
|
|
380
|
-
def _cmpNs(x, y):
|
|
381
|
-
"""
|
|
382
|
-
Don't compare the stride after the transfer
|
|
383
|
-
There is a copy that have been made on the gpu before the transfer
|
|
384
|
-
"""
|
|
385
|
-
assert x.shape == y.shape
|
|
386
|
-
assert x.dtype == y.dtype
|
|
387
|
-
assert x.strides == y.strides
|
|
388
|
-
assert x.flags["C_CONTIGUOUS"] == y.flags["C_CONTIGUOUS"]
|
|
389
|
-
assert x.flags["F_CONTIGUOUS"] == y.flags["F_CONTIGUOUS"]
|
|
390
|
-
assert x.flags["WRITEABLE"] == y.flags["WRITEABLE"]
|
|
391
|
-
assert x.flags["ALIGNED"] == y.flags["ALIGNED"]
|
|
392
|
-
assert x.flags["OWNDATA"] == y.flags["OWNDATA"]
|
|
393
|
-
assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"]
|
|
394
|
-
x_ = numpy.asarray(x)
|
|
395
|
-
assert x_.shape == y.shape
|
|
396
|
-
assert x_.dtype == y.dtype
|
|
397
|
-
if not numpy.all(x_ == y):
|
|
398
|
-
print(x_)
|
|
399
|
-
print(y)
|
|
400
|
-
assert numpy.all(x_ == y), (x_, y)
|
|
401
|
-
pass
|
|
402
|
-
|
|
403
|
-
def _cmpf(x, *y):
|
|
404
|
-
try:
|
|
405
|
-
x.__getitem__(y)
|
|
406
|
-
except IndexError:
|
|
407
|
-
pass
|
|
408
|
-
else:
|
|
409
|
-
raise Exception("Did not generate out or bound error")
|
|
410
|
-
|
|
411
|
-
def _cmpfV(x, *y):
|
|
412
|
-
try:
|
|
413
|
-
if len(y) == 1:
|
|
414
|
-
x.__getitem__(*y)
|
|
415
|
-
else:
|
|
416
|
-
x.__getitem__(y)
|
|
417
|
-
except ValueError:
|
|
418
|
-
pass
|
|
419
|
-
else:
|
|
420
|
-
raise Exception("Did not generate value error")
|
|
421
|
-
|
|
422
|
-
for dtype in dtypes_all:
|
|
423
|
-
for offseted in [True, False]:
|
|
424
|
-
# test vector
|
|
425
|
-
dim = (2,)
|
|
426
|
-
a, _a = gen_gpu_nd_array(dim, dtype, offseted)
|
|
427
|
-
|
|
428
|
-
import sys
|
|
429
|
-
init_ref_count = sys.getrefcount(_a)
|
|
430
|
-
_cmp(_a[...], a[...])
|
|
431
|
-
_cmp(_a[...], a[...])
|
|
432
|
-
_cmp(_a[...], a[...])
|
|
433
|
-
_cmp(_a[...], a[...])
|
|
434
|
-
_cmp(_a[...], a[...])
|
|
435
|
-
|
|
436
|
-
_cmp(_a[-1], a[-1])
|
|
437
|
-
_cmp(_a[1], a[1])
|
|
438
|
-
_cmp(_a[0], a[0])
|
|
439
|
-
_cmp(_a[::1], a[::1])
|
|
440
|
-
_cmpNs(_a[::-1], a[::-1])
|
|
441
|
-
_cmp(_a[...], a[...])
|
|
442
|
-
_cmpf(_a, 2)
|
|
443
|
-
|
|
444
|
-
# test scalar
|
|
445
|
-
dim = ()
|
|
446
|
-
a, _a = gen_gpu_nd_array(dim, dtype, offseted)
|
|
447
|
-
_cmp(_a[...], a[...])
|
|
448
|
-
_cmpf(_a, 0)
|
|
449
|
-
_cmpfV(_a, slice(1))
|
|
450
|
-
|
|
451
|
-
# test 4d-tensor
|
|
452
|
-
dim = (5, 4, 3, 2)
|
|
453
|
-
a, _a = gen_gpu_nd_array(dim, dtype, offseted)
|
|
454
|
-
_cmpf(_a, slice(-1), slice(-1), 10, -10)
|
|
455
|
-
_cmpf(_a, slice(-1), slice(-1), -10, slice(-1))
|
|
456
|
-
_cmpf(_a, 0, slice(0, -1, -20), -10)
|
|
457
|
-
_cmpf(_a, 10)
|
|
458
|
-
_cmpf(_a, (10, 0, 0, 0))
|
|
459
|
-
_cmpf(_a, -10)
|
|
460
|
-
|
|
461
|
-
#test with integer
|
|
462
|
-
_cmp(_a[1], a[1])
|
|
463
|
-
_cmp(_a[-1], a[-1])
|
|
464
|
-
_cmp(_a[numpy.int64(1)], a[numpy.int64(1)])
|
|
465
|
-
_cmp(_a[numpy.int64(-1)], a[numpy.int64(-1)])
|
|
466
|
-
|
|
467
|
-
#test with slice
|
|
468
|
-
_cmp(_a[1:], a[1:])
|
|
469
|
-
_cmp(_a[1:2], a[1:2])
|
|
470
|
-
_cmp(_a[-1:1], a[-1:1])
|
|
471
|
-
|
|
472
|
-
#test with tuple (mix slice, integer, numpy.int64)
|
|
473
|
-
_cmpNs(_a[0, 0, ::numpy.int64(-1), ::-1], a[0, 0, ::-1, ::-1])
|
|
474
|
-
_cmpNs(_a[:, :, ::numpy.int64(-1), ::-1], a[:, :, ::-1, ::-1])
|
|
475
|
-
_cmpNs(_a[:, :, numpy.int64(1), -1], a[:, :, 1, -1])
|
|
476
|
-
_cmpNs(_a[:, :, ::-1, ::-1], a[:, :, ::-1, ::-1])
|
|
477
|
-
_cmpNs(_a[:, :, ::-10, ::-10], a[:, :, ::-10, ::-10])
|
|
478
|
-
_cmpNs(_a[:, :, 1, -1], a[:, :, 1, -1])
|
|
479
|
-
_cmpNs(_a[:, :, -1, :], a[:, :, -1, :])
|
|
480
|
-
_cmpNs(_a[:, ::-2, -1, :], a[:, ::-2, -1, :])
|
|
481
|
-
_cmpNs(_a[:, ::-20, -1, :], a[:, ::-20, -1, :])
|
|
482
|
-
_cmpNs(_a[:, ::-2, -1], a[:, ::-2, -1])
|
|
483
|
-
_cmpNs(_a[0, ::-2, -1], a[0, ::-2, -1])
|
|
484
|
-
_cmp(_a[-1, -1, -1, -2], a[-1, -1, -1, -2])
|
|
485
|
-
|
|
486
|
-
#test ellipse
|
|
487
|
-
_cmp(_a[...], a[...])
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
pyopencl/algorithm.py,sha256=y3wnm2l-0mzIy1dwcZmKR2iLGPVMIlwbgAAsM3elJVg,51265
|
|
2
|
-
pyopencl/clmath.py,sha256=lOxQzE6BEp5-nVRuGu0hgxzk_gcx7aTiy_hRFxAPmcI,8222
|
|
3
|
-
pyopencl/version.py,sha256=PhHAIjtUGVQ2wTVlqgoOrcC_2rkvNMmqvy1rRDqWOhg,267
|
|
4
|
-
pyopencl/capture_call.py,sha256=MJDOVqU6s8rJ5nmd5zOcqNe7GLXad2NwGeTpG60Kau0,5661
|
|
5
|
-
pyopencl/reduction.py,sha256=OZMkLGt5KUp3HG2k0mkXBgF04IGWXzdhuZHy_IAwL1g,25524
|
|
6
|
-
pyopencl/tools.py,sha256=3L0FggJ_nhw4M0KG1yG1VgMPdfA6NttY0nG7Yk6Glts,45993
|
|
7
|
-
pyopencl/elementwise.py,sha256=VMw6A6wGaaBOsxdofjBq9Hyv6l0m9cGKVh2HwsfMuu4,38602
|
|
8
|
-
pyopencl/_cl.cpython-39-darwin.so,sha256=_jBbGiRSYCQZKXVeuZldcnblwFQ8UnfaNbuVL9rVsh4,473864
|
|
9
|
-
pyopencl/cache.py,sha256=PltNiHqrAmX7Tgg9BfFdheAHU6qwkg0tjbtCPKKryls,15959
|
|
10
|
-
pyopencl/__init__.py,sha256=-3X3PY8QfGO_DRGrFcRh9iZqG9S6_2P68vx66ItOM0E,81108
|
|
11
|
-
pyopencl/cltypes.py,sha256=DdBVPBU2bRuIbT8ImhWFIQosrefMOkAa4mY4yoSnurc,4818
|
|
12
|
-
pyopencl/invoker.py,sha256=Tua5-JV8TlumHVLcNSWhzBiOvQNVBOWj1fUOhrtcjPI,14023
|
|
13
|
-
pyopencl/ipython_ext.py,sha256=bN-5I06Nb53_2qE0KfKXxK27Gn4tG3EDj11Az8iTb28,1914
|
|
14
|
-
pyopencl/scan.py,sha256=YAFn7V3T8Pb5XKMSY0JlzwSF_op4PxS-tIWdiq4vyiU,65529
|
|
15
|
-
pyopencl/_cluda.py,sha256=KKUxizD1iQEuZ_TmmFZNJ8IdXa8x8uT9HgB0nmAlYLw,2074
|
|
16
|
-
pyopencl/_mymako.py,sha256=VnxoyODc-_wVcWhKgQqUYVh_Iun5498Yg4W0WmGhTwk,610
|
|
17
|
-
pyopencl/array.py,sha256=yazv6DHRsKzlMuR0OFMn465RihWpIe_OUAWlAS8oQHE,111717
|
|
18
|
-
pyopencl/bitonic_sort.py,sha256=-gTe-1CfMwxkKKdvlB7x5vIyCeS3NxZRD7GVrYeXfuo,7960
|
|
19
|
-
pyopencl/bitonic_sort_templates.py,sha256=Y1de5klU8GRo2pKlh1cZyYf_NBSIPDbhO83VLLnUgmk,16172
|
|
20
|
-
pyopencl/clrandom.py,sha256=wAzoB6U4cNCipy5xbeYrrvDbqx_QFLmp_FeqIAu3K7I,13043
|
|
21
|
-
pyopencl/compyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
pyopencl/compyte/dtypes.py,sha256=FQ1KrstfEIV_ikNNvbC1JODX9rLQ-Yo8-QhAwD-4v9I,9809
|
|
23
|
-
pyopencl/compyte/.gitignore,sha256=HVYtbKRtOCPWZavrgYqO2u7UKFiE7g7ympmuQzKbBBw,168
|
|
24
|
-
pyopencl/compyte/.git,sha256=hqjyvpQvk3kzLjhnlN4Ht1Pgj7gEz1d0hTK9YSPe5T8,44
|
|
25
|
-
pyopencl/compyte/array.py,sha256=9dUSCSb475naOADXWhgpQb72Yx1FjKWMEaU6jRwdq90,7422
|
|
26
|
-
pyopencl/compyte/ndarray/pygpu_language_opencl.cpp,sha256=kyY6wV_h_-uAj8IOO6c9gYHoxJ5Bir83M7XptAUx3u8,7946
|
|
27
|
-
pyopencl/compyte/ndarray/pygpu_ndarray.h,sha256=eEn0lxqjyD_M21ALlD7YHy3_SkUpQQj58up0q7GsKoE,1665
|
|
28
|
-
pyopencl/compyte/ndarray/gen_reduction.py,sha256=JrhJ40Q-8PNphso3jliZSVGWzLnA5-pKkDNZTJNRtbA,56315
|
|
29
|
-
pyopencl/compyte/ndarray/pygpu_ndarray_object.h,sha256=mX8vcy4lgNIgX6xkB5T6U1XkD_Ysk-dW_EChrTYaJWE,9059
|
|
30
|
-
pyopencl/compyte/ndarray/Makefile,sha256=fArNjiMX22zYkdTa3SMdEa0POCv5sSmR5X5cQnR-7t0,1236
|
|
31
|
-
pyopencl/compyte/ndarray/test_gpu_elemwise.py,sha256=sZn24yDa3WgK_AoIs6HCL6-UslZf0aYiPByo__PbtJw,18438
|
|
32
|
-
pyopencl/compyte/ndarray/setup_opencl.py,sha256=Xvmj3iaRjBXI2sEzTTYKxgFCoEyDaiP9ZGJ989RLSqc,3809
|
|
33
|
-
pyopencl/compyte/ndarray/gen_elemwise.py,sha256=KZdZZ6higOqGuxpp9aLDECWuL3jT9zuSy8I7cLCAdKY,76820
|
|
34
|
-
pyopencl/compyte/ndarray/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
pyopencl/compyte/ndarray/pygpu_ndarray.cpp,sha256=z8Foyjr9F6HH9EDzmdkTCcqO7Echf7KRifCNfvSvHZ8,51525
|
|
36
|
-
pyopencl/compyte/ndarray/test_gpu_ndarray.py,sha256=a0PV3JVH7TG9-jZdBcrJwuqqnWD5LTsOQGr_bftghVA,17781
|
|
37
|
-
pyopencl/compyte/ndarray/gpu_ndarray.h,sha256=3elPl8SzlpZHTAa-nlOeD7M5YOqVN-7whd5tMWx9zHY,1005
|
|
38
|
-
pyopencl/compyte/ndarray/pygpu_language_cuda.cu,sha256=YO2xyBAtWwXx8RMvn-C2HHSjvjU-oEOpMzrF-CwGVDI,29323
|
|
39
|
-
pyopencl/compyte/ndarray/pygpu_language.h,sha256=HSAfiG0W87aBoT6UAQl1ODQpdWr7GtSMtMtDpEjQkAI,7049
|
|
40
|
-
pyopencl/characterize/__init__.py,sha256=MM56Q4P2IH-piykKeenHgsXYnAcB2HiTj0ftnYVYNVc,14346
|
|
41
|
-
pyopencl/characterize/performance.py,sha256=TD8-cNnGnn46sQwfR5xNF2nr8yQcrmhuzJaYB13pSqk,6866
|
|
42
|
-
pyopencl/cl/pyopencl-bessel-y.cl,sha256=VDy8l4lVxO8VcJR_maeGu_Qjnw27j28zBwhaTKDhBBg,12297
|
|
43
|
-
pyopencl/cl/pyopencl-hankel-complex.cl,sha256=JSm38L6cOdnDssVqzKCNgjMrILT5ExkYAxz7i8rQBtA,31561
|
|
44
|
-
pyopencl/cl/pyopencl-bessel-j.cl,sha256=69d5WoqajYSubLgA6OVwYw0yOHGt64zY97J8isnsQgU,23274
|
|
45
|
-
pyopencl/cl/pyopencl-bessel-j-complex.cl,sha256=o-17yK_wBFqRiGgTYHg9waooTEKt1SCoguMUbg2LOB0,6026
|
|
46
|
-
pyopencl/cl/pyopencl-airy.cl,sha256=S6S84BX6v6E9ZuGB7mdbFygUY99BaManrWMf47Ms7NA,8122
|
|
47
|
-
pyopencl/cl/pyopencl-eval-tbl.cl,sha256=YNi_hyeE4GtDwzx3mLOMRIHh9jOOzMwSv-F2F1lMevg,2616
|
|
48
|
-
pyopencl/cl/pyopencl-complex.h,sha256=gy7Ge9tuDeLYdpM8KIvKK347AxK5XPFhlVjJfgPtIlI,8544
|
|
49
|
-
pyopencl/cl/pyopencl-random123/threefry.cl,sha256=2WmQGxx5gPSv22UL9_MlXv0eMug91k3bC-5_yQ4wlnI,54699
|
|
50
|
-
pyopencl/cl/pyopencl-random123/philox.cl,sha256=vYcQH7Vw13Q3qkW5Nhy1HTUDbWLGKoloE1YP0VWk6vU,21740
|
|
51
|
-
pyopencl/cl/pyopencl-random123/array.h,sha256=nIV0zDWYuybldNgtsh79icNtDXHYdDsSpFaWIvDTyw4,17088
|
|
52
|
-
pyopencl/cl/pyopencl-random123/openclfeatures.h,sha256=pAPbl7JkQgJxulSuGGevpaI43P7PwiH2mYxtNfHq59M,2881
|
|
53
|
-
pyopencl-2024.2.7.dist-info/RECORD,,
|
|
54
|
-
pyopencl-2024.2.7.dist-info/WHEEL,sha256=IRWDGdz2SPFuu4rzqH5GOjJor8PmcV4n4TCkf27undY,111
|
|
55
|
-
pyopencl-2024.2.7.dist-info/METADATA,sha256=ERdfvmBnVfT5Wi7CEbe-KmHyLOHB1ZIiujMMwluRW30,4670
|
|
56
|
-
pyopencl-2024.2.7.dist-info/licenses/LICENSE,sha256=wiBvs-UC54bB5DswWuvB66B96b4hkYw_VLt8IR0cBPI,15284
|
|
File without changes
|