- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm currently having a problem when I run my code. Every time I try to perform a DFT using the mkl routines I immediately get a segmentation fault before the program can do anything else. Whenever I void out the mkl routines from DftiCreate... to ...DftiFreeDiscriptor, the program runs fine. I tried using only the CreateDiscriptor call to see if it would even do that, but I keep getting an immediate segmentation fault whenever these calls are used. Is my usage correct? There are no errors when compiling; everything seems to be linking fine. Below is my implemetation.
#include "mkl_dfti.h"
int main( )
{
int i,j;
double x[4000], Cv[4000], FTreal[4000], FTimag[4000];
DFTI_DISCRIPTOR *DFT
for(i=0;i<4000;i++){x = Cv;}
long status;
status = DftiCreateDiscriptor( &DFT, DFTI_DOUBLE, DFTI_REAL, 1, 4000 );
status = DftiCommitDiscriptor( DFT );
status = DftiComputeForward( DFT, x );
status = DftiFreeDescriptor( &DFT );
for(j=0;j<2000;j++)
{
FTreal = x[2*j];
FTimag = x[2*j+1];
}
}
HELP!!!
I'm currently having a problem when I run my code. Every time I try to perform a DFT using the mkl routines I immediately get a segmentation fault before the program can do anything else. Whenever I void out the mkl routines from DftiCreate... to ...DftiFreeDiscriptor, the program runs fine. I tried using only the CreateDiscriptor call to see if it would even do that, but I keep getting an immediate segmentation fault whenever these calls are used. Is my usage correct? There are no errors when compiling; everything seems to be linking fine. Below is my implemetation.
#include "mkl_dfti.h"
int main( )
{
int i,j;
double x[4000], Cv[4000], FTreal[4000], FTimag[4000];
DFTI_DISCRIPTOR *DFT
for(i=0;i<4000;i++){x = Cv;}
long status;
status = DftiCreateDiscriptor( &DFT, DFTI_DOUBLE, DFTI_REAL, 1, 4000 );
status = DftiCommitDiscriptor( DFT );
status = DftiComputeForward( DFT, x );
status = DftiFreeDescriptor( &DFT );
for(j=0;j<2000;j++)
{
FTreal
FTimag
}
}
HELP!!!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't you need to allocate an extra element for the Nyquist frequency? An n-point real->complex fft needs 2*(n/2+1) elements using the default CCE storage format. You're probably crashing due to overwriting the end of the array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for replying!! Let's see...if I have a data set with 4000 elements (index ranging from 0-3999) then the DFT should output 2000 real elements and 2000 imaginary elements. So I thought allocating 4000 elements would be sufficient. However, I tried reducing the size of the input array without decreasing the allocated memory for both the input and output arrays, but I still get a segmentation fault the instant I press enter. I've also tried using a pointer in the following form:
void *X;
Double Xin[4000];
X = Xin;
This had no effect either.
I also tried going bare-bones by declaring my variables and making the DFT calls without trying to put the data in an output array other than the in-place array that the MKL DFT puts out. Still I have the same symptom. Perhaps I'm misunderstanding what you wrote. But, I think its odd that nothing in the code runs at all. I have a whole section that reads data from a data file that includes status messages; none of that stuff runs. The program seems to crash when it reads the headers....that is until I get rid og the DFT calls; then everything runs fine. ???? 8^P ????
void *X;
Double Xin[4000];
X = Xin;
This had no effect either.
I also tried going bare-bones by declaring my variables and making the DFT calls without trying to put the data in an output array other than the in-place array that the MKL DFT puts out. Still I have the same symptom. Perhaps I'm misunderstanding what you wrote. But, I think its odd that nothing in the code runs at all. I have a whole section that reads data from a data file that includes status messages; none of that stuff runs. The program seems to crash when it reads the headers....that is until I get rid og the DFT calls; then everything runs fine. ???? 8^P ????

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page