Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
valeriyfedotov
Total Points:
70
Status Points:
20
Green Belt
July 6, 2009 2:08 PM PDT
Segmentation fault in dsyevr.
Hello. I cant make dsyevr work properly. After some tries I wrote simple example of my problem. There are two calls to dsyevr that work and two that don't. But the arguments look fine and differ with working examples too little. I can't understand what's the problem. My MKL version is 10.2.1.017, and I compile it with command
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 <stdio.h>
#include <mkl_lapack.h>
#include <unistd.h>

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[k]);
}
printf("\n");

return 0;
}

Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
July 7, 2009 12:01 AM PDT
Rate
 
#1

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



valeriyfedotov
Total Points:
70
Status Points:
20
Green Belt
July 7, 2009 12:46 AM PDT
Rate
 
#2 Reply to #1
Thank you. But with this new linking line don't helped with segmentation fault.

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.


Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
July 7, 2009 6:05 AM PDT
Rate
 
#3 Reply to #2

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?



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;
}



Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
July 7, 2009 7:18 AM PDT
Rate
 
#5 Reply to #4
See, the list of officially supported operating systems:
…..
Ubuntu* 8.10 (IA-32 / Intel® 64)

But – I will check the problem and will back if any upadates.




Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
July 7, 2009 7:22 AM PDT
Rate
 
#6 Reply to #5

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?



valeriyfedotov
Total Points:
70
Status Points:
20
Green Belt
July 7, 2009 7:39 AM PDT
Rate
 
#7 Reply to #6

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.


Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
July 9, 2009 7:37 AM PDT
Rate
 
#8 Reply to #7
Quoting - valeriyfedotov

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.
Valery,
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



Gennady Fedorov (Intel)
Total Points:
12,846
Status Points:
12,346
Brown Belt
October 6, 2009 11:05 PM PDT
Rate
 
#9 Reply to #8
Valery,
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





Intel Software Network Forums Statistics

8442 users have contributed to 31547 threads and 100373 posts to date.
In the past 24 hours, we have 11 new thread(s) 33 new posts(s), and 44 new user(s).

In the past 3 days, the most popular thread for everyone has been /fpp interferes with breakpoints/stepping through code - again The most posts were made to Help with hitting maximum record length in the compiler with debug info? The post with the most views is You could save the pre-proce

Please welcome our newest member mrnm