- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you try to allocate working array dynamically, remove all opencv calls?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page