icc stuff.c -I"opt/intel/mkl/10.2.1.017/include/" -L"/opt/intel/mkl/10.2.1.017/lib/" -lmkl_core -lmkl_intel_thread -lguide -lpthread -lmkl_lapack -lmkl_intel
Source code (all arrays are of 1000 elements to ensure there is enough memory):
#include
#include
#include
int main(){
int n = 3;
// 1 2 3
// 2 4 5
// 3 5 7
double M[1000] = {1, 2, 3, 2, 4, 5, 3, 5, 7};
double a,b;
int i,j;
double accuracy = 1e-6;
int m;
double eigVal[1000];
double eigVect[1000];
int isuppz[1000];
double work[1000];
int iwork[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
}
printf("\n");
return 0;
}
链接已复制
Valery,
I guess you are trying to work on ia32 architecture, therefore you have to
1)setting L"/opt/intel/mkl/10.2.1.017/lib/32
and
2) using another linking line:
-Wl,--start-group -lmkl_intel -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -lpthread
As a result your linking line should be like:
icc stuff.c -I"opt/intel/mkl/10.2.1.017/include/" -L"/opt/intel/mkl/10.2.1.017/lib/32" -Wl,--start-group -lmkl_intel -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -lpthread
for more info how to link properly please refer to the KB article: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
--Gennady
Documentation says that when all eigenvalues are computed either by "A" parameter of by "I" parameter with i = 1 and j = n (this lines don't work), the routine references array isuppz, but it seems valid to me.
Well. At the first glance all input parameters are correct.
Valery, can you check the problem when all arrays will be allocated dynamically.
For the reproducing the problem - what is the CPU type you are working on?
I have done it with dynamical memory, but segfault remains. Also, it's intresting, when I uncomment bzero call, the program finishes normally.
#include
#include
#include
#include
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
}
printf("n");
return 0;
}
btw, originally i checked the problem on win32 and got the following output:
-0.600823 0.695387 11.905435
Do you have the similar results on ubuntu?
No, I have got -0.247820, 0.338816, 11.908962. But I checked them with maxima and online solvers, they are correct.
For myself, I made a = -1e20 and b = 1e20 with "V" option, and make error in my subroutine if dsyevr doesn't find all values.
And I will try it in Ubuntu 8.10 this week.
No, I have got -0.247820, 0.338816, 11.908962. But I checked them with maxima and online solvers, they are correct.
For myself, I made a = -1e20 and b = 1e20 with "V" option, and make error in my subroutine if dsyevr doesn't find all values.
And I will try it in Ubuntu 8.10 this week.
the segmentaion problem was reproduced on RHEL 4, but no problem on win32. we will investigate the problem and will back to you asap.
--Gennady
the segmentaion problem was reproduced on RHEL 4, but no problem on win32. we will investigate the problem and will back to you asap.
--Gennady
Valery,
the problem you reported has been fixed in the latest MKL v.10.2 Update 2 available now.
You can download it from intel registratin center.
The version is shipped with Intel Compiler Proffesional Edition, version 11.1 for Linux ( build 056 ).
See the log i 've got running your test:
[root@XXXXX 555076]# ./fix.out
FIRST STEPS
SECOND STEPS
THIRD STEPS
4 STEPS
-0.600823 0.695387 11.905435
--Gennady