Hi Bogdan, Thomas Fai, a student in a class [1] I'm co-teaching, and I just came up with the following direct CL translation of the PyCUDA example for PyFFT. Since parts of the translation might be difficult to guess for users who aren't familiar with PyOpenCL, I thought it might be useful if you could include this example on PyFFT's page as well (or, alternatively, add it to the package).
Thanks again for PyFFT! Andreas [1] http://cs.nyu.edu/courses/fall10/G22.2945-001/index.html
pgp3zYUlyzmae.pgp
Description: PGP signature
from pyfft.cl import Plan import numpy import pyopencl as cl import pyopencl.array as cl_array ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) plan = Plan((16, 16), queue=queue) data = numpy.ones((16, 16), dtype=numpy.complex64) gpu_data = cl_array.to_device(ctx, queue, data) print gpu_data plan.execute(gpu_data.data) result = gpu_data.get() print result plan.execute(gpu_data.data, inverse=True) result = gpu_data.get() error = numpy.abs(numpy.sum(numpy.abs(data) - numpy.abs(result)) / data.size) print error < 1e-6
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
