Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

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

$
0
0

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[i] =  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;
}

Viewing all articles
Browse latest Browse all 3005


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>