Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Problems usind DFT

Golvin
Beginner
396 Views

I want to compare the performance of Fourier Transforms between IPPS library and cuFFT library. Now Im comparing the Real to Complex case. For IPPS, I implemented the FFT (inputs size equal to 2^n) and then I tryed with the DFT (inputs of any size).

 

The FFT works fine but when I run the DFT I get an output of 0s. I read all the documentation about the DFT and did a very similiar code from  https://software.intel.com/content/www/us/en/develop/articles/how-to-use-intel-ipp-s-1d-fourier-tran...  but it stills dont work.

 

Im using IPPS version 2020.0.1 and Debian 10 as OS.

 

In the code I have a matrix as input and I will do as many DFT as row in the matrix. For each row I perform a DFT.

 

 

// NX == amount of columns in matrix
// BATCH == amounto of rows in matrix
int NX = 4;
int BATCH = 1;
int SEED = 1;
int flag = IPP_FFT_NODIV_BY_ANY;

int sizeSpec= 0;
int sizeInit = 0;
int sizeBuffer = 0;

Ipp8u *pMemInit = 0;
Ipp8u *pMemBuffer = 0;

// For this case, BATCH is 1 so only the NX is important
float **datos = (float**) malloc(sizeof(float*) * NX * BATCH);

// Generates a NX x BATCH matrix with random numbers of the 4 possibles //(-3.533, -1.000, 1.000, 3.533) using the SEED
datos = genMatrix(NX, BATCH, SEED);

Ipp32fc **dst = (Ipp32fc**) malloc(sizeof(Ipp32fc*) * (NX / 2 + 1) * BATCH);

// Check is NX is power of 2
if (!((NX) & (NX - 1)))
{
    // FFT 
    // ...
}
else
{
    IppsDFTSpec_R_32f *pSpec = 0;
    ippsDFTGetSize_R_32f(NX, flag, ippAlgHintNone, &sizeSpec, &sizeInit, &sizeBuffer);
    /// allocate memory for required buffers
    if (sizeInit > 0)
    {
        pMemInit = (Ipp8u*) ippMalloc_8u(sizeInit);
    }

    if (sizeBuffer > 0)
    {
        pMemBuffer = (Ipp8u*) ippMalloc_8u(sizeBuffer);
    }

    ippsDFTInit_R_32f(NX, flag, ippAlgHintNone, pSpec, pMemInit);

    if (sizeInit > 0)
    {
        ippFree(pMemInit);
    }

    // Do the DFT
   for (int i = 0; i < BATCH; i++)
   {
       dst[i] = (Ipp32fc*) malloc(sizeof(Ipp32fc) * (NX / 2 + 1));
       /// perform forward DFT
       ippsDFTFwd_RToCCS_32f((Ipp32f*) datos[i], (Ipp32f*) dst[i], pSpec, pMemBuffer);
   }
        
}

 

 

 

In the FFT option (power of 2) I have a similar code than in DFT. I run this code for both cases and in FFT it works but in DFT I only get 0s.

 

P.D: excuse me for my english

0 Kudos
4 Replies
VidyalathaB_Intel
Moderator
361 Views

Hi,

Thanks for reaching out to us.

>>Im using IPPS version 2020.0.1

Could you please try with latest ipp version which comes with oneAPI toolkit 2021.3.0.

and also share a complete reproducer if possible (along with the compiler that you are using) so that we can work on it from our end.

Thanks & Regards,

Vidya.



VidyalathaB_Intel
Moderator
332 Views

Hi,

Reminder:

Is your issue resolved ? Please let us know if the issue still persists by providing above mentioned details.

 

Regards,

Vidya.

 

Golvin
Beginner
318 Views

Hi,

Yes, I solved the problem.

 

I forgot to allocate memory for the pSpec variable.

VidyalathaB_Intel
Moderator
315 Views

Hi,

>>Yes, I solved the problem.

Thanks for the confirmation!

Glad to know that you have figured it out.

we are closing this thread as your issue is resolved.

If you require any additional assistance from Intel, please start a new thread.

Have a good day!

Regards,

Vidya.

 

 

Reply