cutComparel2fe with double data type?

Hi all,

I found CUDA indeed very powerful to perform FFT and I have modified the simpleCUFFT example to make it running with double precision data type.

I observe that the h_convolved_signal and h_convolved_signal_ref both become double2* and their x are 2.2121987206156351 and 2.2121986217226501 which are in good agreement up to 1e-7! But the cutComparel2fe() still prompts error:

“ERROR, l2-norm error -1.#IND is greater than epsilon 1e-005”
“FAILED”

Does it means cutComparel2fe() cannot works with double data type?

Here it is in the codes:

CUTBoolean res = cutCompareL2fe((float*)h_convolved_signal_ref, (float*)h_convolved_signal, 2 * SIGNAL_SIZE, 1e-5f);
printf("%s\n", (1 == res) ? “PASSED” : “FAILED”);

Thanks for your advice!

Assuming that h_convolved_signal is a double array, these casts are the problem. You can’t just cast a double pointer to a float pointer and expect the compiler to transparently change the data types. The memory layout for float and double are different. Casting a double to a float by value does what you expect in C, but pointers do not. You’ll have to rewrite cutCompareL2fe to work with double arrays.

Thank you very much! I shall investigate cutCompareL2fe but is it part of the runtime API? Where can I find this function? Are there any equivalent functions available in runtime API?

Along with all functions beginning with ‘cut’ it is part of the utilities directory of the SDK. As such, it’s not supported by NVIDIA - those routines are simply there to make writing the SDK examples easier. tmurray will be along with the baseball bat shortly…