Accuracy of PARDISO

Accuracy of PARDISO

I has a small matrix (n=48). The accuracy of MATLAB and MKL PARDISO are quite different:
MATLAB residual: 2-norm 1.250161804204626e-07
PARDISO residual: 2-norm 1.186591757935306e+03
I don't understand why the PARDISO cannot produce the same accuracy as MATLAB A\\b.

Thanks for your help.

Sam

AttachmentSize
Download A.txt6.26 KB
Download b.txt624 bytes
Download matlab_sol.txt1.27 KB
Download pardiso_sol.txt1.27 KB
12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

did you check the condition number of this matrix?

>> cond(A)

ans =

1.250081999283924e+02

>> eig(A)

ans =

2.395441724550711e+11
2.271802498600055e+11 + 3.091006606027738e+09i
2.271802498600055e+11 - 3.091006606027738e+09i
2.113308605843553e+11
2.040439390271114e+11
1.835309421701949e+11
1.740280874283554e+11
1.636233271246197e+11
1.488291388705964e+11
1.045340131479051e+11 + 2.842311992656343e+10i
1.045340131479051e+11 - 2.842311992656343e+10i
1.079025452608366e+11 + 7.440306883944510e+09i
1.079025452608366e+11 - 7.440306883944510e+09i
-2.210911096764425e+10 + 4.833850596043668e+10i
-2.210911096764425e+10 - 4.833850596043668e+10i
9.304577649448915e+10
9.067298757011990e+10 + 8.721777091855450e+09i
9.067298757011990e+10 - 8.721777091855450e+09i
-6.016609417576445e+09 + 4.841294022371614e+10i
-6.016609417576445e+09 - 4.841294022371614e+10i
6.836232667651626e+10 + 2.347903082090967e+10i
6.836232667651626e+10 - 2.347903082090967e+10i
-2.250742166239584e+09 + 4.691201652540957e+10i
-2.250742166239584e+09 - 4.691201652540957e+10i
6.853390765045703e+10 + 4.100049977690267e+09i
6.853390765045703e+10 - 4.100049977690267e+09i
1.242713604529428e+10 + 4.056964951832189e+10i
1.242713604529428e+10 - 4.056964951832189e+10i
2.212254101351174e+10 + 3.751015188340012e+10i
2.212254101351174e+10 - 3.751015188340012e+10i
-2.241814362932148e+10
-2.108621430170533e+10
-1.756041677755004e+10
-9.754330784124445e+09
4.513630366289114e+10 + 1.857663284398454e+10i
4.513630366289114e+10 - 1.857663284398454e+10i
5.976331729030062e+09
3.309794298902519e+10
1.792912198083435e+10 + 6.157245673102320e+09i
1.792912198083435e+10 - 6.157245673102320e+09i
2.941420054488364e+10
2.486067244813024e+10
1.821153436448252e+10
1.643283862853254e+10
-9.600000000000000e+10
-9.600000000000000e+10
-9.600000000000000e+10
-9.600000000000000e+10

mecej4's picture

You have probably made some mistakes in calculating the residual from PARDISO.

However, since you did not describe how you did this I cannot pinpoint the error.

You should get a residual 2-norm less than 1E-7 from PARDISO.

There are many reasons why you can't reproduce identical results, like:

1.Single-precision data type vs. Double-precision data type;
2.Differentimplementations ofthe samealgorithm (Rolled loops vs. Unrolled loops \ FP-emulator vs. SSE2 \ possible Vectorization);
3.If a GPU is used ( NVIDIA clearly states that results could be different );
4. Or, anything else, an error in calculations ( as already suggested )...

You could ran into troubles even with smaller matrices because of limitations of IEEE 754 standard ( especially for a single-precision data type ). Here is an example with 8x8 matrices:

// Matrix A - 8x8 - 'float' type:

101.0 201.0 301.0 401.0 501.0 601.0 701.0 801.0
901.0 1001.0 1101.0 1201.0 1301.0 1401.0 1501.0 1601.0
1701.0 1801.0 1901.0 2001.0 2101.0 2201.0 2301.0 2401.0
2501.0 2601.0 2701.0 2801.0 2901.0 3001.0 3101.0 3201.0
3301.0 3401.0 3501.0 3601.0 3701.0 3801.0 3901.0 4001.0
4101.0 4201.0 4301.0 4401.0 4501.0 4601.0 4701.0 4801.0
4901.0 5001.0 5101.0 5201.0 5301.0 5401.0 5501.0 5601.0
5701.0 5801.0 5901.0 6001.0 6101.0 6201.0 6301.0 6401.0

