Solve the Matrix stored in mtx format
The code for this example is located in Examples/MatSolve
Brief
This example solves the linear system using different solvers.
Description
This example may run in both serial and parallel modes with NP
processes.
The code loads the matrix and right-hand side from files. If right-hand side is omitted, the artificial rhs=(1,1,...,1) is used. The specific solver is defined by user. User may also provide options file to alter default solver options.
Arguments
Usage: ./MatSolve -m "matrix.mtx" [arguments]
- Available arguments
- Required
- -m, --matrix, specifies path to the matrix file, e.g. "/tmp/A.mtx"
- Optional
- -b, --bvector, specifies path to the rhs file, e.g. "/tmp/b.rhs"
- -x, --xvector, specifies path to the solution
- -p, --parameters, specifies path to the database file, see
Examples/MatSolve/database.xml
as example; - -t, --type, specifies solver type, "inner_ilu2" by default
- -h, --help, prints help message
- Required
Running example
FVDiscr/tmp/A.mtx
and right-hand side /tmp/b.rhs
FVDiscr example
$ cd Examples/MatSolve
$ mpirun -np 4 ./MatSolve -m /tmp/A.mtx -b /tmp/b.rhs
load matrix: 0.346156
load vector: 0.0542159
preconditioner: 0.516358
solver: 0.0345631.37095e-06 | 0
||Ax-b|| 1.37095e-06 ||b|| 2.14884 ||Ax-b||/||b|| 6.37997e-07
norms: 0.00276518
4 processors solved in 0.95183 secs with 4 iterations to 1.37095e-06 norm matrix "/tmp/A.mtx" vector "/tmp/b.rhs" true residual ||Ax-b||/||b|| 6.37997e-07
reason: converged due to relative tolerance