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

Pardiso generates wrong result for a small test matrix

Izzy_W_
Beginner
242 Views

Hi, 

I've written a test program to get familiar with the pardiso. However I find that comparing with the result from Eigen the pardiso spits out totally incorrect answer. I have totally no idea what went wrong and please help. Code is attached.  The compile command I used is also listed as: 

icpc -I ~/Lib/Eigen -std=c++11 -mkl=parallel -qopenmp -O3 -xCORE-AVX2 PTEST.cpp -o PardisoTest

 

Best,

Izzy 

0 Kudos
2 Replies
Izzy_W_
Beginner
242 Views

I shall add a little bit more illustration on what I'm doing. I just generate a random nonsingular matrix(H) and a random column(C), then find the the solution x via H^(-1) * C. Then H matrix is transformed into CSR form and passed as parameter to pardiso. All the above embodied in the code. 

0 Kudos
Zhen_Z_Intel
Employee
242 Views

Hi,

The problem probably caused by option for generating multi-thread code, if you remove -qopenmp option during compiling, the result would be same. When you use -qopenmp, all variables will be allocated on stack by default, if there's uninitialized array elements in your program, the result would be different. I noticed there are some problems of your code.

If you would like to use -qopenmp option, please modify your program:

...
//double B[10]={0}; change to
double B[10];
//double X[10]={0};
double X[10];
//int iparm[64]={0};
MKL_INT iparm[64];
//int pt[64]={0}; 
void *pt[64];
//int perm[10]={0};
MKL_INT perm[10];
...

Best regards,
Fiona

0 Kudos
Reply