Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- how to deal with real and structurally symmetric matrix's parameters in PARDISO

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-18-2017
08:33 PM

79 Views

how to deal with real and structurally symmetric matrix's parameters in PARDISO

Hi

I want to use PARDISO to solve a problem, in which the matrix is real and structurally symmetric. I read the PARDISO Version 5.0.0 Reference Sheet — Fortran, and Parallel Sparse Direct Solver PARDISO | User Guide Version 5.0.0. I also lean some code which solve problem with symmetric or non-symmetric matrices. I know the parameter mtype need to be 1, since my matrix is real and structurally symmetric. But I do not know how to deal with other parameters.

Any help would be appreciated.

Regards,

rf.qian

Link Copied

9 Replies

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-19-2017
08:35 AM

79 Views

The MKL version of Pardiso is not quite the same as Pardiso-5. Do not use the Pardiso-5 documentation if you intend to use MKL-Pardiso, and vice versa.

Both come with ready-to-run examples for symmetric and unsymmetric problems. You could start with one of those and adapt the example source code to match your needs.

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-19-2017
07:45 PM

79 Views

Hi mecej4

Thanks for your suggestions.

I learned the code pardiso_unsym_f.f provided by Intel, which was my own code based on. Firstly I didn’t change any parameter such as mtype, iparm. The result was pretty good. Since my matrix was real and structurally symmetric, then I changed the parameter mtype to be 1, which was suggested by Intel for real and structurally symmetric matrix. And I did not change any other parameters, because the reference from Intel did not say anything about that. I was surprised to find that the new result was worse than the first one. Maybe I need to try to change some other parameters.

Regards,

rf.qian

Jing_X_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-21-2017
05:01 PM

79 Views

Do you have test code that can reproduce your problem?

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-21-2017
11:01 PM

79 Views

Thanks for your comment.

I reproduce my problem at my attached FORTRAN codes, test_mtype1.f and test_mtype11.f. These codes are based on pardiso_unsym_f.f, which is provided by Intel. I make some small changes in my own codes, mainly change the structural of matrix A (Ax=b) to make it structurally symmetric. And also change some of the nonzero values of A to make its condition number larger. The error are estimated through calculating the maxval(abs(b_new-b)), b_new=Ax_new, and x_new is the result calculated by pardiso. The only difference between test_mtype11.f and test_mtype1.f is the value of parameter mtype, and other parameters are all the same. In test_mtype11.f, mtype =11(default value for real and unsymmetric matrix). In test_mtype1.f, mtype =1(default value for real and structurally symmetric matrix). Since my matrix is real and structurally symmetric, it is expected that test test_mtype1.f should get better result. However, for test_mtype1.f , maxval(abs(b_new-b))=2.49e-14, for test_mtype11.f , maxval(abs(b_new-b))=8.88e-14. It means in some cases for real and structurally symmetric matrix, we can get better result if we set mtype to be 11.

However, I also make some other tests, change some of the nonzero values of A and keep it as real and structurally symmetric matrix. And I can get better result when mtype=1, the default value for real and structurally symmetric matrix.

In a word, according to my tests, for real and structurally symmetric matrix, sometimes we can get better result when mtype=1, and sometimes we can get better result when mtype=11.

Regards,

rf.qian

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-21-2017
11:10 PM

79 Views

Jing_X_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-23-2017
12:21 AM

79 Views

May I ask which version of mkl are you using?

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-23-2017
08:06 AM

79 Views

Hi Jing X

My ifort version is Intel Fortran Compiler Professional Edition 11.1 for Linux, mkl version is Intel® Math Kernel Library (Intel® MKL) 10.2 Update 4.

I hope these information would be helpful.

Regards,

rf.qian

Jing_X_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-26-2017
06:45 PM

79 Views

I've checked your codes. They are correct.

I think e-14 is close enough to be considered as 0, thus there are no differences between 2e-14 and 8e-14.

qian_r_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-26-2017
10:58 PM

79 Views

Hi Jing X

Thanks for your help.

I can show another example, test2_mtype1.f90 and test2_mtype11.f90.

The only difference between test2_mtype1.f90 and test2_mtype11.f90 is the value of parameter mtype, and other parameters are all the same. In test2_mtype11.f90, mtype =11(default value for real and unsymmetric matrix). In test2_mtype1.f90, mtype =1(default value for real and structurally symmetric matrix).

The error are still estimated through calculating the maxval (abs (b_new-b)), b_new=A*x_new, and x_new is the result calculated by pardiso.

Since my matrix A is real and structurally symmetric, it is expected that test2_mtype1.f90 should get better result. However, for test2_mtype1.f90 , maxval(abs(b_new-b))=2.48e-4, for test2_mtype11.f90 , maxval(abs(b_new-b))=1.25e-6. It means in some cases for real and structurally symmetric matrix, we can get better result if we set mtype to be 11.

In test2_mytype1.f90 and test2_mtype11.f90, the construction of sparse matrix A may looks puzzling. However, I’m confident that A is structurally symmetric.

I rewrite the matrix A in Matlab code calc_A_diff.m, and isequal(A, A’)/=0, which means A is not symmetric. In code calc_A_same.m, all the non-zero elements are set to be 1, and isequal (A, A’) =0. In conclusion, A is structurally symmetric matrix.

Since in test2_mtype1.f90 and test2_mtype11.f90, matrix A is constructed in csr format, and in calc_A_diff.m, A is constructed in coo format. It is necessary to prove A in Fortran code and Matlab code are the same. So I write comp_csr_coo.f90, in which I calculate A*phi. The result of A(coo format)*phi is b_coo_line, the result of A(csr format)*phi is b_csr_line. And maxval (abs (b_csr_line-b_coo_line)) = 8.39e-14. Besides, the absolute value of all the non-zero elements in A is greater than 1, and all the elements in phi are 1, so the error of maxval (abs (b_csr_line-b_coo_line)) is negligible. So I think A constructed in coo format and A constructed in csr format are the same.

Attached are my codes. And err_be002.txt is used to calculate b (Ax=b) in test2_mtype1.f90 and test2_mtype11.f90.

Regards,

rf.qian

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.