Segmentation fault in dsyevr.

valeriyfedotov
Total Points:
70
Status Points:
20
Green Belt
July 7, 2009 7:09 AM PDT
Rate
 
#4 Reply to #3
My distro is Ubuntu 9.04, and processor Core 2 Quad Q9400.
I have done it with dynamical memory, but segfault remains. Also, it's intresting, when I uncomment bzero call, the program finishes normally.

#include <stdio.h>
#include <mkl_lapack.h>
#include <unistd.h>
#include <string.h>

int main(){
int n = 3;
// 1 2 3
// 2 4 5
// 3 5 7
double MM[1000] = {1, 2, 3, 2, 4, 5, 3, 5, 7};
double *M = (double *) malloc( sizeof(double) * 1000);
memcpy(M, MM, sizeof(double) * 9);
//bzero(M, sizeof(double) * 1000);
double a,b;
int i,j;
double accuracy = 1e-6;
int m;
double *eigVal = (double *) malloc( sizeof(double) * 1000);
double *eigVect = (double *) malloc( sizeof(double) * 1000);
int *isuppz = (int *) malloc( sizeof(int) * 1000);
double *work = (double *) malloc( sizeof(double) * 1000);
int *iwork = (int *) malloc( sizeof(int) * 1000);
int many = 1000;
int status = 0;

// First two work:
a = -100;
b = 100;
dsyevr("V", "V", "L", &n, M, &n, &a, &b, &i, &j, &accuracy, &m, eigVal, eigVect, &n, isuppz,
work, &many, iwork, &many, &status);

i = 1; j = 2;
dsyevr("V", "I", "L", &n, M, &n, &a, &b, &i, &j, &accuracy, &m, eigVal, eigVect, &n, isuppz,
work, &many, iwork, &many, &status);

// Second two make segfaults:
i = 1; j = 3;
dsyevr("V", "I", "L", &n, M, &n, &a, &b, &i, &j, &accuracy, &m, eigVal, eigVect, &n, isuppz,
work, &many, iwork, &many, &status);

dsyevr("V", "A", "L", &n, M, &n, &a, &b, &i, &j, &accuracy, &m, eigVal, eigVect, &n, isuppz,
work, &many, iwork, &many, &status);

int k;
for(k = 0; k < n; k ++){
printf("%f ", eigVal[k]);
}
printf("\n");

return 0;
}



Intel Software Network Forums Statistics

8470 users have contributed to 31601 threads and 100640 posts to date.
In the past 24 hours, we have 31 new thread(s) 110 new posts(s), and 153 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member kopernikus