pyopencl 2024.2.2__cp310-cp310-win_amd64.whl → 2024.2.4__cp310-cp310-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.
- pyopencl/__init__.py +16 -4
- pyopencl/_cl.cp310-win_amd64.pyd +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/.github/workflows/autopush.yml +21 -0
- pyopencl/compyte/.github/workflows/ci.yml +30 -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/compyte/setup.cfg +9 -0
- pyopencl/tools.py +60 -56
- pyopencl/version.py +7 -3
- {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.4.dist-info}/METADATA +105 -105
- pyopencl-2024.2.4.dist-info/RECORD +59 -0
- {pyopencl-2024.2.2.dist-info → pyopencl-2024.2.4.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.4.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env python
|
|
2
|
-
|
|
3
|
-
__copyright__ = "Copyright (C) 2016 Shane J. Latham"
|
|
4
|
-
|
|
5
|
-
__license__ = """
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in
|
|
14
|
-
all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
-
THE SOFTWARE.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
import numpy as np
|
|
26
|
-
import pytest
|
|
27
|
-
|
|
28
|
-
import pyopencl as cl
|
|
29
|
-
from pyopencl.characterize import get_pocl_version
|
|
30
|
-
from pyopencl.tools import \
|
|
31
|
-
pytest_generate_tests_for_pyopencl as pytest_generate_tests # noqa: F401
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def generate_slice(start, shape):
|
|
35
|
-
return tuple([slice(start[i], start[i]+shape[i]) for i in range(len(start))])
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def test_enqueue_copy_rect_2d(ctx_factory, honor_skip=True):
|
|
39
|
-
"""
|
|
40
|
-
Test 2D sub-array (slice) copy.
|
|
41
|
-
"""
|
|
42
|
-
ctx = ctx_factory()
|
|
43
|
-
queue = cl.CommandQueue(ctx)
|
|
44
|
-
|
|
45
|
-
if (honor_skip
|
|
46
|
-
and ctx.devices[0].platform.name == "Portable Computing Language"
|
|
47
|
-
and get_pocl_version(ctx.devices[0].platform) <= (0, 13)):
|
|
48
|
-
# https://github.com/pocl/pocl/issues/353
|
|
49
|
-
pytest.skip("PoCL's rectangular copies crash")
|
|
50
|
-
|
|
51
|
-
device = queue.device
|
|
52
|
-
if device.platform.vendor == "The pocl project" \
|
|
53
|
-
and device.type & cl.device_type.GPU:
|
|
54
|
-
pytest.xfail("rect copies fail on PoCL + Nvidia,"
|
|
55
|
-
"at least the K40, as of PoCL 1.6, 2021-01-20")
|
|
56
|
-
|
|
57
|
-
if honor_skip and queue.device.platform.name == "Apple":
|
|
58
|
-
pytest.xfail("Apple's CL implementation crashes on this.")
|
|
59
|
-
|
|
60
|
-
ary_in_shp = 256, 128 # Entire array shape from which sub-array copied to device
|
|
61
|
-
sub_ary_shp = 128, 96 # Sub-array shape to be copied to device
|
|
62
|
-
ary_in_origin = 20, 13 # Sub-array origin
|
|
63
|
-
ary_in_slice = generate_slice(ary_in_origin, sub_ary_shp)
|
|
64
|
-
|
|
65
|
-
ary_out_origin = 11, 19 # Origin of sub-array copy from device to host-array
|
|
66
|
-
ary_out_shp = 512, 256 # Entire host-array shape copy sub-array device->host
|
|
67
|
-
ary_out_slice = generate_slice(ary_out_origin, sub_ary_shp)
|
|
68
|
-
|
|
69
|
-
buf_in_origin = 7, 3 # Origin of sub-array in device buffer
|
|
70
|
-
buf_in_shp = 300, 200 # shape of device buffer
|
|
71
|
-
|
|
72
|
-
buf_out_origin = 31, 17 # Origin of 2nd device buffer
|
|
73
|
-
buf_out_shp = 300, 400 # shape of 2nd device buffer
|
|
74
|
-
|
|
75
|
-
# Create host array of random values.
|
|
76
|
-
rng = np.random.default_rng(seed=42)
|
|
77
|
-
h_ary_in = rng.integers(0, 256, ary_in_shp, dtype=np.uint8)
|
|
78
|
-
|
|
79
|
-
# Create device buffers
|
|
80
|
-
d_in_buf = cl.Buffer(ctx, cl.mem_flags.READ_ONLY, size=np.prod(buf_in_shp))
|
|
81
|
-
d_out_buf = cl.Buffer(ctx, cl.mem_flags.READ_ONLY, size=np.prod(buf_out_shp))
|
|
82
|
-
|
|
83
|
-
# Copy sub-array (rectangular buffer) from host to device
|
|
84
|
-
cl.enqueue_copy(
|
|
85
|
-
queue,
|
|
86
|
-
d_in_buf,
|
|
87
|
-
h_ary_in,
|
|
88
|
-
buffer_origin=buf_in_origin[::-1],
|
|
89
|
-
host_origin=ary_in_origin[::-1],
|
|
90
|
-
region=sub_ary_shp[::-1],
|
|
91
|
-
buffer_pitches=(buf_in_shp[-1],),
|
|
92
|
-
host_pitches=(ary_in_shp[-1],)
|
|
93
|
-
)
|
|
94
|
-
# Copy sub-array (rectangular buffer) from device-buffer to device-buffer
|
|
95
|
-
cl.enqueue_copy(
|
|
96
|
-
queue,
|
|
97
|
-
d_out_buf,
|
|
98
|
-
d_in_buf,
|
|
99
|
-
src_origin=buf_in_origin[::-1],
|
|
100
|
-
dst_origin=buf_out_origin[::-1],
|
|
101
|
-
region=sub_ary_shp[::-1],
|
|
102
|
-
src_pitches=(buf_in_shp[-1],),
|
|
103
|
-
dst_pitches=(buf_out_shp[-1],)
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
# Create zero-initialised array to receive sub-array from device
|
|
107
|
-
h_ary_out = np.zeros(ary_out_shp, dtype=h_ary_in.dtype)
|
|
108
|
-
|
|
109
|
-
# Copy sub-array (rectangular buffer) from device to host-array.
|
|
110
|
-
cl.enqueue_copy(
|
|
111
|
-
queue,
|
|
112
|
-
h_ary_out,
|
|
113
|
-
d_out_buf,
|
|
114
|
-
buffer_origin=buf_out_origin[::-1],
|
|
115
|
-
host_origin=ary_out_origin[::-1],
|
|
116
|
-
region=sub_ary_shp[::-1],
|
|
117
|
-
buffer_pitches=(buf_out_shp[-1],),
|
|
118
|
-
host_pitches=(ary_out_shp[-1],)
|
|
119
|
-
)
|
|
120
|
-
queue.finish()
|
|
121
|
-
|
|
122
|
-
# Check that the sub-array copied to device is
|
|
123
|
-
# the same as the sub-array received from device.
|
|
124
|
-
assert np.all(h_ary_in[ary_in_slice] == h_ary_out[ary_out_slice])
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def test_enqueue_copy_rect_3d(ctx_factory, honor_skip=True):
|
|
128
|
-
"""
|
|
129
|
-
Test 3D sub-array (slice) copy.
|
|
130
|
-
"""
|
|
131
|
-
ctx = ctx_factory()
|
|
132
|
-
queue = cl.CommandQueue(ctx)
|
|
133
|
-
|
|
134
|
-
if (honor_skip
|
|
135
|
-
and ctx.devices[0].platform.name == "Portable Computing Language"
|
|
136
|
-
and get_pocl_version(ctx.devices[0].platform) <= (0, 13)):
|
|
137
|
-
# https://github.com/pocl/pocl/issues/353
|
|
138
|
-
pytest.skip("PoCL's rectangular copies crash")
|
|
139
|
-
|
|
140
|
-
device = queue.device
|
|
141
|
-
if device.platform.vendor == "The pocl project" \
|
|
142
|
-
and device.type & cl.device_type.GPU:
|
|
143
|
-
pytest.xfail("rect copies fail on PoCL + Nvidia,"
|
|
144
|
-
"at least the K40, as of PoCL 1.6, 2021-01-20")
|
|
145
|
-
|
|
146
|
-
if honor_skip and queue.device.platform.name == "Apple":
|
|
147
|
-
pytest.skip("Apple's CL implementation crashes on this.")
|
|
148
|
-
|
|
149
|
-
ary_in_shp = 256, 128, 31 # array shape from which sub-array copied to device
|
|
150
|
-
sub_ary_shp = 128, 96, 20 # Sub-array shape to be copied to device
|
|
151
|
-
ary_in_origin = 20, 13, 7 # Sub-array origin
|
|
152
|
-
ary_in_slice = generate_slice(ary_in_origin, sub_ary_shp)
|
|
153
|
-
|
|
154
|
-
ary_out_origin = 11, 19, 14 # Origin of sub-array copy from device to host-array
|
|
155
|
-
ary_out_shp = 192, 256, 128 # Entire host-array shape copy sub-array dev->host
|
|
156
|
-
ary_out_slice = generate_slice(ary_out_origin, sub_ary_shp)
|
|
157
|
-
|
|
158
|
-
buf_in_origin = 7, 3, 6 # Origin of sub-array in device buffer
|
|
159
|
-
buf_in_shp = 300, 200, 30 # shape of device buffer
|
|
160
|
-
|
|
161
|
-
buf_out_origin = 31, 17, 3 # Origin of 2nd device buffer
|
|
162
|
-
buf_out_shp = 300, 400, 40 # shape of 2nd device buffer
|
|
163
|
-
|
|
164
|
-
# Create host array of random values.
|
|
165
|
-
rng = np.random.default_rng(seed=42)
|
|
166
|
-
h_ary_in = rng.integers(0, 256, ary_in_shp, dtype=np.uint8)
|
|
167
|
-
|
|
168
|
-
# Create device buffers
|
|
169
|
-
d_in_buf = cl.Buffer(ctx, cl.mem_flags.READ_ONLY, size=np.prod(buf_in_shp))
|
|
170
|
-
d_out_buf = cl.Buffer(ctx, cl.mem_flags.READ_ONLY, size=np.prod(buf_out_shp))
|
|
171
|
-
|
|
172
|
-
# Copy sub-array (rectangular buffer) from host to device
|
|
173
|
-
cl.enqueue_copy(
|
|
174
|
-
queue,
|
|
175
|
-
d_in_buf,
|
|
176
|
-
h_ary_in,
|
|
177
|
-
buffer_origin=buf_in_origin[::-1],
|
|
178
|
-
host_origin=ary_in_origin[::-1],
|
|
179
|
-
region=sub_ary_shp[::-1],
|
|
180
|
-
buffer_pitches=(buf_in_shp[-1], buf_in_shp[-1]*buf_in_shp[-2]),
|
|
181
|
-
host_pitches=(ary_in_shp[-1], ary_in_shp[-1]*ary_in_shp[-2])
|
|
182
|
-
)
|
|
183
|
-
# Copy sub-array (rectangular buffer) from device-buffer to device-buffer
|
|
184
|
-
cl.enqueue_copy(
|
|
185
|
-
queue,
|
|
186
|
-
d_out_buf,
|
|
187
|
-
d_in_buf,
|
|
188
|
-
src_origin=buf_in_origin[::-1],
|
|
189
|
-
dst_origin=buf_out_origin[::-1],
|
|
190
|
-
region=sub_ary_shp[::-1],
|
|
191
|
-
src_pitches=(buf_in_shp[-1], buf_in_shp[-1]*buf_in_shp[-2]),
|
|
192
|
-
dst_pitches=(buf_out_shp[-1], buf_out_shp[-1]*buf_out_shp[-2])
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
# Create zero-initialised array to receive sub-array from device
|
|
196
|
-
h_ary_out = np.zeros(ary_out_shp, dtype=h_ary_in.dtype)
|
|
197
|
-
|
|
198
|
-
# Copy sub-array (rectangular buffer) from device to host-array.
|
|
199
|
-
cl.enqueue_copy(
|
|
200
|
-
queue,
|
|
201
|
-
h_ary_out,
|
|
202
|
-
d_out_buf,
|
|
203
|
-
buffer_origin=buf_out_origin[::-1],
|
|
204
|
-
host_origin=ary_out_origin[::-1],
|
|
205
|
-
region=sub_ary_shp[::-1],
|
|
206
|
-
buffer_pitches=(buf_out_shp[-1], buf_out_shp[-1]*buf_out_shp[-2]),
|
|
207
|
-
host_pitches=(ary_out_shp[-1], ary_out_shp[-1]*ary_out_shp[-2])
|
|
208
|
-
)
|
|
209
|
-
queue.finish()
|
|
210
|
-
|
|
211
|
-
# Check that the sub-array copied to device is
|
|
212
|
-
# the same as the sub-array received from device.
|
|
213
|
-
assert np.array_equal(h_ary_in[ary_in_slice], h_ary_out[ary_out_slice])
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
def test_enqueue_copy_buffer_p2p_amd(honor_skip=True):
|
|
217
|
-
platform = cl.get_platforms()[0]
|
|
218
|
-
if honor_skip and platform.vendor != "Advanced Micro Devices, Inc.":
|
|
219
|
-
pytest.skip("AMD-specific test")
|
|
220
|
-
|
|
221
|
-
devices = platform.get_devices()
|
|
222
|
-
if len(devices) < 2:
|
|
223
|
-
pytest.skip("Need at least two devices")
|
|
224
|
-
|
|
225
|
-
ctx1 = cl.Context([devices[0]])
|
|
226
|
-
ctx2 = cl.Context([devices[1]])
|
|
227
|
-
|
|
228
|
-
queue1 = cl.CommandQueue(ctx1)
|
|
229
|
-
queue2 = cl.CommandQueue(ctx2)
|
|
230
|
-
|
|
231
|
-
ary_shp = 256, 128, 32 # array shape
|
|
232
|
-
|
|
233
|
-
# Create host array of random values.
|
|
234
|
-
rng = np.random.default_rng(seed=42)
|
|
235
|
-
h_ary = rng.integers(0, 256, ary_shp, dtype=np.uint8)
|
|
236
|
-
|
|
237
|
-
# Create device buffers
|
|
238
|
-
d_buf1 = cl.Buffer(ctx1, cl.mem_flags.READ_WRITE, size=np.prod(ary_shp))
|
|
239
|
-
d_buf2 = cl.Buffer(ctx2, cl.mem_flags.READ_WRITE, size=np.prod(ary_shp))
|
|
240
|
-
|
|
241
|
-
# Copy array from host to device
|
|
242
|
-
cl.enqueue_copy(queue1, d_buf1, h_ary)
|
|
243
|
-
|
|
244
|
-
# Copy array from device to device
|
|
245
|
-
cl.enqueue_copy_buffer_p2p_amd(
|
|
246
|
-
platform,
|
|
247
|
-
queue1,
|
|
248
|
-
d_buf1,
|
|
249
|
-
d_buf2,
|
|
250
|
-
np.prod(ary_shp)
|
|
251
|
-
)
|
|
252
|
-
queue1.finish()
|
|
253
|
-
|
|
254
|
-
# Create zero-initialised array to receive array from device
|
|
255
|
-
h_ary_out = np.zeros(ary_shp, dtype=h_ary.dtype)
|
|
256
|
-
|
|
257
|
-
# Copy array from device to host
|
|
258
|
-
cl.enqueue_copy(queue2, h_ary_out, d_buf2)
|
|
259
|
-
queue2.finish()
|
|
260
|
-
|
|
261
|
-
# Check that the arrays are the same
|
|
262
|
-
assert np.array_equal(h_ary, h_ary_out)
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if __name__ == "__main__":
|
|
266
|
-
import sys
|
|
267
|
-
if len(sys.argv) > 1:
|
|
268
|
-
exec(sys.argv[1])
|
|
269
|
-
else:
|
|
270
|
-
from pytest import main
|
|
271
|
-
main([__file__])
|