diff --git a/doc/misc.rst b/doc/misc.rst index 9043cf526abb221f3c4c5e51c8d92f4a8502a58f..7069a5844e7818b1294d3fef5860b31ab271942c 100644 --- a/doc/misc.rst +++ b/doc/misc.rst @@ -41,7 +41,7 @@ On Linux, type: #. ``conda install pocl`` to install a CPU-based OpenCL driver on Linux. On Windows, you may install e.g. -the `OpenCL driver from Intel `. +the `OpenCL driver from Intel `_. OS X has support for OpenCL built into the operating system and does not need additional software to run code based on PyOpenCL (but see below). diff --git a/examples/demo.py b/examples/demo.py index 62c0f7ee5fe975f0d4097be41396b558e82eec50..faac547ee7283ab01873549c604655fa9ac2b6d0 100644 --- a/examples/demo.py +++ b/examples/demo.py @@ -12,8 +12,11 @@ ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) mf = cl.mem_flags -a_g = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a_np) -b_g = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=b_np) +a_g = cl.Buffer(ctx, mf.READ_WRITE, a_np.nbytes) +b_g = cl.Buffer(ctx, mf.READ_WRITE, b_np.nbytes) + +cl.enqueue_copy(queue, a_g, a_np) +cl.enqueue_copy(queue, b_g, b_np) prg = cl.Program(ctx, """ __kernel void sum( @@ -25,7 +28,7 @@ __kernel void sum( """).build() res_g = cl.Buffer(ctx, mf.WRITE_ONLY, a_np.nbytes) -prg.sum(queue, a_np.shape, None, a_g, b_g, res_g) +prg.sum(queue, (500, 10), (16, 16), a_g, b_g, res_g, g_times_l=True) res_np = np.empty_like(a_np) cl.enqueue_copy(queue, res_np, res_g)