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

Can't compute 1D discrete sine transforms of size >=INT_MAX

Keipert__Kristopher
610 Views

n=INT_MAX: Intel MKL TRIG TRANSFORMS ERROR: Fatal error (error message=Intel MKL DFTI ERROR: Inconsistent configuration parameters

n=INT_MAX-1: Finishes fine

n=INT_MAX+1: Segmentation fault

I am using ILP64. Tracking through the FFTW interface, I I know the segfault occurs in s_init_trig_transform(). 

Compile line:

icc transform.cpp -std=c++11 -O3 -DMKL_ILP64 -xcore-avx2 -I${MKLROOT}/include/fftw -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -qopenmp
 
Minimal reproducible example:
#include <fftw3.h>
#include <fftw3_mkl.h>
#include <random>
#include <omp.h>

int main()
{
  MKL_INT n = 2147483647; //INT_MAX                                                                                    

  fftwf_init_threads();

  float* inout = (float*)fftwf_malloc(sizeof(float)*n);

  //Initialize inout array with random values                                                                          
  std::random_device rd;
  std::mt19937 gen(rd());
  std::uniform_real_distribution<float> dist(0.0f, 1.0f);
  #pragma omp parallel for
  for (size_t i=0; i<n; ++i) {
    inout =  dist(gen);
  }

  //FFTW Guru parameters                                                                                               
  const fftwf_r2r_kind kind = FFTW_RODFT00;
  int rank=1;
  int howmany_rank=0; //Not used by MKL                                                                                
  fftwf_iodim64* howmany_dims; //Not used by MKL                                                                       
  fftwf_iodim64* dims = (fftwf_iodim64*)fftwf_malloc(rank*sizeof(fftwf_iodim64));
  dims[0].n=n;
  dims[0].is=1;
  dims[0].os=1;

  fftwf_plan_with_nthreads(omp_get_max_threads());

  //in-place real-to-real sine transform                                                                               
  fftwf_plan p = fftwf_plan_guru64_r2r(rank, dims, howmany_rank, howmany_dims, inout, inout, &kind, FFTW_MEASURE);

  fftwf_execute(p);

  fftwf_destroy_plan(p);
  fftwf_free(inout);
  fftwf_cleanup_threads();

  return 0;
}
0 Kudos
2 Replies
Khang_N_Intel
Employee
610 Views

Hi Kristopher,

I have already provided the answer to this inquiry in the online service center since you and Kalyan opened a ticket there for this same problem.  I believe that Kalyan already communicated the answer to you.  Therefore, we are going to close this thread.

Should you have further questions, please do not hesitate to contact us.

 

Best Regards,

Khang

0 Kudos
Khang_N_Intel
Employee
610 Views

Hi Kristopher,

This behavior is documented here.

0 Kudos
Reply