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

Non-determinism in calling Pardiso from C#

euan
New Contributor I
643 Views
Hi,

When I hooked up my C# app to MKL version 9 (.3 maybe) I had problems getting deterministic results from Pardiso. The answers were very close but different each time which is a bit of a pain in some situations. I fixed it by aligning my C# double arrays to 16 byte boundaries and that was fine. I've just upgraded to 10.1 and used the samples provided in this forum to expose the MKL functions I want in a Dll and call them in the recommended way but I can't make it become deterministic again, even when aligning to 16 byte boundaries. Is this expected?

I've attached a modified version of the C# pardiso example that demonstrates the non-determinism. The differences that this program shows are tiny, but they can be a lot worse. The program repeatedly calls pardiso and compares the result.

Also, I notice pardiso outputs a load of text to the console. How do I control this?

Any advice would be great.

Thanks,

Euan
0 Kudos
1 Reply
Sergey_K_Intel1
Employee
643 Views

Dear Euan,

Let's start from the second question. The setting msglvl = 0 turns off printing of statistical information to the console.

The non-deterministic behavior can be explained by the largecondition number of your matrix and it is not connected with your way of MKL usage.The condition number of your matrix computed with the help of DGESVD from LAPACK is equal to 3.9347692E+14.As you know, the condition number is the measure of sensitivity of the system to round off errors. Since PARDISO as some other parts of MKL uses dynamic parallelization, round off errors as well as solution vectors might slightly vary from run to run. According to the theory (see for example the book "Matrix algorithms" by G.W.Stewart ), any variation in solution vector which satisfies to the condition || exact solution - computed solution ||/ || right hand side || < the condition number multiplied the relative precision for double data type is considered as normal. For your matrix, the value of the condition number multiplied the relative precision for double data type is 4.368471354246140E-002. I run your code with different number of threads and the deviation measured as max | first solution - second solution | was always less than 4.368471354246140E-002. If you are interested in repeatable results I'd recommend using the sequential version of MKL.

All the best

Sergey


0 Kudos
Reply