Skip to content

Commit 9bf904b

Browse files
fixed a bug for the OpenCL backend under Python 3
1 parent 6169807 commit 9bf904b

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

examples/opencl/convolution.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import numpy
33
import kernel_tuner
4+
from collections import OrderedDict
45

56
with open('convolution.cl', 'r') as f:
67
kernel_string = f.read()
@@ -14,7 +15,7 @@
1415
filter = numpy.random.randn(17*17).astype(numpy.float32)
1516

1617
args = [output, input, filter]
17-
tune_params = dict()
18+
tune_params = OrderedDict()
1819
tune_params["block_size_x"] = [16*i for i in range(1,9)]
1920
tune_params["block_size_y"] = [2**i for i in range(6)]
2021

examples/opencl/convolution_correct.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"""
2525
import numpy
2626
import kernel_tuner
27+
from collections import OrderedDict
2728

2829
with open('convolution.cl', 'r') as f:
2930
kernel_string = f.read()
@@ -37,7 +38,7 @@
3738
filter = numpy.random.randn(17*17).astype(numpy.float32)
3839

3940
args = [output, input, filter]
40-
tune_params = dict()
41+
tune_params = OrderedDict()
4142
tune_params["block_size_x"] = [16*i for i in range(1,9)]
4243
tune_params["block_size_y"] = [2**i for i in range(6)]
4344

examples/opencl/matmul.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import numpy
33
import kernel_tuner
4+
from collections import OrderedDict
45

56
problem_size = (4096, 4096)
67
size = numpy.prod(problem_size)
@@ -10,7 +11,7 @@
1011
C = numpy.zeros_like(A)
1112

1213
args = [C, A, B]
13-
tune_params = dict()
14+
tune_params = OrderedDict()
1415
tune_params["block_size_x"] = [16*2**i for i in range(3)]
1516
tune_params["block_size_y"] = [2**i for i in range(6)]
1617

examples/opencl/vector_add.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
32
import numpy
43
from kernel_tuner import tune_kernel
54

kernel_tuner/opencl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def memset(self, buffer, value, size):
146146
147147
"""
148148
if isinstance(buffer, cl.Buffer):
149-
cl.enqueue_fill_buffer(self.queue, buffer, numpy.array(value).astype(numpy.float32), 0, size/4)
149+
cl.enqueue_fill_buffer(self.queue, buffer, numpy.array(value).astype(numpy.float32), 0, size//4)
150150

151151
def memcpy_dtoh(self, dest, src):
152152
"""perform a device to host memory copy

0 commit comments

Comments
 (0)