Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Guoyao_X_Intel
Employee
85 Views

core dumped when using DftiCreateDescriptor(desc,prec,domain,dim,sizes) with dim=2 and sizes more than {1000, 1000}

I'm trying to perform fft on linux system(specifically cent OS 7) by Intel MKL. After writing a successfully running code sample on windows i moved it to linux and met with segmentation fault(core dumped). I carefully checked the code and found that it is the sizes parameter specified in DftiCreateDescriptor(desc,prec,domain,dim,sizes) causes this bug. Once any number in sizes is larger than 1000 with dims=2 will cause this bug. I shifted different versions of MKl but it remains.

Does anyone have any idea about this bug?

the compile arg: g++ comparison.cpp `pkg-config opencv --cflags --libs` -I/opt/intel/vtune/compilers_and_libraries_2018.3.222/linux/mkl/include/  -L/opt/intel/compilers_and_libraries_2019/linux/mkl/lib/intel64/ -lmkl_rt -g

Here is my code

#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <omp.h>

#include "mkl_dfti.h"


int main() {
	MKL_LONG len[2] = { 1080, 1920 }, status;
	float x_in[1080][1920];
	DFTI_DESCRIPTOR_HANDLE fft;
	status = DftiCreateDescriptor(&fft, DFTI_SINGLE, DFTI_REAL, 2, len);
	status = DftiSetValue(fft, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
	status = DftiCommitDescriptor(fft);

	//float x[100* 100];
	float x_out[1080][1920];
	for (int i = 0; i < 10; i++) {
		double totalcputime = (double)cv::getTickCount();
		//std::cout << status << std::endl;
		status = DftiComputeForward(fft, x_in, x_out);
		//std::cout << status << std::endl;
		totalcputime = ((double)cv::getTickCount() - totalcputime) / cv::getTickFrequency();
		std::cout << "MKL-DFT Time: " << totalcputime << std::endl;
	}
	cv::Mat sizedimage = cv::Mat::zeros(1080, 1920, CV_32FC1);
	cv::Mat opencvtransform = cv::Mat(1080, 1920 / 2 + 1, CV_32FC1);
	for (int i = 0; i < 10; i++) {
		double totalcputime = (double)cv::getTickCount();
		cv::dft(sizedimage, opencvtransform);
		totalcputime = ((double)cv::getTickCount() - totalcputime) / cv::getTickFrequency();
		std::cout << "opencv-DFT Time: " << totalcputime << std::endl;
	}
	
	return 0;
}

 

0 Kudos
1 Reply
Gennady_F_Intel
Moderator
85 Views

Could you try to allocate working array dynamically, remove all opencv calls?

Reply