- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sir or Madam,
Recently I am leaning and using MKL FFT in my work. I noticed that there is a option DFTI_BACKWARD_SCRAMBLED can applying an FFT to input data whose order is scrambled, or allowing a scrambled order of the FFT results. This may help us improve the code performance. It's possible to share some detail about this? Thanks a lot!
Best Regards,
Lei Fu
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LeiFu,
The parameter explanation in MKL user reference may be helpful.
https://software.intel.com/en-us/node/521974
DFTI_ORDERING
Some FFT algorithms apply an explicit permutation stage that is time consuming [4]. The exclusion of this step is similar to applying an FFT to input data whose order is scrambled, or allowing a scrambled order of the FFT results. In applications such as convolution and power spectrum calculation, the order of result or data is unimportant and thus using scrambled data is acceptable if it leads to better performance. The following options are available in Intel MKL:
-
DFTI_ORDERED
: Forward transform data ordered, backward transform data ordered (default option). -
DFTI_BACKWARD_SCRAMBLED
: Forward transform data ordered, backward transform data scrambled.
Table "Scrambled Order Transform" tabulates the effect of this configuration setting.
DftiComputeForward |
DftiComputeBackward |
|
---|---|---|
DFTI_ORDERING |
Input → Output |
Input → Output |
|
ordered → ordered |
ordered → ordered |
|
ordered → scrambled |
scrambled → ordered |
NOTE
The word "scrambled" in this table means "permit scrambled order if possible". In some situations permitting out-of-order data gives no performance advantage and an implementation may choose to ignore the suggestion.
So you can set the paramater in your sample ( or use MKL sample code) when the result is not important and see if there is performance benefit and result scrambled.
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ying,
Thanks for your reply. I have tried to add "status = DftiSetValue(FFT_desc, DFTI_ORDERING, DFTI_BACKWARD_SCRAMBLED);"
And using " status = DftiComputeBackward(FFT_desc, FFT_in_singlePrecision, FFT_out_singlePrecision);" to run the FFT. But the output is no different. What's I missing;
My example code:
status = DftiCreateDescriptor(&FFT_desc, DFTI_SINGLE, DFTI_COMPLEX, 1, FFTSize);
//DFTI_INPLACE is FFT output overwrites input, DFTI_NOT_INPLACE is FFT output does not overwrite input
status = DftiSetValue(FFT_desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiSetValue(FFT_desc, DFTI_ORDERING, DFTI_BACKWARD_SCRAMBLED);
status = DftiComputeBackward(FFT_desc, FFT_in_singlePrecision, FFT_out_singlePrecision);
status = DftiFreeDescriptor(&FFT_desc);
Thanks a lot!
Lei Fu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lei Fu,
Do you have DftiCommitDescriptor functions after the descriptor value setting changed. How about to add the commit?
Performs all initialization for the actual FFT computation.
Syntax
f you call the DftiSetValuefunction to change configuration parameters of a committed descriptor (see
Descriptor Configuration Functions), you must re-commit the descriptor before invoking a computation
function. Typically, a committal function call is immediately followed by a computation function call (see FFT
Computation Functions).
On the other hands, although the note claimed
The word "scrambled" in this table means "permit scrambled order if possible". In some situations permitting out-of-order data gives no performance advantage and an implementation may choose to ignore the suggestion.
Anyway, if you hope to see the effect of the parameter, According Table "Scrambled Order Transform" show, DftiComputeBackward, scrambled → ordered. you may try first DftiComputeForward and see the result.
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ying,
Let me copy my full example code:
printf("Doing %d-point FFT!\n", FFTSize);
fprintf(fp_timingLog, "Doing %d-point FFT:\n", FFTSize);
fprintf(fp_PrecisionLog, "Doing %d-point FFT:\n", FFTSize);
//mkl_set_num_threads(2);
//configure and run single precision floating-point FFT
//configure fft descriptor: single precision, 2048-point FFT
//DFTI_SINGLE is single precision, DFTI_DOUBLE is double precision
status = DftiCreateDescriptor(&FFT_desc, DFTI_SINGLE, DFTI_COMPLEX, 1, FFTSize);
//DFTI_INPLACE is FFT output overwrites input, DFTI_NOT_INPLACE is FFT output does not overwrite input
status = DftiSetValue(FFT_desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiSetValue(FFT_desc, DFTI_NUMBER_OF_USER_THREADS, 2);
#if FORWARD
//status = DftiSetValue(FFT_desc, DFTI_ORDERING, DFTI_BACKWARD_SCRAMBLED);
#else
status = DftiSetValue(FFT_desc, DFTI_ORDERING, DFTI_BACKWARD_SCRAMBLED);
#endif
//frease FFT descriptor
status = DftiCommitDescriptor(FFT_desc);
#if FORWARD
//run fft with forward method
status = DftiComputeForward(FFT_desc, FFT_in_singlePrecision, FFT_out_singlePrecision);
#else
//run fft with backward method
status = DftiComputeBackward(FFT_desc, FFT_in_singlePrecision, FFT_out_singlePrecision);
#endif
status = DftiFreeDescriptor(&FFT_desc);
And I also noticed that in mkl_dfti.h
/* DFTI_ORDERING */
DFTI_ORDERED = 48,
DFTI_BACKWARD_SCRAMBLED = 49,
/* DFTI_FORWARD_SCRAMBLED = 50, ## NOT IMPLEMENTED */
No any different in forward and backward FFT computation.
My MKL version is 11.2 Update 3
Thanks a lot!
Best Regards,
Lei
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lei,
Could you please attach a whole cpp file. By the button Attach media at the end of the webpage.
Thanks
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lei Fu.
the note claimed
The word "scrambled" in this table means "permit scrambled order if possible". In some situations permitting out-of-order data gives no performance advantage and an implementation may choose to ignore the suggestion. ( you may ask what is the situations, i will check with developer and get back to you).
I change the test problem size as
#define SCRAMBLED 1 //0
#define FORWARD 1
int FFT_sizeBuf[FFT_SIZE_NUM]= {2000}
and change the SCRAMBLED as 0.
The results was scrambled.
Regards,
Ying
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page