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

Math kernel library yields different results to singular problems depending on processors

IsaPisa
Novice
657 Views

Hi,

I am using the MKL (2022.0.3) out of the oneAPI Base Toolkit in our product to solve linear equations. In tests artificial equations are inserted into the MKL to test our system.  For example the following equation shall be solved:

A * x = b,

while A is a 3 x 3 matrix with ones [1, 1, 1; 1, 1, 1; 1, 1, 1, 1] and b is a column vector with values [1; 2; 3]. There exists no unique solution to this problem. The documentation of the function ?geqrf recommends the use of the functions ?geqrf, ormqr and trsm to solve linear equations and that's what we do.

What we realized now is, that the results of the chain of functions  (?geqrf, ormqr and trsm) differ depending on the processors the tests are running on. While processors i7-3610QE CPU with 4 Cores and 8 logical processors yield the 'solution' [NaN, NaN, Infinity], the processors i7-1085OH CPU and i7-8700 CPU with 6 Cores and 12 logical processors yield [0, 0, 0].

Why these results differ?

The status of  the methods ?geqrf and ormqr equal to 0 (success) if we insert the variables as explained above. Why the library does not use the status of the functions ?geqrf and ormqr to propagate the singularity of the problem to reveal the user the uncertainty of the results?

Best regards Isa

 

 

0 Kudos
5 Replies
VidyalathaB_Intel
Moderator
633 Views

Hi Isa,

 

Thanks for reaching out to us.

 

>>Why these results differ?

 

In this case, we request you to provide us with 

  •  the sample reproducer code and 
  •  steps you have followed (mainly for compilation) 
  •  the output of MKL_VERBOSE environment variable for both processors

(usage:- set MKL_VERBOSE=1 before running your code) so that we can test the same from our end as well?

 

I hope the compilation command used is the same when running the code on both processors.

 

Additionally, I just want to share some information that might be helpful in case you miss it, 

There is a tool named "oneMKL LAPACK Function Finding Advisor", which helps you to find the recommended routines for your particular use case

Link: https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-function-finding-advisor.html#gs.5d3h6b

>>...that the results of the chain of functions

we see that you are using computational routines to solve the system of linear equations, maybe you can also give it a try using the driver routine which combines several tasks in one call

Link: https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/lapack-routines/lapack-linear-equation-routines.html

Anyways, Please get back to us with the sample reproducer code which will help us to investigate this issue on our end.

 

Regards,

Vidya.

 

0 Kudos
IsaPisa
Novice
612 Views

Hi,

thanks for your advises. I tried to set the environmental variable and succeeded, but I do not know where the additional information is printed. I am writing C# code in Visual Studio 2022.

Anyway I found out, that setting the architecture via "mkl_cbwr_set" to "MKL_CBWR_AVX" solved my problem. Now the results coincide on all devices. 

You asked yourself why we used these computational routines. My task was to translate old algorithms in C++ to new code in C#. In the old version we used a QR decomposition which was part of the IPP long time ago. In the first step I just wanted to translate it into C# language and since the QR decomposition is no longer part of the IPP, I had to switch to MKL.

Best regards

Isa

0 Kudos
VidyalathaB_Intel
Moderator
605 Views

Hi Isa,


>>Anyway I found out, that setting the architecture via "mkl_cbwr_set" to "MKL_CBWR_AVX" solved my problem. Now the results coincide on all devices. 

Yes, you are right, these settings help us to get reproducible results.


To anyone else who is looking into this issue, here are some more details about mkl_cbwr_set function and its usage.

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/obtaining-numerically-reproducible-results/get-started-with-conditional-num-reproducibility.html


Glad to know that your issue is resolved and thanks for letting us know about it.

As the issue is resolved, could you please let us know if we can close this thread from our end?


Regards,

Vidya.


0 Kudos
IsaPisa
Novice
595 Views

Hi,

you can close it. I am fine with it.

Have a nice day

Isa

0 Kudos
VidyalathaB_Intel
Moderator
587 Views

Hi Isa,


>>you can close it

Thanks for the confirmation.

Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.


Have a Great Day!


Regards,

Vidya.


0 Kudos
Reply