Fixed docs for new smoothers/solvers, updated Makefile

This commit is contained in:
Salvatore Filippone
2017-07-19 22:06:32 +01:00
parent 50ec525f48
commit ae8ac64d24
33 changed files with 3435 additions and 3088 deletions
+130 -26
View File
@@ -7,8 +7,8 @@ original version by: Nikos Drakos, CBLU, University of Leeds
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Error Handling</TITLE>
<META NAME="description" CONTENT="Error Handling">
<TITLE>Adding new smoother and solver objects to MLD2P4</TITLE>
<META NAME="description" CONTENT="Adding new smoother and solver objects to MLD2P4">
<META NAME="keywords" CONTENT="userhtml">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
@@ -26,53 +26,157 @@ original version by: Nikos Drakos, CBLU, University of Leeds
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html367"
<A NAME="tex2html369"
HREF="node25.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html363"
<A NAME="tex2html365"
HREF="userhtml.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html357"
<A NAME="tex2html359"
HREF="node23.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html365"
<A NAME="tex2html367"
HREF="node2.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html368"
HREF="node25.html">License</A>
<B> Up:</B> <A NAME="tex2html364"
<B> Next:</B> <A NAME="tex2html370"
HREF="node25.html">Error Handling</A>
<B> Up:</B> <A NAME="tex2html366"
HREF="userhtml.html">userhtml</A>
<B> Previous:</B> <A NAME="tex2html358"
<B> Previous:</B> <A NAME="tex2html360"
HREF="node23.html">Subroutine descr</A>
&nbsp; <B> <A NAME="tex2html366"
&nbsp; <B> <A NAME="tex2html368"
HREF="node2.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00090000000000000000"></A><A NAME="sec:errors"></A>
<H1><A NAME="SECTION00090000000000000000"></A><A NAME="sec:adding"></A>
<BR>
Error Handling
Adding new smoother and solver objects to MLD2P4
</H1>
<P>
The error handling in MLD2P4 is based on the PSBLAS (version 2) error
handling. Error conditions are signaled via an integer argument
<code>info</code>; whenever an error condition is detected, an error trace
stack is built by the library up to the top-level, user-callable
routine. This routine will then decide, according to the user
preferences, whether the error should be handled by terminating the
program or by returning the error condition to the user code, which
will then take action, and whether
an error message should be printed. These options may be set by using
the PSBLAS error handling routines; for further details see the PSBLAS
User's Guide [<A
HREF="node26.html#PSBLASGUIDE">13</A>].
Developers can add completely new smoother and/or solver classes
derived from the base objects in the library (see Remark&nbsp;2 in Section&nbsp;<A HREF="node17.html#sec:precset">6.2</A>),
without recompiling the library itself.
<P>
To do so, it is necessary first to select the base type to be extended.
In our experience, it is quite likely that the new application needs
only the definition of a ``solver'' object, which is almost
always acting only on the local part of the distributed matrix.
The parallel actions required to connect the various solver objects
are most often already provided by the block-Jacobi or the additive
Schwarz smoothers. To define a new solver, the developer will then
have to define its components and methods, perhaps taking one of the
predefined solvers as a starting point, if possible.
<BR><HR>
<P>
Once the new smoother/solver class has been developed, to use it in
the context of the multilevel preconditioners it is necessary to:
<UL>
<LI>declare in the application program a variable of the new type;
</LI>
<LI>pass that variable as the argument to the <code>set</code> routine as in the
following:
<DIV ALIGN="CENTER">
<code>call p%set(smoother,info [,ilev,ilmax,pos])</code>
<BR><code>call p%set(solver,info [,ilev,ilmax,pos])</code>
</DIV>
</LI>
<LI>link the code implementing the various methods into the application executable.
</LI>
</UL>
The new solver object is then dynamically included in the
preconditioner structure, and acts as a <I>mold</I> to which the
preconditioner will conform, even though the MLD2P4 library has not
been modified to account for this new development.
<P>
It is possible to define new values for the keyword <code>WHAT</code> in the
<code>set</code> routine; if the library code does not recognize a keyword,
it passes it down the composition hierarchy (levels containing
smoothers containing in turn solvers), so that it can be eventually caught by
the new solver.
<P>
An example is provided in the source code distribution under the
folder <code>tests/newslv</code>. In this example we are implementing a new
incomplete factorization variant (which is simply the ILU(0)
factorization under a new name). Because of the specifics of this case, it is
possible to reuse the basic structure of the ILU solver, with its
L/D/U components and the methods needed to apply the solver; only a
few methods, such as the description and most importantly the build,
need to be ovverridden (rewritten).
<P>
The interfaces for the calls shown above are defined using
<DIV ALIGN="CENTER">
<TABLE CELLPADDING=3>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=40><code>smoother</code></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=340><code>class(mld_x_base_smoother_type)</code></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=40>&nbsp;</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=340>The user-defined new smoother to be employed in the
preconditioner.</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=40><code>solver</code></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=340><code>class(mld_x_base_solver_type)</code></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=40>&nbsp;</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=340>The user-defined new solver to be employed in the
preconditioner.</TD>
</TR>
</TABLE>
</DIV>
The other arguments are defined in the way described in
Sec.&nbsp;<A HREF="node17.html#sec:precset">6.2</A>. As an example, in the <code>tests/newslv</code>
code we define a new object of type <code>mld_d_tlu_solver_type</code>, and
we pass it as follows:
<PRE>
! sparse matrix and preconditioner
type(psb_dspmat_type) :: a
type(mld_dprec_type) :: prec
type(mld_d_tlu_solver_type) :: tlusv
......
!
! prepare the preconditioner: an ML with defaults, but with TLU solver at
! intermediate levels. All other parameters are at default values.
!
call prec%init('ML', info)
call prec%hierarchy_build(a,desc_a,info)
nlv = prec%get_nlevs()
call prec%set(tlusv, info,ilev=1,ilmax=max(1,nlv-1))
call prec%smoothers_build(a,desc_a,info)
</PRE>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html369"
HREF="node25.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html365"
HREF="userhtml.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html359"
HREF="node23.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html367"
HREF="node2.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html370"
HREF="node25.html">Error Handling</A>
<B> Up:</B> <A NAME="tex2html366"
HREF="userhtml.html">userhtml</A>
<B> Previous:</B> <A NAME="tex2html360"
HREF="node23.html">Subroutine descr</A>
&nbsp; <B> <A NAME="tex2html368"
HREF="node2.html">Contents</A></B>
<!--End of Navigation Panel-->
</BODY>
</HTML>