Hi Pongsak, What version of numpy do you have? This code works normally for me on the same configuration + numpy 1.7.1.
On Wed, Aug 14, 2013 at 11:42 PM, Pongsak Suvanpong <psk...@gmail.com> wrote: > Dear all > > I am trying to run the following from example in documentation but got error > show below, I wonder what have I done wong > > I am running pyopencl on python3.3 osx 10.8.4 > > thanks for any help > > import numpy > import pyopencl as cl > import pyopencl.array as clarray > from pyopencl.reduction import ReductionKernel > > ctx = cl.create_some_context() > queue = cl.CommandQueue(ctx) > krnl = ReductionKernel(ctx, numpy.float32, neutral="0", > reduce_expr="a+b", map_expr="x[i]*y[i]", > arguments="__global float *x, __global float *y") > x = clarray.arange(queue, 400, dtype=numpy.float32) > y = clarray.arange(queue, 400, dtype=numpy.float32) > m = krnl(x, y).get() > > > > --------------------- > /Users/psksvp/Local/Library/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyopencl-2013.2-py3.3-macosx-10.8-x86_64.egg/pyopencl/__init__.py:61: > CompilerWarning: Non-empty compiler output encountered. Set the environment > variable PYOPENCL_COMPILER_OUTPUT=1 to see more. > "to see more.", CompilerWarning) > Traceback (most recent call last): > File "p.py", line 13, in <module> > m = krnl(x, y).get() > File > "/Users/psksvp/Local/Library/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyopencl-2013.2-py3.3-macosx-10.8-x86_64.egg/pyopencl/array.py", > line 617, in get > ary = _as_strided(ary, strides=self.strides) > File > "/Users/psksvp/Local/Library/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyopencl-2013.2-py3.3-macosx-10.8-x86_64.egg/pyopencl/compyte/array.py", > line 170, in as_strided > return np.asarray(_DummyArray(interface, base=x)) > File > "/Users/psksvp/Local/Library/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/core/numeric.py", > line 325, in asarray > return array(a, dtype, copy=False, order=order) > ValueError: __array_interface__ shape must be at least size 1 > _______________________________________________ > PyOpenCL mailing list > PyOpenCL@tiker.net > http://lists.tiker.net/listinfo/pyopencl _______________________________________________ PyOpenCL mailing list PyOpenCL@tiker.net http://lists.tiker.net/listinfo/pyopencl