The base PSBLAS library contains the implementation of two simple preconditioning techniques:
Diagonal Scaling
Block Jacobi with ILU(0) factorization
The supporting data type and subroutine interfaces are defined in the module psb_prec_mod. The old interfaces psb_precinit and psb_precbld are still supported for backward compatibility
call prec%init(icontxt,ptype, info)
Type:
Asynchronous.
On Entry
icontxt
the communication context.
Scope:global.
Type:required.
Intent: in.
Specified as: an integer value.
ptype
the type of preconditioner. Scope: global
Type: required
Intent: in.
Specified as: a character string, see usage notes.
On Exit
prec
Scope: local
Type: required
Intent: inout.
Specified as: a preconditioner data structure psb_prec_type.
info
Scope: global
Type: required
Intent: out.
Error code: if no error, 0 is returned.
Notes Legal inputs to this subroutine are interpreted depending on the ptype string as follows4 :
NONE
No preconditioning, i.e. the preconditioner is just a copy operator.
DIAG
Diagonal scaling; each entry of the input vector is multiplied by the reciprocal of the sum of the absolute values of the coefficients in the corresponding row of matrix A;
BJAC
Precondition by a factorization of the block-diagonal of matrix A, where block boundaries are determined by the data allocation boundaries for each process; requires no communication. Only the incomplete factorization ILU(0) is currently implemented.
call prec%build(a, desc_a, info[,amold,vmold,imold])
Type:
Synchronous.
On Entry
a
the system sparse matrix. Scope: local
Type: required
Intent: in, target.
Specified as: a sparse matrix data structure psb_Tspmat_type.
prec
the preconditioner.
Scope: local
Type: required
Intent: inout.
Specified as: an already initialized precondtioner data structure
psb_prec_type
desc_a
the problem communication descriptor. Scope: local
Type: required
Intent: in, target.
Specified as: a communication descriptor data structure psb_desc_type.
amold
The desired dynamic type for the internal matrix storage.
Scope: local.
Type: optional.
Intent: in.
Specified as: an object of a class derived from psb_T_base_sparse_mat.
vmold
The desired dynamic type for the internal vector storage.
Scope: local.
Type: optional.
Intent: in.
Specified as: an object of a class derived from psb_T_base_vect_type.
imold
The desired dynamic type for the internal integer vector storage.
Scope: local.
Type: optional.
Intent: in.
Specified as: an object of a class derived from (integer)
psb_T_base_vect_type.
On Return
prec
the preconditioner.
Scope: local
Type: required
Intent: inout.
Specified as: a precondtioner data structure psb_prec_type
info
Error code.
Scope: local
Type: required
Intent: out.
An integer value; 0 means no error has been detected.
The amold, vmold and imold arguments may be employed to interface with special devices, such as GPUs and other accelerators.
call prec%apply(x,y,desc_a,info,trans,work) call prec%apply(x,desc_a,info,trans)
Type:
Synchronous.
On Entry
prec
the preconditioner. Scope: local
Type: required
Intent: in.
Specified as: a preconditioner data structure psb_prec_type.
x
the source vector. Scope: local
Type: required
Intent: inout.
Specified as: a rank one array or an object of type psb_T_vect_type.
desc_a
the problem communication descriptor. Scope: local
Type: required
Intent: in.
Specified as: a communication data structure psb_desc_type.
trans
Scope:
Type: optional
Intent: in.
Specified as: a character.
work
an optional work space Scope: local
Type: optional
Intent: inout.
Specified as: a double precision array.
On Return
y
the destination vector. Scope: local
Type: required
Intent: inout.
Specified as: a rank one array or an object of type psb_T_vect_type.
info
Error code.
Scope: local
Type: required
Intent: out.
An integer value; 0 means no error has been detected.
call prec%descr(info) call prec%descr(info,iout, root)
Type:
Asynchronous.
On Entry
prec
the preconditioner. Scope: local
Type: required
Intent: in.
Specified as: a preconditioner data structure psb_prec_type.
iout
output unit. Scope: local
Type: optional
Intent: in.
Specified as: an integer number. Default: default output unit.
root
Process from which to print Scope: local
Type: optional
Intent: in.
Specified as: an integer number between 0 and np - 1, in which case
the specified process will print the description, or -1, in which case all
processes will print. Default: 0.
On Return
info
Error code.
Scope: local
Type: required
Intent: out.
An integer value; 0 means no error has been detected.
call prec%clone(precout,info)
Type:
Asynchronous.
On Entry
prec
the preconditioner.
Scope: local.
On Return
precout
A copy of the input object.
info
Return code.
call prec%free(info)
Type:
Asynchronous.
On Entry
prec
the preconditioner.
Scope: local.
Type: required
Intent: inout.
Specified as: a preconditioner data structure psb_prec_type.
On Exit
prec
Scope: local
Type: required
Intent: inout.
Specified as: a preconditioner data structure psb_prec_type.
info
Scope: global
Type: required
Intent: out.
Error code: if no error, 0 is returned.
Notes Releases all internal storage.