Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Find Solution to Input Error in PARDISO*

$
0
0

Background:

Intel® Math Kernel Library (Intel® MKL) provides user-callable sparse solver based on Parallel Direct Sparse Solver Interface (PARDISO*). It was widely used in solving large sparse linear systems of equations and in the external iteration of solving nonlinear equation.

We had published many of articles on PARDISO usage and solutions to certain issues [Ref1-Ref5]. This article tries to address a kind of common error like *** Error in PARDISO when call PARDISO* and provide common check points guide to solve the problem. The errors are reported in forum threads:  
https://software.intel.com/en-us/forums/topic/516336
https://software.intel.com/en-us/forums/topic/489205
https://software.intel.com/en-us/forums/topic/292179

Typical Problem:

Trying to implement the PARDISO solver for a nonlinear finite element problem, get stuck with the following error:

*** Error in PARDISO ( sequence_ido,parameters) error_num= 8
*** Input check: ia[neqns]_new -1 _old -1 are incompatible
*** Input parameters: inconsistent error= 8 max_fac_store_in: 1         

Test code: https://software.intel.com/sites/default/files/managed/4e/73/pardiso_11.cpp

Check Points 1: Sparse Matrix Storage Format

Intel MKL PARDISO solver accepts the 3-array variation of the compressed sparse row (CSR) format (described in Sparse Matrix Storage Format) as input matrix. There are two places which cause most of the error of PARIDSO crash without reason or get incorrect result or “Pardiso - phase 11 errors”.

1. The CSR format in MKL PARDISO requires require column indices ja to be in increasing order per row.

For example, in U516336, incorrect ia and ja arrays input, (i.e swap ia and ja array) cause the error:

*** Error in PARDISO ( sequence_ido,parameters) error_num= 8

*** Input check: ia[neqns]_new -1 _old -1 are incompatible

*** Input parameters: inconsistent error= 8 max_fac_store_in: 1

2. The CSR format supports both One- or Zero-based indexing of the sparse matrix. Especially the Zero-based indexing format causes most of the error of Input parameters: inconsistent error. The basic rule for zero-based is that, last element of array ia is equal to number of nonzero elements, while it is number of nonzero elements + 1 in case of 1 based format. Please see the CSR matrix format sample at the end of the article.

For example, in U489205, the problem has 459 equation and 4746 nonzero elements, so the ia[459]=4746, not 4747. With original ia.txt where ia[459]=4747, when call phase 11 PARDISO, the error arises:

*** Error in PARDISO (incorrect input matrix) error_num= 22

*** Input check: i=4746, ja[i]=-33686019, neqns=458 are incompatible

Check Points 2: PARDISO Solver Phases

Usually, Intel MKL PARDISO solver performs four phases in succession:

-analysis and symbolic factorization (phase=1)
-numerical factorization (phase =2)
-forward and backward substitution including iterative refinement (phase =3)
-termination to release all internal solver memory (phase = -1 or 0)

As PADISO solver is used in iteration often or wrapped by other code, the phase =1 and phase =2 may be missed incorrectly some times. For example, with the test code in U489205, if the phase 1 and phase 2 were missed. The error Error in PARDISO  ( sequence_ido,parameters) error_num= 8 shows up

Solution:

1. Switch on the parameter iparm(27) =1 and check the index of ia and ja as above .

iparm(27) (iparm[26] in C/C++) is the parameter for Matrix checker. When it is 0*, Intel MKL PARDISO does not check the sparse matrix representation for errors. When it is 1, Intel MKL PARDISO checks integer arrays ia and ja. In particular, Intel MKL PARDISO checks whether column indices are sorted in increasing order within each Row.

Intel MKL PARDISO does not check the sparse matrix representation for errors by default. So when first run PARDISO and get crash without reason, one can switch on the option iparm(27) =1  enable PARDISO to check the sparse matrix. And if get the error like Input parameters: inconsistent error, then check the sparse matrix format and PARDISO phase correspondingly.

2. Call mkl_ddnscsr() to converts a sparse matrix in dense storage into a csr format.

For who use external data source, like Jacobian matrix result as input for PARDISO, another way to avoid format error is to use Intel MKL Sparse BLAS function: mkl_[s|d|c|d]dnscsr(). The functions convert a sparse matrix stored as a rectangular m-by-n matrix A (dense representation) to the compressed sparse row (CSR) format (3-array variation) and vice versa. Then feed the csr matrix to PARDISO. Here is the parameter setting and mkl_ddnscsr() function call sample code,

MKL_INT job[8];

job[0] = 0;         //dense matrix adns to the CSR format, otherwise 1

job[1] = 0;         // zero-based indexing of Dense matrix, otherwise 1

job[2] = 0;         // zero-based indexing for the matrix in CSR format, otherwise 1

job[3] = 2;         // adns is a whole matrix A, 0: lower triangular part, 1: upper part

job[4] = nnzMax; // maximum number of the non-zero elements allowed

job[5] = 1;     // arrays acsr, ia, ja are generated, 0: only ia is generated

double *a=(double*)malloc(nnzMax *sizeof(double));

 int *ja=(int*)malloc(nnzMax *sizeof(int));

 int *ia=(int*)malloc((n+1)*sizeof(int));

 // Converts a sparse matrix into a csr format

mkl_ddnscsr (job, &n, &n, adns, &n, a, ja, ia, &info);

Summary: 

PARDISO solver provides very flexible interface for developers to configure the parameters based on their requirements. For example, it provides a 64-dimension array parameter iparm(64), which allows developer to set 1-based or 0-based indexing of sparse matrix, using in-core (IC) or out-of-core (OOC) method etc. The Intel MKL PARDISO solver also provides rich error messages [2] for helping users to identify the problem. The article describes the root cause of the common error like *** Error in PARDISO when call PARDISO* and provide check points guide to solve the problem.

Note: The error num in the *** Error in PARDISO ( sequence_ido,parameters) error_num= 8 is for internal development and debug purpose. It is different with the error number -8:32-bit integer overflow problem in the article of Description of PARDISO errors and messages.

If you're still having trouble and/or you suspect you've found a problem in Intel MKL, you might check the known issues article [Ref1-Ref5] in the Intel MKL knowledgebase first. Another option is to search the Intel MKL forum for other reports of a similar problem or post a question of your own. For more details please refer to the Sparse Solvers Training Material.

Reference:

  1. Tips for using PARDISO
  2. Description of PARDISO errors and messages
  3. PARDISO returns the erroneous results or throws an exception
  4. http://software.intel.com/en-us/articles/pardiso-parameter-table/.
  5. Intel® Math Kernel Library Cookbook => Finding an approximate solution to a stationary nonlinear heat equation https://software.intel.com/en-us/node/507039

Sparse Matrix Storage Format


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>