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

IPP IFFT providing wrong Results

jeff222
Beginner
483 Views

Hello, 

 

We are having a problem with our IPP IFFT, when Unit testing the results come out correctly but when using the IPP on our onboard computer. the IFFT stops working. The same symptom occurs on both MKL and IPP implementations of IFFT.  Anything that you might see out of place with our implementation would  be great. 

 

Please let me know any other information that you might need

 

Thanks, 

Jeff 

 

source code: 

IPP

int vifft(vector *result, vector *operand)
#endif
{
  IppsFFTSpec_C_32f *pFFTSpec;
  Ipp8u *specBuff = specBuffer, *initBuff = initBuffer, *workBuff = workBuffer;
  int order;

  if ((operand == NULL) || (result == NULL))
  {
    printf("ipp_ifft: NULL vectors pointers.\n");
    return V_LIB_ERR_NULL_INPUT;
  }

  if (operand->length != result->length)
  {
    if ( 0 != vresize(result, operand->length) )
 {
 printf("ipp_ifft: reallocation failed in c_vresize");
 return V_LIB_ERR_BAD_INPUT_LEN;
}
}

/* Check if the out_length is NOT a power of 2 for the FFT length. */
if (!IS_POWER_OF_2(result->length))
{
  printf("ipp_ifft: input vectors length not a power of 2");
  return V_LIB_ERR_INCOMPATIBLE_INPUTS;
}

order=(int)(log((double)operand->length)/LOG_2);

/* Initialize FFT */
ippsFFTInit_C_32f(&pFFTSpec, order, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone,
specBuff, initBuff);
if (result->isreal)
{
if (!operand->isreal)
{
notification_method("Incompatible mode vectors were provided to vifft");
return V_LIB_ERR_INCOMPATIBLE_INPUTS;
}

memset(f32_buff1, 0, sizeof(f32_buff1));
/* Do the iFFT */
ippsFFTInv_CToC_32f(operand->real, f32_buff1, result->real, f32_buff2,
pFFTSpec, workBuff);

}
else
{
/* Do the iFFT */
ippsFFTInv_CToC_32f(operand->real, operand->imag, result->real, result->imag,
pFFTSpec, workBuff);
}

return V_LIB_SUCCESS;

} /* end ipp_vifft */

 

MKL

int vifft(vector *result, vector *operand)
#endif
{
DFTI_DESCRIPTOR_HANDLE descriptor;
MKL_LONG status = 0;
int i;
double scale = (double)1.0/(double)operand->length;

if ((NULL == result) || (NULL == operand))
{
notification_method("Null pointer provided to vifft");
return V_LIB_ERR_NULL_INPUT; /* if there was a problem, bail out and cause no damage */
}

if (result->isreal != operand->isreal)
{
notification_method("Incompatible mode vectors were provided to vifft");
return V_LIB_ERR_INCOMPATIBLE_INPUTS; /* if there was a problem, bail out and cause no damage */
}

/* Check if the operand is NOT a power of 2 for the FFT length. */
/* Check if a number is a power of 2 then bitwise & of n and n-1 will be zero.*/
/* Also handles 0 length fail. */
if (!(operand->length && (!(operand->length & (operand->length - 1)))))
{
/* Not a power of 2, return FALSE, do not continue. */
notification_method("operand and result lengths are not a power of 2 for vifft");
return V_LIB_ERR_BAD_INPUT_LEN;
}

/* Convert the vector arrays into complext_type arrays of data for Win32 library calls. */
/* Add the vector input values into a temporary complex array. */
for (i = 0; i < operand->length; i++)
{
cplx_input[i].re = operand->real[i];
cplx_input[i].im = operand->imag[i];
}

if (i < MAX_FFT_PROC_LENGTH)
{
/* zero fill the rest of the array, if needed. */
/* the rest already set to 0 by memset
** or can be done with
** for (i = input_length; i < fft_size; i++)
** {
** cplx_input[i].re = 0.0;
** cplx_input[i].im = 0.0;
** }
*/
memset(&cplx_input[i], 0, (MAX_FFT_PROC_LENGTH - i) * sizeof(complext_type));
}
memset(cplx_output, 0, MAX_FFT_PROC_LENGTH * sizeof(complext_type));

/* Specify size and precision */
status = DftiCreateDescriptor(&descriptor, DFTI_DOUBLE, DFTI_COMPLEX, 1, operand->length);
if (status)
{
notification_method("vfft: DftiCreateDescriptor status !0");
}
/* Out of place FFT */
status = DftiSetValue(descriptor, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
if (status)
{
notification_method("vfft: DftiSetValue status !0");
}
/* Scale down the output */
status = DftiSetValue(descriptor, DFTI_BACKWARD_SCALE, scale);
if (status)
{
notification_method("vfft: DftiSetValue status !0");
}
/* Finalize the descriptor */
status = DftiCommitDescriptor(descriptor);
if (status)
{
notification_method("vfft: DftiCommitDescriptor status !0");
}
/* Compute the Backward FFT */
status = DftiComputeBackward(descriptor, cplx_input, cplx_output);
if (status)
{
notification_method("vfft: DftiComputeBackward status !0");
}
/* Free the descriptor */
status = DftiFreeDescriptor(&descriptor);
if (status)
{
notification_method("vfft: DftiFreeDescriptor status !0");
}

if (operand->length != result->length)
{
if (V_LIB_SUCCESS != vresize(result, operand->length) )
{
notification_method("vifft: reallocation failed in vresize");
return V_LIB_ERR_VRESIZE_FAIL; /* at this point result points to freed memory */
}
}

/* Convert the complext_type output array into a vector. */
/* Note: cplx_output pointer = b_y1 pointer */
for (i = 0; i < result->length; i++)
{
result->real[i] = cplx_output[i].re;
result->imag[i] = cplx_output[i].im;
}

return V_LIB_SUCCESS;
} /* end of mkl_vifft */

 

0 Kudos
3 Replies
VidyalathaB_Intel
Moderator
464 Views

Hi,


Thanks for reaching out to us.

>>when Unit testing the results come out correctly but when using the IPP on our onboard computer. the IFFT stops working.

Could you please provide us with the complete reproducer and steps to reproduce the issue?

Please let us know the environment details of the onboard computer which you have mentioned.

It would be a great help if you provide us with the correct results that you are getting after unit testing and the details of the issues that you are getting while running the same on another computer.

Additionally, do let us know the version of IPP and MKL you are working with.


Regards,

Vidya.


0 Kudos
VidyalathaB_Intel
Moderator
442 Views

Hi,


Reminder:

Could you please provide us with an update regarding your issue? Please provide us with the above-requested details if the issue still persists.


Regards,

Vidya.


0 Kudos
VidyalathaB_Intel
Moderator
427 Views

Hi,


As we haven't heard back from you, we are closing this thread. Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.


Regards,

Vidya.


0 Kudos
Reply