cufft 2d size problems


I’m trying to use cufft for image processing.
But, I found strange behaviour of cufft.
When I try to transform 640x640 images, cufft works well.
But, for other sized images, e.g 639x639 images, it fails.
I’m wondering why this happens.
for some sizes, it works well, but for other sizes, it fails with different error messages. Sometimes, it fails with CUFFT_EXEC_FAILED, and sometimes, with CUFFT_INTERNAL_ERROR.

I’m using WinXP 32bit, MS VC++ 2005, GTX680 and CUDA 2.0.

Thanks in advance.

Oops! Never mind.

I just found that I made a mistake while allocating memory.

Anyway, I can’t find how to remove this article. :(


I still have a problem. I fixed my allocation code, but the program still fails with the same symptom.

Following is my code. I inserted this code into ‘’ of the simpleCUFFT example in CUDA SDK to test this strange thing.

void runMyTest()


	int w = 639;

	int h = 639;

	float2* h_signal = new float2[w * h];

	float2* d_signal;

	cufftHandle plan;

	cudaMalloc((void**)&d_signal, w*h*sizeof(float2));

	cudaMemcpy(h_signal, d_signal, w*h*sizeof(float2), cudaMemcpyHostToDevice);

	cufftResult err1 = cufftPlan2d(&plan, h, w, CUFFT_C2C);

	printf("%d\n", err1);

	cufftResult err2 = cufftExecC2C(plan, d_signal, d_signal, CUFFT_FORWARD);

	printf("%d\n", err2);

	cufftResult err3 = cufftDestroy(plan);

	printf("%d\n", err3);


	delete[] h_signal;


and it fails with the following output

I found one more strange thing.

If I remove either ‘cudaMemcpy(…)’ or ‘cufftExecC2C(…)’, then the program outputs no error message, but if I put both of them, then the program fails with the error message above.

PLEASE HELP ME. :tearywave:

cudaMemcpy(h_signal, d_signal, whsizeof(float2), cudaMemcpyHostToDevice);

First pointer should be destination, not source. Try

cudaMemcpy(d_signal, h_signal, whsizeof(float2), cudaMemcpyHostToDevice);

Oh… :">

Thank you.

I fixed it and it’s working now. :haha:

Hello sodomau, I have I question…2D Complex-to-Complex Transform, how can I do source data creation?.. i mean, i’m trying to probe 2D C2C trasfom, but I don’t know how to load data to trasform!.. please tell me…