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

pardiso(...) returns with -1 in the &error, but this doesn't help fix the problem

bevin_b_
New Contributor I
291 Views

The code containing the following returns from pardiso with -1 in the error, saying 'something is wrong'.

Obviously pardiso knows what is wrong.   It is a shame it won't tell me.

Furthermore there is a major lack of working examples of calling pardiso from C++ on Windows, so I can't even try another example to find out whether it is a source code problem, a link time problem, or a runtime problem.

 

This is a truely frustrating piece of software to use.   Maybe that explains why all the major companies seem to be using another vendor's version -  I would to if I could get a license for it https://pardiso-project.org/


/Bevin


bool SolveforX__AX_equal_B__usingMKL(
SparseMatrixForMKL_FormatCSR & A,
DenseMatrixForMKLParadiso & X,
DenseMatrixForMKLParadiso & B)
{
CHECK(A.nRows == A.nCols); // A has to be symmetric
CHECK(A.nCols == X.nRows); // Since A X = B
CHECK(A.nRows == B.nRows);
CHECK(X.nCols == B.nCols);

static size_t calls = 0;
if (!calls++) for (size_t n = 0; n < 64; n++) pt[n] = nullptr;
}

static const MKL_INT maxfct = 1;

static const MKL_INT mnum = 1;
const MKL_INT mtype = 2;
const MKL_INT *n;
const float *a;
const MKL_INT *ia;
const MKL_INT *ja;
A.cook(n, a, ia, ja);
CHECK(*n == A.nCols);
CHECK(*n == A.nRows);

std::vector<MKL_INT> perm(*n);
std::fill(perm.begin(), perm.end(), 0);

const MKL_INT nrhs = B.nCols;

MKL_INT iparm[64];
{
for (size_t n = 0; n < 64; n++) iparm[n] = 0;
iparm[0] = 1; // we are filling in all the parameters
iparm[1] = 2; // Sequential nested dissection algorithm
iparm[7] = 2; // Maximum number of iterative refinement steps that the solver performs
iparm[9] = 13; // The default value for nonsymmetric matrices
iparm[10] = 1; // Enable scaling. Default for nonsymmetric matrices.
iparm[12] = 1; // Enable matching. Default for nonsymmetric matrices
iparm[17] = -1; // Enable reporting. The default value is -1.
iparm[26] = 1; // Enabble checking the input matrices
iparm[27] = 1; // single precision inputs and internal temporaries
iparm[34] = 1; // 1 means Row and col numbers start at 0, not 1
iparm[36] = 0; // Use CSR format for matrix storage.
}

MKL_INT msglvl = 1; // pardiso generates output, pardiso seems to modify this!
MKL_INT error = 0;

auto const bData = B.data();
auto const xData = X.data();

auto doPhase = [&](const MKL_INT phase) {
pardiso(
pt,
&maxfct,
&mnum,
&mtype,
&phase,
n,
a,
ia,
ja,
perm.data(),
&nrhs,
iparm,
&msglvl,
bData,
xData,
&error);

CHECK(!error);
};

doPhase(11);
doPhase(22);
doPhase(33);
doPhase(-1);

return true;
}

0 Kudos
2 Replies
bevin_b_
New Contributor I
283 Views

I finally stumbled across the fact that pardiso writes errors to stdout!   It would have been helpful if the manual had mentioned this fact.  I work in VS environment creating tests and the stdout is not going somewhere that I usually look!

Now I can see the error messages, I can see what my issues are and I have a trivial case working

0 Kudos
VidyalathaB_Intel
Moderator
230 Views

Hi Bevin,

 

Thanks for reaching out to us.

 

>> It would have been helpful if the manual had mentioned this fact. I work in VS environment creating tests and the stdout is not going somewhere that I usually look!

We regret the inconvenience caused.

We are working on your issue and will get back to you soon with an update regarding the same.

 

>>pardiso with -1 in the error, saying 'something is wrong'.

According to the MKL developer reference manual if the error value is -1 it indicates that the input is inconsistent.

You can refer to the below link for more details

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-iface/pardiso.html

 

Additionally, could you please let us know the MKL version you are using?

 

Regards,

Vidya.

 

0 Kudos
Reply