opencl - Copying an Image using PyOpenCL -
i've been having trouble making copy of image using pyopencl. wanted try copying want other processing, im not able understand basic task of accessing every pixel. please me catch error make sure works. here program import pyopencl cl import numpy import image import sys img = image.open(sys.argv[1]) img_arr = numpy.asarray(img).astype(numpy.uint8) dim = img_arr.shape host_arr = img_arr.reshape(-1) ctx = cl.create_some_context() queue = cl.commandqueue(ctx) mf = cl.mem_flags a_buf = cl.buffer(ctx, mf.read_only | mf.copy_host_ptr, hostbuf=host_arr) dest_buf = cl.buffer(ctx, mf.write_only, host_arr.nbytes) kernel_code = """ __kernel void copyimage(__global const uint8 *a, __global uint8 *c) { int rowid = get_global_id(0); int colid = get_global_id(1); int ncols = %d; int npix = %d; //number of pixels, 3 rgb 4 rgba int index = rowid * ncols * npix + colid * npix; c[index + 0] = a[index + 0]; c...