Manticore/pyfft — Issue #6: pyfft does not work properly with PyOpenCL 2011.2
Author: tnorth
Created: 2012-02-22 16:51:50+00:00
State: open

Following the example of http://packages.python.org/pyfft/, I tried a simple FFT with OpenCL (see below)
Note: pyFFT doesn't import with PyOpenCL 2011.2: reason: pyopencl has no attribute VERSION
(cl.py, line 8). I bypassed the issue by removing that check.

After that:
>>> from pyfft.cl import Plan
>>> import numpy
>>> import pyopencl as cl
>>> import pyopencl.array as cl_array
>>> ctx = cl.create_some_context(interactive=False)
>>> 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
[[ 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j
1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j]
...
[ 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j
1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j 1.+0.j]]
>>> plan.execute(gpu_data.data)

>>> result = gpu_data.get()
>>> print result
[[ 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j]

What I expected:
[[ 256.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j] [ 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j
0.+0.j 0.+0.j]]

(A DC component equals to the sum of all the ones in the initial matrix)