Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6981 Discussions

MKL: transitioning from FFT to new DFT functions

gemma11
Beginner
573 Views

Hello. I have been using MKL7, and am currently evaluating MKL9 version in windows, using microsoft visual studio 5 combined withintel fortran 10. Could someone please list a number of steps to detail the modifications that need to be made to call the new DFT routines?

I need the sort of details a 4-year old might find useful. Thanks in advance.

0 Kudos
3 Replies
Dmitry_B_Intel
Employee
573 Views

Hi,

There are rather a few steps tomove to new FFT functions. The most important difference you will see is that while old functions computed FFT immediately, the new functions do FFT in several stages. They keep around a descriptor which holds the FFT problem you compute. When you deal with the descriptor you will need a few named constants defined in module mkl_dfti, so you'll need the module. The stages are:

use mkl_dfti

status = DftiCreateDescriptor( mydesc, ...problem definition... )

if (.not. DftiErrorClass(status, DFTI_NO_ERROR)) call abort('create descriptor failed')

status = DftiCommitDescriptor( mydesc )

status = DftiComputeForward( mydesc, ...reference todata... )

status = DftiComputeForward( mydesc, ...reference todata... )

status = DftiComputeForward( mydesc, ...reference todata... )

status = DftiComputeBackward( mydesc, ...reference todata... )

...
status = DftiFreeDescriptor( mydesc )

You are advised to check status returned by each call of the new functions; it shall be zero on successful completion. Once you've got the decriptor "committed" you may use it to computerespective FFT problem as many times as necessary.

"Problem definition" above is done by 4 parameters: (i) working precision, DFTI_SINGLE or DFTI_DOUBLE, (ii) input domain, e.g. DFTI_COMPLEX or DFTI_REAL, (iii) dimensionality of the problem, e.g. 1, and (iv) size of the problem (this should be array in case ofmultidimensional FFT).

"Reference to data" above is the name of the array containing the input and receiving the result of FFT because the transform is done in-place by default. You may wish to do FFT out of place, in which case you will need to adjust descriptor and pass two data references to DftiComputeForward.

The new functions provide much more functionality, such as out-of-place transforms, processing of data with strides, multiple transforms etc. To know how to utilize this functionality you will probably need to read the documentation.

There are also some examples in MKL installation directory please look at them to find outconcrete ways of usage.

With this in mind, here are the steps you may find useful for quick start

  1. Add mkl_dfti.f90 file to your project (and ensure it is compiled before the sources that use it)
  2. Add 'use mkl_dfti' into the functions that will do FFT
  3. Replace each call to old FFT function with a sort of the sequence shown above.

Dima

0 Kudos
gemma11
Beginner
573 Views

Thanks. I have tried but I need more help. I did not exhagerate about needing the same directions as a 4-year old. Proof of this is that I am still using the basic structure ofcodes written almost 20 years ago, with fortran 66 and fortran 77 semantics. So I am an aging fortran user pretty much set in my ways, almost hopeless.

There may added functionalities, but nothing beats simplicity. This new construction is, in my view,a significant step backwards, at least for people like me who simply wish tocalculate FFTs of complex data. Before I give the specifics of what I am trying to accomplish, does anyone know if it is worth the trouble? That is, what kind of performance improvements can one expect from the new routines, for 1- and 2-d complex FFTs?Typical 1-d arrays are easily 65536 long, while 2-d arrays can be as large as (1024, 32768). Anyway, hereare the specifics.I am transformingdata in the form of a complex 1-d vectorZof length Nas follows:

CALL ZFFT1D ( Z, N, 1, V)

V isthe workspace vector. I have added the mkl_dfti.f90 program to the project, and compiled it. It gives no compilation errors. What should be the result of this operation?

Then, inside the subroutine that made the call,I have added"USE MKL_DFTI" statement, and added the following lines:

Status = DftiCreateDescriptor ( mydesc, DFTI_DOUBLE,

DFTI_COMPLEX, 1, N )

if(.not.DftiErrorClass(status, DFTI_NO_ERROR)) call abort('create descriptor failed')

status = DftiCommitDescriptor( mydesc )

status = DftiComputeForward( mydesc, Z )

status = DftiComputeBackward( mydesc, Z)

Status = DftiFreeDescriptor(mydesc)

There are 5 error messages, one for each new line, as follows:

Error2 Error: There is no matching specific function for this generic function reference. [DFTICREATEDESCRIPTOR]

It appearsthat the compilation of the mkl-dfti program may not be producing the desired effects.Thanks in advance.

0 Kudos
Dmitry_B_Intel
Employee
573 Views

Oh, you must have forgotten to insert declaration:

type( dfti_descriptor ), pointer :: mydesc

Dima

0 Kudos
Reply