<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 1.9.129  (Linux)"><meta name="CREATED" content="20070412;15593800"><meta name="CHANGED" content="20070412;18341100">

        
        
        
        
        <style>
        &lt;!--
                @page { size: 8.5in 11in; margin: 0.79in }
                P { margin-bottom: 0.08in }
        --&gt;
        </style>

<p style="margin-bottom: 0in;">Dear all,</p>


<p style="margin-bottom: 0in;">I think that the GMRES ILU(p)
preconditioner in my program is consuming too much memory. I just
would like to check if it is correct or not and compare this
experience with other PETSc users.<br>
For a quite small sparse matrix
(dimension = 3500 and 2.5 Mb) the memory consumed while the
preconditioner is created is more or less:</p>

<p style="margin-bottom: 0in;">ILU&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
level approximate increase of
memory waste (Mb) </p>





<p style="margin-bottom: 0in;">4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
9<br>
8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
26<br>
12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
43<br>
16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
53<br>
20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
68<br>
</p>


<p style="margin-bottom: 0in;">Moreover a fast convergence is reached
suddenly (i.e. for ILU level 25 convergence is not reached after 3000
iterations but for ILU level 30 the convergence is reached in 7
iterations).<br>
I suppose that some of the problems are
caused by the large condition number of the matrix but in any case I
guess that the memory used by the preconditioner is too large.<br>
I have tried to improve the performance
using:<font size="3">  PCFactorSetFill, PCFa</font>ctorSetAllowDiagonalFill
and  PCFactorSetUseDropTolerance but I have not succeed. 
</p>
<p style="margin-bottom: 0in;"> 
</p>
<p style="margin-bottom: 0in;">I would also like to know how to
estimate a priori  the memory required for a PETSc sparse matrix if
the non null entries are known. Is the following rule: 1
double/complex&lt;double&gt; and 2 integers per non null coefficient,
a good approximation (taking into account PETSc implementation)? Is
the same rule valid for the case of the preconditioner?</p>



<p style="margin-bottom: 0in;">I will give some details on the
particular situation being solved:<br>
------------------------------------------------------------------------------------------------------------</p>
<p style="margin-bottom: 0in;">Type of matrix: FEM resolution of an
structural dynamic problem</p>

<p style="margin-bottom: 0in;">(K + w*w*M) | L^T</p>
<p style="margin-bottom: 0in;">------------------------- = System
matrix 
</p>
<p style="margin-bottom: 0in;">L &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;                      | 0</p>
<p style="margin-bottom: 0in;"><br>
</p>




<p style="margin-bottom: 0in;">K == stiffness matrix (square banded)<br>
M == consistent mass matrix (square
banded, and same nonzero pattern than K)<br>
w == pulsation of the problem (scalar)<br>
L == Lagrange multipliers matrix
(rectangular sparse)<br>
</p>
<p style="margin-bottom: 0in;">The matrix is in general ill
conditioned and non positive definite. 
</p>
<p style="margin-bottom: 0in;">
------------------------------------------------------------------------------------------------------------</p>
<p style="margin-bottom: 0in;"> 
</p>
<p style="margin-bottom: 0in;">And my use of PETSc functions is as
follows:</p>


<p style="margin-bottom: 0in;">  <font style="font-size: 8pt;" size="1">        ierr
= KSPCreate(PETSC_COMM_WORLD,&amp;MyKsp);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">ierr
= KSPSetType(MyKsp, KSPGMRES);CHKERRQ(ierr);</font></p>

<p style="margin-bottom: 0in;">  <font style="font-size: 8pt;" size="1">        ierr
= KSPSetOperators(MyKsp,MyMat,MyMat,DIFFERENT_NONZERO_PATTERN);
CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">    <font style="font-size: 8pt;" size="1">        ierr
= KSPGetPC(MyKsp,&amp;(MyPc));CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;">  <font style="font-size: 8pt;" size="1">        </font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        </font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
= PCSetType(MyPc,PCILU);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
= PCFactorSetLevels(MyPc, LevelNumber);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        PetscReal
   realshift = 1.0;</font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
= PCFactorSetShiftNonzero(MyPc, realshift); CHKERRQ(ierr); //With and
without this line</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
=
KSPSetTolerances(MyKsp,tol,PETSC_DEFAULT,PETSC_DEFAULT,itmax);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
= KSPSetInitialGuessNonzero(MyKsp,PETSC_TRUE);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><font style="font-size: 8pt;" size="1">        ierr
= KSPGMRESSetRestart(MyKsp, max_steps_restart); CHKERRQ(ierr); //With
and without this line</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">  <font style="font-size: 8pt;" size="1">        ierr
= KSPSetFromOptions(MyKsp);CHKERRQ(ierr);</font></p>
<p style="margin-bottom: 0in;"> 
</p>
<p style="margin-bottom: 0in;">  <font style="font-size: 8pt;" size="1">        ierr
= KSPSolve(MyKsp,MyVector,x);CHKERRQ(ierr); </font>
</p>-----------------------------------------------------------------------------------------------------------


<p style="margin-bottom: 0in;">Thank you very much in advance,</p>

<p style="margin-bottom: 0in;"><br>
Jordi Poblet Puig</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><br>
</p>