From 4ae9b25f9b0edc05cc1612b0e0ac88be2d5ff344 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sat, 2 Sep 2017 18:42:02 -0500 Subject: [PATCH] Typo fix in install docs --- doc/misc.rst | 2 +- examples/demo.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/misc.rst b/doc/misc.rst index 9043cf52..7069a584 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 62c0f7ee..faac547e 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) -- GitLab