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

floating point exception solving a non-symmetric matrix

xian-zhong_guous_cd-
360 Views

The floating point exception occurs when solving the attached non-symmetric matrix.

1 line: n

2nd line: index base (i.e. 0 based)

3rd line: nz

followed by all nonzeros in coordinate (i.e. triplet) format

Major version: 11
Minor version: 1
Update version: 1
Product status:  Product
Build: n20131010
Processor optimization: Intel(R) Advanced Vector Extensions (Intel(R) AVX) Enabled Processor

linux

Thanks,

Sam

0 Kudos
6 Replies
mecej4
Honored Contributor III
360 Views

I don't know what you mean by 'solving the matrix', and a floating point exception (FPE) can be caused by errors in your code or in the MKL library routines. If you show the code and other necessary details, we can attempt to help.

The example code pardiso_unsym_f.f that comes with MKL can be easily modified to solve the linear equation set A.x = b, with A as given by you and b = a vector with all elements = 1.0. The modified code is attached. It reads your data file, forming the matrix in COO format, and converts the matrix to CSR format before calling Pardiso to solve the linear equation set.

The code ran without any errors with IFort 15.0.4 in Windows-32, but you should probably check the solution before accepting it as correct. That the code ran without any FPEs indicates to me that the problem that you reported probably originated in your code rather than in the MKL library. A definite answer can only be given if you describe/show how you performed the calculation that resulted in a FPE.

 

0 Kudos
xian-zhong_guous_cd-
360 Views

I think I have a matrix to reproduce the floating point exception. Load PARDISO_matrix_7370.txt:

line 1 n

line 2 index base (0 based in this case)

line 3 nz

followed by coordinate format (i,j,a)

I solve it as general with b=0 yet solution is Nan and floating point exception occurs.

Major version: 11
Minor version: 1
Update version: 1
Product status:  Product
Build: n20131010

linux

 

Thanks

0 Kudos
mecej4
Honored Contributor III
360 Views

You say that the array indices are 0-based, yet the data file in #3 contains row numbers from 1 to n=7370. If you had, in fact, 0-based indices, row numbers should have ranged from 0 to n-1.

The result of this inconsistent numbering is that the first row of the matrix is taken to be zero, which would make the matrix singular. In that case, a floating point exception should be expected.

You should probably specify that 1-based indices are used, and enable checking of input matrix arrays, by setting iparm(27)=1.

0 Kudos
xian-zhong_guous_cd-
360 Views

Sorry, my bad. I was changing code to dump the matrix for matlab. Yes, output  matrix is 1 based yet my original matrix to PARDISO is 0 based. Floating point exception occurs after solving for the rhs.

0 Kudos
Gennady_F_Intel
Moderator
360 Views

When the matrix checker is enabled, then pardiso returns the input inconsistency ( -1) . You may try to get more details with sparse_matrix_checker routine.

*** Error in PARDISO  (incorrect input matrix  ) error_num= 22
*** Input check: i=62239, ja(i)=7371, neqns=7370 are incompatible

 

0 Kudos
mecej4
Honored Contributor III
360 Views

xian-zhong.guous.cd-adapco.com wrote:

...Floating point exception occurs after solving for the rhs.

Solving for the rhs? Do you mean unknowns?

In that case, there is no problem that concerns us, is there? The part of the program that uses MKL is done when the solution of the sparse matrix linear equations is obtained. If a floating point exception occurs subsequently, it is up to you to debug the part of your program where that happened.

That a floating point exception occurs is not an unusual or highly significant event. It can be caused by passing incorrect arguments to the solver, or it can occur if the matrix is singular. Its occurrence is just a sign that there is some error in your program that you have to track down and correct.

0 Kudos
Reply