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

Simple code gets error=-1 inconsistent input in Pardiso

RichardY1
Beginner
2,245 Views

Hello,

 

I'm new on using  intel MKL Pardiso solver (2023.1.0 version) to solve for a small matrix as a demo on CentOS7. On calling pardiso(), output error value shows to be -1 for both phase 12 and phase 33, which said to be inconsistent input in documentation. That's the only info I can find throughout the Internet. I have no way to debug this issue. Could you help with this? Thanks a lot. Please check the code below.

#include "mkl.h"

int main (void)
{
    MKL_INT n = 5;
    MKL_INT ia[ ] = {1, 2, 4, 5, 6, 7};
    MKL_INT ja[ ] = {1, 2, 4, 3, 4, 5};
    double a[ ] =   {1, 1, 2, 1, 1, 1};
    MKL_INT mtype = 11;
    void *pt[64];
    double b[5], x[5];
    MKL_INT nrhs = 1;
    MKL_INT iparm[64];
    MKL_INT maxfct, mnum, phase, error, msglvl;
    MKL_INT i;
    double ddum;          /* Double dummy */
    MKL_INT idum;         /* Integer dummy. */

    for ( i = 0; i < 64; i++ ){
        iparm[i] = 0;
        pt[i] = 0;
    }
    iparm[0] = 1;         /* No solver default */
    iparm[1] = 2;         /* Fill-in reordering from METIS */
    iparm[7] = 2;         /* Max numbers of iterative refinement steps */
    iparm[9] = 13;        /* Perturb the pivot elements with 1E-13 */
    iparm[10] = 1;        /* Use nonsymmetric permutation and scaling MPS */
    iparm[11]= 0;         /* Transposed Matrix */
    iparm[17] = -1;       /* Output: Number of nonzeros in the factor LU */
    iparm[18] = -1;       /* Output: Mflops for LU factorization */
    iparm[34] = 0;        /* zero-based indexing */
    iparm[36] = 0;        /* CSR format */

    maxfct = 1;           /* Maximum number of numerical factorizations. */
    mnum = 1;             /* Which factorization to use. */
    msglvl = 1;           /* Print statistical information in file */
    error = 0;            /* Initialize error flag */

    phase = 12;
    PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
             &n, a, ia, ja, &idum, &nrhs, iparm, &msglvl, &ddum, &ddum, &error);
   
    phase = 33;
    b[0] = 1;
    b[1] = 10;
    b[2] = 3;
    b[3] = 4;
    b[4] = 5;
    PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
             &n, a, ia, ja, &idum, &nrhs, iparm, &msglvl, b, x, &error);
 
    printf ("\nThe solution of the system is: ");
    for ( i = 0; i < n; i++ ){
        printf ("\n x [%d] = % f", i, x[i]);
    }
0 Kudos
7 Replies
RichardY1
Beginner
2,221 Views

I found a fix.

 

There are several things that are related to this issue. First of all, compiling MKL package looks complicated to me. I'm using cmake with ninja to compile my program with gnu compiler. At first I manually specified the library and include path of MKL and referred to this Link method  for compiling flags. With these setup, the above simple code snippet reports error=-1.

 

Then I found this guide that shows example cmake code. Noticing that I should set MKL_INTERFACE to lp64 in CMakeList.txt since I'm using gnu compiler, otherwise the compiler complains that the definition of MKL_INT is long long, which can not be converted to int. Another thing is that I can switch between sequential and parallel with MKL_THREADING variable.

0 Kudos
Hsbsh
Beginner
2,209 Views
LLP64 is windows. LP64 is linux. So it is simple as that. You cannot use LLP64 on linux, it is just not how it works.
0 Kudos
RichardY1
Beginner
2,184 Views

I don't think that's correct. In MKLConfig.cmake, it said "Values: lp64, ilp64, GNU or INTEL interface will be selected based on Compiler"

0 Kudos
Hsbsh
Beginner
2,180 Views
What is not correct? ILP64 is even more rare, was used on Solaris.

LLP64 will not be there, as I said, that is only Windows.
0 Kudos
VarshaS_Intel
Moderator
2,136 Views

Hi,

 

Thanks for posting in Intel Communities.

 

We have tried at our end using the g++ and icpx compiler and we are able to get the expected results. Please find the below screenshot:

VarshaS_Intel_0-1681495433896.pngVarshaS_Intel_1-1681495448493.png

 

 

Could you please let us know the GNU compiler version you are using? Also, could you please provide us with the CMakeLists you are using to investigate more at our end?

 

Thanks & Regards,

Varsha

 

0 Kudos
RichardY1
Beginner
2,068 Views

Hi Varsha,

 

Thank you for your reply. The problem is actually due to my incorrect usage and I put the solution in the first reply. I don't have further questions and you can close this topic.

 

Regards,

0 Kudos
VarshaS_Intel
Moderator
2,051 Views

Hi Richard,


Thanks for the confirmation. Glad to know that your issue is resolved. This thread will no longer be monitored by Intel. If you need additional information, please start a new thread.


Have a Good day!


Thanks & Regards,

Varsha


0 Kudos
Reply