FFT 2D kernel runtime =0 in OpenCL

Hi guys

I’m working on a homework project compare performance of Fast Fourier Transform on CPU vs GPU . I’m done with the CPU part , but with GPU , I have a problem.

The trouble is the kernel runtime is zero , the input is the same as the output image . I use VS2010 on win7 with AMD APP SDK . Here is the [b]host code/b , the kernel, an addition header to handle the image , they can be found in The OpenCL Programming Book (Ryoji Tsuchiyama…)

My guess the error is in the phase where we pass values from the image pixels to the cl_float2 *xm (line 169-174 in the host code). I can’t access the vector component to check it either , the compiler ain’t accept .sX or .xy , throws an error about it . Other parts –kernel,header…- looks fine with me .

for (i=0; i < n; i++) {  
for (j=0; j < n; j++) {  
((float*)xm)[(2*n*j)+2*i+0] = (float)ipgm.buf[n*j+i];   //real
((float*)xm)[(2*n*j)+2*i+1] = (float)0; //imag
}   
}   

So hope you guys help me out . Any ideas will be appreciated .

I see that your code gets the error code generated by every OpenCL function call but you don’t seem to check whether that code actually equals CL_SUCCESS. I would suggest that you add such a check after every function call (doing it as a macro works well). Also check the build log after building your kernels in case that shows an error in your code.

How are you doing the timing as I don’t see any timing functions in your code?

Thank you for your reply ; I’ll check the error codes carefully and feedback later if I can’t solve it out :smiley:

About the timing ; I monitor the event kernelDone in fftCore function , just a quick check I added later after upload the code .