C H A P T E R 13 |
Sparse Linear System Solvers |
Sun S3L provides support for solving sparse linear systems of the type A*x = B. The discussion of these routines is organized into the following sections:
S3L_sparse_solve solves a linear system of equations A*x = y, where A is a sparse Sun S3L array and A and y are both single- or double-precision real parallel arrays.
When calling S3L_sparse_solve to solve a new (unfactored) sparse linear system, specify S3L_FULL_FACTOR_SOLVE as the first element of the option argument vector. This will cause S3L_sparse_solve to reduce fill by reordering the array and to perform symbolic and numeric factoring before solving the system. It will also return a setup value that identifies the internal setup created by the factoring process.
If the same linear system is to be solved again, but with a different right-hand side, specify S3L_SOLVE_ONLY as the first element of the option argument. Also specify the setup value returned by the S3L_sparse_solve call that factored the sparse array. The new solution will make use of the internal setup created by the earlier S3L_sparse_solve call.
If a previously factored sparse array contains new values, but the sparsity pattern has not changed, it can be solved without specifying S3L_FULL_FACTOR_SOLVE. Instead, specify S3L_SAME_SPARSITY_SOLVE and the previously returned setup value. This causes S3L_sparse_solve to perform numeric factorization on the sparse array and then solve the linear system.
When the internal setup for a linear system is no longer needed, the resources associated with it can be freed by calling S3L_sparse_solve_free and specifying the applicable setup value.
Note - The S+ message-passing direct sparse solver was developed by Kai Shen and Tao Yang of the University of California at Santa Barbara. S+ can be used for general (asymmetric) sparse matrices. |
The Sun Performance Library direct solver solves a sparse linear system on a single process.
S3L_sparse_solve has the following argument syntax:
S3L_sparse_solve(A, y, options, roptions, setup, ier) |
A is a Sun S3L array handle that describes a parallel, single- or double-precision, real sparse array.
y is a Sun S3L array handle that describes a parallel real array of rank 1 (a vector) or rank 2 (a matrix), which contains the right-hand side of the linear system A*x = y. On exit, y is overwritten with the solution of the system.
options is an array of rank 1 whose elements control S3L_sparse_solve behavior in the following ways:
If options[1] = S3L_PERFLIB_SOLVER, specify the following options as well:
roptions is not currently used. It may be used in the future for specifying such parameters as a drop tolerance for pivoting, a threshold value for determining when a block is considered dense, and an amalgamation constant.
setup is an integer that is returned by S3L_sparse_solve upon completion. It describes the sparse linear solution resulting from this call.
If the call is made from a Fortran program, error status will be in ier.
For detailed descriptions of the Fortran and C bindings for this routine, see the S3L_sparse_solve(3) man page or the corresponding description in the Sun S3L Software Reference Manual.
Examples showing S3L_sparse_solve in use can be found in:
/opt/SUNWhpc/examples/s3l/spsolve/ex_sparse_solve1.c /opt/SUNWhpc/examples/s3l/spsolve-f/ex_sp_solve1.f |
S3L_gen_iter_solve solves a linear system of equations of the form A*x = y, where A is a sparse Sun S3L array and x and y are both single- or double-precision dense parallel arrays.
Given a general, square sparse matrix A and a right-hand side vector b, S3L_gen_iter_solve solves the linear system of equations Ax = b, using an iterative algorithm, with or without preconditioning.
The first three arguments to S3L_gen_iter_solve are Sun S3L internal array handles that describe the global general sparse matrix A, the rank 1 global array b, and the rank 1 global array x.
The sparse matrix A is produced by a prior call to one of the following sparse routines:
The global rank 1 arrays, b and x, have the same data type and precision as the sparse matrix A, and both have a length equal to the order of A.
Two local rank 1 arrays, iparm (integer array) and rparm (real array), provide user control over various aspects of S3L_gen_iter_solve behavior, including:
The options supported by the iparm and rparm arguments are described in the following subsections.
S3L_gen_iter_solve attempts to solve Ax = b using one of the following iterative solution algorithms. The choice of algorithm is determined by the value supplied for the parameter iparm[S3L_iter_solver]. The various options available for this parameter are listed and described in TABLE 13-1.
S3L_gen_iter_solve implements left preconditioning. That is, preconditioning is applied to the linear system Ax = b by:
Q-1 A = Q-1 b |
where Q is the preconditioner and Q-1 denotes the inverse of Q. The supported preconditioners are listed in TABLE 13-2.
The iparm[S3L_iter_conv] parameter selects the criterion to be used for stopping computation. Currently, the single valid option for this parameter is S3L_r0, which selects the default criterion for both convergence and divergence. The convergence criterion is satisfied when:
err = ||rj||_2 / ||r0||_2 < epsilon
and the divergence criterion is met when:
err = ||rj||_2 / ||r0||_2 > 10000.0
The parameter iparm[S3L_iter_init] determines the contents of the initial guess to the solution of the linear system as follows:
On input, the iparm[S3L_iter_maxiter] parameter specifies the maximum number of iterations to be taken by the solver. Set to 0 to select the default, which is 10000.
On output, iparm[S3L_iter_maxiter] contains the total number of iterations taken by the solver at the time of termination.
If the restarted GMRES algorithm is selected, iparm[S3L_iter_kspace] specifies the size of the Krylov subspace to be used. The default is 30.
On input, rparm[S3L_iter_tol] specifies the tolerance values to be used by the stopping criterion. Its default is 10-8.
On output, rparm[S3L_iter_tol] contains the computed error, err, according to the convergence criteria. See the iparm[S3L_iter_conv] description for details.
If the Richardson method is selected, rparm[S3L_rich_scale] specifies the scaling factor to be used. The default value is 1.0.
S3L_gen_iter_solve terminates the iteration when one of the following conditions is met:
S3L_gen_iter_solve has the following argument syntax:
S3L_gen_iter_solve(A, b, x, iparm, rparm, ier) |
A is a Sun S3L array handle that describes a global general sparse matrix.
b is a Sun S3L array handle that describes a global array of rank 1. It has the same data type and precision as A. b contains the right-hand side vector of the linear problem.
x is a Sun S3L array handle that describes a global array of rank 1. It has the same data type and precision as A and b. At the start, x contains the initial guess for the solution to the linear system. Upon exit, x contains the converged solution. If the computation breaks down or diverges, x will contain the results of the most recent iteration.
iparm is an integer local array of rank 1 and length s3l_iter_iparm_size. At the start, iparm options have the following uses:
Upon exit, iparm contains the total number of iterations taken by the solver at the time of termination.
rparm is a real local array with the same precision as x and a length equal to S3L_iter_rparm_size. At the start, it provides the following options:
Upon exit, rparm contains the value of err, according to the stopping criterion, as computed for the last iteration.
If the call is made from a Fortran program, error status will be in ier.
For detailed descriptions of the Fortran and C bindings for this routine, see the S3L_gen_iter_solve(3) man page or the corresponding description in the Sun S3L Software Reference Manual.
Examples showing S3L_gen_iter_solve in use can be found in:
/opt/SUNWhpc/examples/s3l/iter/ex_iter.c /opt/SUNWhpc/examples/s3l/iter-f/ex_iter.f |
S3L_sparse_solve_free frees all internal data associated with the solution of a sparse linear system.
S3L_sparse_solve_free has the following argument syntax:
S3L_sparse_solve_free(setup, ier) |
setup is an integer associated with a particular sparse linear solution. It was previously returned by the S3L_sparse_solve call that produced the solution.
If the call is made from a Fortran program, error status will be in ier.
For detailed descriptions of the Fortran and C bindings for this routine, see the S3L_sparse_solve_free(3) man page or the corresponding description in the Sun S3L Software Reference Manual.
Examples showing S3L_sparse_solve_free in use can be found in:
Copyright © 2003, Sun Microsystems, Inc. All rights reserved.