// Matrix B - 8x8 - 'float' type:

101.0 201.0 301.0 401.0 501.0 601.0 701.0 801.0
901.0 1001.0 1101.0 1201.0 1301.0 1401.0 1501.0 1601.0
1701.0 1801.0 1901.0 2001.0 2101.0 2201.0 2301.0 2401.0
2501.0 2601.0 2701.0 2801.0 2901.0 3001.0 3101.0 3201.0
3301.0 3401.0 3501.0 3601.0 3701.0 3801.0 3901.0 4001.0
4101.0 4201.0 4301.0 4401.0 4501.0 4601.0 4701.0 4801.0
4901.0 5001.0 5101.0 5201.0 5301.0 5401.0 5501.0 5601.0
5701.0 5801.0 5901.0 6001.0 6101.0 6201.0 6301.0 6401.0

// Matrix C = Matrix A * Matrix B - 8x8 - 'float' type:

13826808.0 14187608.0 14548408.0 14909208.0 15270008.0 15630808.0 15991608.0 16352408.0
32393208.0 33394008.0 34394808.0 35395608.0 36396408.0 37397208.0 38398008.0 39398808.0
50959604.0 52600404.0 54241204.0 55882004.0 57522804.0 59163604.0 60804404.0 62445204.0
69526008.0 71806808.0 74087608.0 76368408.0 78649208.0 80930008.0 83210808.0 85491608.0
88092408.0 91013208.093934008.0 96854808.0 99775608.0 102696408.0 105617208.0 108538008.0
106658808.0 110219608.0 113780408.0 117341208.0 120902008.0 124462808.0 128023608.0 131584408.0
125225208.0 129426008.0 133626808.0 137827616.0 142028400.0 146229216.0 150430000.0 154630816.0
143791600.0 148632416.0 153473200.0 158314016.0 163154800.0 167995616.0 172836416.0 177677200.0

I've underlined all Inexactvalues.

Sorry that I couldn't answer your question completely.

Best regards,
Sergey

I'veverified your results from 'matlab_sol.txt' and 'pardiso_sol.txt'. Yes, results are different but a magnitude of differences is very small.

Here are twovalues from the middle of your resultingdata sets:

...
1.640625000000001e-03 1.640620000000000e-03
...

Absolute Error = 0.000000005000000
Relative Error = 0.000003047628336
Percentage Error = 0.000304762833627%

It is assumed that PARDISO's value is a true value and Matlab's value is acalculated value.

So, I think this isbecause ofreasons 1, 2 or 3 from my previous post.

I agree the difference is small but since the magnitude of A is large, the difference of the residule is quite large. Is there any way we can improve the accuracy of PARDISO?

Hi,

I will run your matrix and come back to you.

BTW, as I see you dumped a dence matrix - did you pass it in sparse format to PARDISO? I mean did you remove zero entries from the matrix or not?

Regards,
Konstantin

Hi Xian-Zhong,

I have solved the matrix with PARDISO MKL 10.3.5. Relative residual is 1E-15.

Did you switched weighted matching ON(iparm[12]=1)? It seems that with matching OFF the solution is really incorrect, but you should know that this option is intended precisely for improving accuracy and it's ON by default for unsymmetrical matrices.

I've attached the output of my program.

Regards,
Konstantin

Attachments: 

AttachmentSize
Download output.txt0 bytes

Quoting xian-zhong.guous.cd-adapco.comI agree the difference is small but since the magnitude of A is large, the difference of the residule is quite large. Is there any way we can improve the accuracy of PARDISO?

No, the result provided by PARDISO (1e-15 relative residual) is the most accurate that can be achieved in double precision arithmetics even theoretically.

Andrew Smith's picture

Extract from Intel help file for PARDISO:

iparm(12)

This parameter is reserved for future use. Its value must be set to 0.

Quoting Andrew SmithExtract from Intel help file for PARDISO:

iparm(12)

This parameter is reserved for future use. Its value must be set to 0.

I did not say anything about iparm(12) :) I referred to iparm[12] that is iparm(13) in Fortran.

Moreover, iparm(12) is also used in the latest version of MKL for new nice feature:
iparm(12)- solving with transposed or conjugate transposed matrix.

Regards,
Konstantin

Login to leave a comment.