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

Using multiple DFTI DESCRIPTOR (FFT in MKL)

Chris_L_1
Beginner
1,105 Views

Is it possible to create and commit several different DFTI descriptor and re-use them later (the FFT of different sizes will be called many times, and creating the descriptor and free it for each call seems not efficient). In other words, can the descriptor be created/committed and then saved in some arrays?

 

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
1,105 Views

yes, that's possible.

0 Kudos
Chris_L_1
Beginner
1,105 Views

Thanks. It's good to know. I have the following section of code. My question is how to extend it to the cases with much more than 3 lengths? I tried to save the descriptor in an array,  it compiles and does now run.

      Use MKL_DFTI
      integer ier, n, k
      complex cx(1000)
      type(DFTI_DESCRIPTOR), POINTER ::  HD1, HD2, HD3, HDk
      type(DFTI_DESCRIPTOR) HD(3)

      ier=DftiCreateDescriptor(HD1,DFTI_SINGLE,DFTI_COMPLEX,1, 32)
      ier=DftiCreateDescriptor(HD2,DFTI_SINGLE,DFTI_COMPLEX,1,132)
      ier=DftiCreateDescriptor(HD3,DFTI_SINGLE,DFTI_COMPLEX,1,232)

      ier=DftiCommitDescriptor(HD1)
      ier=DftiCommitDescriptor(HD2)
      ier=DftiCommitDescriptor(HD3)

      HD(1) = HD1
      HD(2) = HD2
      HD(3) = HD3

      do k = 1, 3

        n = 32 + 100*(k-1)
        ! ignored : Fill cx(1) ... cx(n)

! The following does not work:
!       HDk = HD(k)

! But this is OK
        if(k.eq.1 ) HDk=HD1
        if(k.eq.1 ) HDk=HD2
        if(k.eq.1 ) HDk=HD3

        ier = DftiComputeForward( HDk, cx )

      end do

      ier = DftiFreeDescriptor(HD1)

0 Kudos
Chris_L_1
Beginner
1,105 Views

Error correction: The pointer assignments (in the above) are

 

        if(k.eq.1 ) HDk=>HD1
        if(k.eq.2 ) HDk=>HD2
        if(k.eq.3 ) HDk=>HD3

       Are there any way to avoid writing the "if( ... ) ..." statement many times (e.g., ~ 20)?

 

 

0 Kudos
Reply