Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Segfault in PARDISO

asd__asdqwe
Beginner
486 Views

Hello,

I'm using PARDISO to solve linear systems, and I'm facing an issue when it comes to computing the solution.
If you take a look at ${MKLROOT}/examples/solverc/source/pardiso_sym_c.c and change the call line 164, from:

PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, x, &error);

to:

PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &n, 0, 0, 0, &idum, &nrhs, iparm, &msglvl, b, x, &error);

I get a segmentation fault. Are you trying to dereference either a, ia or ja, even after the numerical factorization ? Even more puzzling is the fact that if I use line 100:

iparm[5] = 1; /* Write solution into b */

instead of:

iparm[5] = 0; /* Write solution into x */

and if I call PARDISO like:

PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, 0, &error);

Then I also get a segmentation fault. Are all these the expected behavior ? Thanks for your help.

0 Kudos
10 Replies
Alexander_K_Intel2
486 Views
Hi, About first question: Based on documentation ia& ja arrays are accessed in all phases of the solution process so you need to set them as parameter. Array a could be changed on &ddum on solving phase in this example. Second question: in definition of iparm[5]=1 there is note: "The solver stores the solution on the right-hand side b. Note that the array x is always used." In such case array x used as work array. With best regards, Alexander Kalinkin
0 Kudos
asd__asdqwe
Beginner
486 Views
Hi, Indeed you are right, this does work on pardiso_sym_c.c, however supplying &ddum on solving phase in my application for array a still makes PARDISO crash, while providing the correct array a makes it run smoothly. Any idea why that could be ?
0 Kudos
Alexander_K_Intel2
486 Views
HI, It's could happened in case when your mtype is not 2, for example... In such situation iterative solver could turn on because there is a number of zero pivot on diagonal of factorize matrix. But to make deep investigation of this situation I need to check it on my side - could you send testcase to me to reproduce it? With best regards, Alexander Kalinkin
0 Kudos
asd__asdqwe
Beginner
486 Views
Thanks for your help. Here is a matrix + the code to load it in memory and call PARDISO, if you switch between the two statements at the end of the code, you'll get a segfault or not. The matrix type is symmetric positive definite (mtype == 2). PS: the code is really nasty, I don't delete some of the variables being allocated, but I have copy/paste'd only the interesting part of a bigger file, please excuse me for that.
0 Kudos
Alexander_K_Intel2
486 Views
Hi, Thanks a lot for testcase. In your file I've changed number of iterations (_iparm[7] ) from 2 to 0 and example has passed correctly. Could you check it? With best regards, Alexander Kalinkin
0 Kudos
asd__asdqwe
Beginner
486 Views
Yes it works perfectly, thanks, and sorry about my mistake, I just started using PARDISO and I'm not very familiar with all the input parameters.
0 Kudos
Alexander_K_Intel2
486 Views
Hi, Feel free to ask any question about MKL functionality in general and PARDISO in particular.To be honest I enjoy fruitful discussions discussions on technical topics around MKL so, again, please don't hesitate to ask more questions With best regards, Alexander Kalinkin
0 Kudos
asd__asdqwe
Beginner
486 Views
Sorry to bump this old thread, but I'm facing another kind of problem right now. I have uploaded a new .tar.gz, it includes the same files as the previous archive, plus a Makefile and three other files used to generate a shared library. The problem is the following : whether I use -static-intel or not, I get a segmentation fault, whereas it is working fine when I'm not using the shared library (with the same code). I'm using MPICH2 with icpc version 13.0.0 (gcc version 4.7.0 compatibility) Do you see what could be the problem ? Thanks for your help.
0 Kudos
mecej4
Honored Contributor III
486 Views
Even the plain pardiso_all.cpp, without any usage of MPI, causes a seg-fault. That is because you failed to initialize the pointer array _pt to NULL, as the documentation stipulates that you should do before calling PARDISO for the first time. If you add the statement [cpp] for(int k=0; k<64; k++)_pt=NULL;[/cpp] before the first call to PARDISO, the program goes through and prints reasonable-looking results. You may also use other means of initializing _pt to NULLs using the features that C/C++ provide you.
0 Kudos
asd__asdqwe
Beginner
486 Views
You were right, sorry about that and thank you !
0 Kudos
Reply