Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

CSR matrix handling and solution error

$
0
0

Hi,
I built my own class for CSR3 matrices for Mkl Pardiso and I have to know how Mkl knows the length of arrays (values and columnIndex ):
- Is it done by rowIndex[number_of_rows]?
- Is it done by some information provided by mkl_alloc?

I know it seems a very stupid question but it's a whole month that I'm working on this problem:
1st case
- I preallocate the matrix with an estimated number of nonzeros (element that are not really initialized has a flag that say that are not used)
- I compress it, deleting all unused/uninitialized elements
2nd case
- I preallocate the matrix*
- I read the matrix from an external file

The two matrices at the end are ABSOLUTELY IDENTICAL. It changes the way they're allocated first.
The case one works very well, but after a random number of steps of the dynamic problem it has a huge residual (sometimes >e+14, yes it's a plus)! At that time I write the matrix on a file, I read it back to another matrix and then I give this matrix to Pardiso again and puff! All is perfect again! Residual e-15!

Do you have any suggestion?

Many thanks,
Dario

*in the 2nd case it works also if I preallocate whatever number of nonzero and then I compress. It works well at anytime!
** comparing IPARM output I noticed that or iparm(63) one-indexed it changes everytime but in the step where I face the problem there's a -1 in the 1st case and 0 in the second case... I don't know if it is useful

Here my settings: ONE-indexed

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*IPARM easy settings*/
        IPARM(1) = 1;                /* No default values for solver */
        IPARM(6) = 0;                /* Write solution on u */
        IPARM(12) = 0;                /* Solve with transposed/conjugate transposed matrix [def: 0, solve simply A*x=b]*/
        IPARM(18) = -1;                /* Report number of nonzeros */
        IPARM(19) = -1;                /* Report number of floating point operations */
        IPARM(35) = 1;                /* Zero based indexing */
        IPARM(27) = 1;                /* Matrix checker */
        IPARM(28) = 0;                /* Double precision */
        IPARM(36) = 0;                /* Schur complement matrix computation control [def:0, do not compute Schur] */
        IPARM(56) = 0;                /* Diagonal and pivoting control [def:0, disabled] */
        IPARM(60) = 0;                /* In-Core (OC) / Out-Of-Core (OOC) switch [def:0, IC mode] */

        /* IPARM fine settings */
        IPARM(2) = 2;                /* Fill-in reducing ordering [def:2] */    
        IPARM(4) = 0;                /* Preconditioned CGS/CG [def:0] - HIGHLY RECOMMENDED */
        IPARM(5) = 0;                /* User fill-in reducing permutation [def:0, default filling]*/
        IPARM(8) = 10;                /* Maximum number of iterative refinement steps */
        IPARM(10) = 13;                /* Perturb the pivot elements with 1E-value [def:13 for unsymm/8 for symm, 1e-13 perturbation]*/
        IPARM(11) = 1;                /* Scaling MPS [def: 1 for unsym/0 for sym, scaling enabled] */
        IPARM(13) = 1;                /* Maximum weighted matching algorithm [def: 1 for nonsymmetric matrices, enabled) */
        IPARM(21) = 1;                /* Pivoting for symmetric indefinite matrices */
        IPARM(24) = 0;                /* Parallel factorization control [def:0, classic algorithm] */
        IPARM(25) = 0;                /* Parallel/sequential solve control [def:0, parallel] */
        IPARM(31) = 0;                /* ADV Partial solve and computing selected components of the solution vectors [def:0, disable]*/
        IPARM(34) = 0;                /* ADV Optimal number of threads for conditional numerical reproducibility (CNR) mode [def:0, disable]*/

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles