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

pardiso returns error code -1

PhilipS1
Beginner
804 Views

Hi there,

I moved from imkl compiled with VS 2015 toolset V140 to oneAPI 2025.0 compiled on VS 2022 toolset V143, all C++, and now get consistently  error code -1 (input inconsistent) using the same matrix-vector systems as before.

Here's a small example taken from pardiso_unsym.c that now goes wrong (just up to symbolic fact phase, that's where things already go wrong => error code -1):

 

/* Matrix data. */
MKL_INT n = 5;
MKL_INT ia[6] = { 1, 4, 6, 9, 12, 14 };
MKL_INT ja[13] =
{ 1, 2, 4,
1, 2,
3, 4, 5,
1, 3, 4,
2, 5
};
double a[13] =
{ 1.0,-1.0, -3.0,
-2.0, 5.0,
4.0, 6.0, 4.0,
-4.0, 2.0, 7.0,
8.0, -5.0
};
MKL_INT mtype = 11; /* Real unsymmetric matrix */
// Descriptor of main sparse matrix properties
struct matrix_descr descrA;
// Structure with sparse matrix stored in CSR format
sparse_matrix_t csrA;
sparse_operation_t transA;
/* RHS and solution vectors. */
double b[5], x[5], bs[5], res, res0;
MKL_INT nrhs = 1; /* Number of right hand sides. */
/* Internal solver memory pointer pt, */
/* 32-bit: int pt[64]; 64-bit: long int pt[64] */
/* or void *pt[64] should be OK on both architectures */
void* pt[64];
/* Pardiso control parameters. */
MKL_INT iparm[64];
MKL_INT maxfct, mnum, phase, error, msglvl;
/* Auxiliary variables. */
MKL_INT i, j;
double ddum; /* Double dummy */
MKL_INT idum; /* Integer dummy. */
/* -------------------------------------------------------------------- */
/* .. Setup Pardiso control parameters. */
/* -------------------------------------------------------------------- */
for ( i = 0; i < 64; i++ )
{
iparm[i] = 0;
}
iparm[0] = 1; /* No solver default */
iparm[1] = 2; /* Fill-in reordering from METIS */

iparm[2] = 1; //# procs

iparm[3] = 0; /* No iterative-direct algorithm */
iparm[4] = 0; /* No user fill-in reducing permutation */
iparm[5] = 0; /* Write solution into x */
iparm[6] = 0; /* Not in use */
iparm[7] = 2; /* Max numbers of iterative refinement steps */
iparm[8] = 0; /* Not in use */
iparm[9] = 13; /* Perturb the pivot elements with 1E-13 */
iparm[10] = 1; /* Use nonsymmetric permutation and scaling MPS */
iparm[11] = 0; /* Conjugate transposed/transpose solve */
iparm[12] = 1; /* Maximum weighted matching algorithm is switched-on (default for non-symmetric) */
iparm[12] = 0;
iparm[13] = 0; /* Output: Number of perturbed pivots */
iparm[14] = 0; /* Not in use */
iparm[15] = 0; /* Not in use */
iparm[16] = 0; /* Not in use */
iparm[17] = -1; /* Output: Number of nonzeros in the factor LU */
iparm[18] = -1; /* Output: Mflops for LU factorization */
iparm[19] = 0; /* Output: Numbers of CG Iterations */

maxfct = 1; /* Maximum number of numerical factorizations. */
mnum = 1; /* Which factorization to use. */
msglvl = 1; /* Print statistical information */
error = 0; /* Initialize error flag */
/* -------------------------------------------------------------------- */
/* .. Initialize the internal solver memory pointer. This is only */
/* necessary for the FIRST call of the PARDISO solver. */
/* -------------------------------------------------------------------- */
for ( i = 0; i < 64; i++ )
{
pt[i] = 0;
}
/* -------------------------------------------------------------------- */
/* .. Reordering and Symbolic Factorization. This step also allocates */
/* all memory that is necessary for the factorization. */
/* -------------------------------------------------------------------- */
phase = 11;
PARDISO(pt, &maxfct, &mnum, &mtype, &phase,
&n, a, ia, ja, &idum, &nrhs, iparm, &msglvl, &ddum, &ddum, &error);
if ( error != 0 )
{
printf("\nERROR during symbolic factorization: " IFORMAT, error);
exit(1);
}

etc.

 

I tried a 1x1 matrix vector system but with the same result.

Someone any idea?

 

Thanks!

 

 

0 Kudos
1 Solution
PhilipS1
Beginner
726 Views

Ok, found the solution myself, maybe helping others:

In the installation of oneAPI in step 3 (integrate with IDE) integrate with Visual Studio 2022 and then in the project properties -> Configuration Properties you see "Intel(R) Libraries for oneAPI", where you can select "Use oneMKL", set this to eg parallel.

 

Then all works fine.

 

best regards,

Philip

View solution in original post

0 Kudos
1 Reply
PhilipS1
Beginner
727 Views

Ok, found the solution myself, maybe helping others:

In the installation of oneAPI in step 3 (integrate with IDE) integrate with Visual Studio 2022 and then in the project properties -> Configuration Properties you see "Intel(R) Libraries for oneAPI", where you can select "Use oneMKL", set this to eg parallel.

 

Then all works fine.

 

best regards,

Philip

0 Kudos
Reply