The code reported in Figure 2 shows how to set and apply the default
multi-level preconditioner available in the real double precision version
of MLD2P4 (see Table 1). This preconditioner is chosen
by simply specifying 'ML'
as second argument of P%init
(a call to P%set
is not needed) and is applied with the CG
solver provided by PSBLAS (the matrix of the system to be solved is
assumed to be positive definite). As previously observed, the modules
psb_base_mod
, mld_prec_mod
and psb_krylov_mod
must be used by the example program.
The part of the code concerning the
reading and assembling of the sparse matrix and the right-hand side vector, performed
through the PSBLAS routines for sparse matrix and vector management, is not reported
here for brevity; the statements concerning the deallocation of the PSBLAS
data structure are neglected too.
The complete code can be found in the example program file mld_dexample_ml.f90
,
in the directory examples/fileread
of the MLD2P4 implementation (see
Section 3.5). A sample test problem along with the relevant
input data is available in examples/fileread/runs
.
For details on the use of the PSBLAS routines, see the PSBLAS User's
Guide [16].
The setup and application of the default multi-level preconditioner
for the real single precision and the complex, single and double
precision, versions are obtained with straightforward modifications of the previous
example (see Section 6 for details). If these versions are installed,
the corresponding codes are available in examples/fileread/
.
|
Different versions of the multi-level preconditioner can be obtained by changing
the default values of the preconditioner parameters. The code reported in
Figure 3 shows how to set a V-cycle preconditioner
which applies 1 block-Jacobi sweep as pre- and post-smoother,
and solves the coarsest-level system with 8 block-Jacobi sweeps.
Note that the ILU(0) factorization (plus triangular solve) is used as
local solver for the block-Jacobi sweeps, since this is the default associated
with block-Jacobi and set by P%init
.
Furthermore, specifying block-Jacobi as coarsest-level
solver implies that the coarsest-level matrix is distributed
among the processes.
Figure 4 shows how to set a W-cycle preconditioner which
applies no pre-smoother and 2 Gauss-Seidel sweeps as post-smoother,
and solves the coarsest-level system with the multifrontal LU factorization
implemented in MUMPS. It is specified that the coarsest-level
matrix is distributed, since MUMPS can be used on both
replicated and distributed matrices, and by default
it is used on replicated ones. Note the use of the parameter pos
to specify a property only for the pre-smoother or the post-smoother
(see Section 6.2 for more details).
Note also that a Krylov method different from CG must be used to solve
the preconditioned system, since the preconditione in nonsymmetric.
The code fragments shown in Figures 3 and 4 are
included in the example program file mld_dexample_ml.f90
too.
Finally, Figure 5 shows the setup of a one-level
additive Schwarz preconditioner, i.e., RAS with overlap 2. The
corresponding example program is available in the file
mld_dexample_1lev.f90
.
For all the previous preconditioners, example programs where the sparse matrix and
the right-hand side are generated by discretizing a PDE with Dirichlet
boundary conditions are also available in the directory examples/pdegen
.
|
|
|