On Sun, Sep 6, 2009 at 8:39 PM, xiaoyin ji <span dir="ltr"><<a href="mailto:sapphire.jxy@gmail.com">sapphire.jxy@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I cannot include running options like -ksp_monitor in my program as<br>
it's not a simple petsc code. However, after testing the ksp examples<br>
I've found similar problem.<br>
<br>
Here is the code I'm testing src/ksp/ksp/examples/tutorials/ex2.c<br>
<br>
What I've done is add a loop of 10000 steps between MatCreate and<br>
MatDestory (right before PetscFinalize), and print the time for each<br>
loop. The time will increase exponentially just like my program.<br>
Moreover, if I narrow the loop so that only ksp create and destory are<br>
included, solving time does not change. -ksp_monitor option shows that<br>
ksp loop is running fine, however I cannot use this option with the<br>
time test as print out will change the loop time significantly.<br>
<br>
It seems to me that either MatDestory or VecDestory does not clear<br>
everything well in C++ codes( in Fortran codes they work well).<br>
Besides, instead of directly call petsc functions, I've also created a<br>
class which contains petsc mat and ksp utilities, and create/destroy<br>
the object of this class for each loop. However problem still exists.<br></blockquote><div><br>1) I cannot reproduce this bug. However, the description is not that clear.<br><br>2) The Fortran and C++ interfaces are just wrappers. They do not handle<br>
memory allocation or calculation.<br><br>3) This must be something specific to your computer.<br><br> Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Best,<br>
Xiaoyin Ji<br>
<br>
On Thu, Sep 3, 2009 at 8:34 AM, xiaoyin ji<<a href="mailto:sapphire.jxy@gmail.com">sapphire.jxy@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> Here are the print outs<br>
><br>
> for the very beginning, average time is about 0.8sec for the ksp solver<br>
> KSP Object:<br>
> type: bicg<br>
> maximum iterations=10000, initial guess is zero<br>
> tolerances: relative=1e-07, absolute=1e-50, divergence=10000<br>
> left preconditioning<br>
> PC Object:<br>
> type: bjacobi<br>
> block Jacobi: number of blocks = 16<br>
> Local solve is same for all blocks, in the following KSP and PC objects:<br>
> KSP Object:(sub_)<br>
> type: preonly<br>
> maximum iterations=10000, initial guess is zero<br>
> tolerances: relative=1e-05, absolute=1e-50, divergence=10000<br>
> left preconditioning<br>
> PC Object:(sub_)<br>
> type: ilu<br>
> ILU: 0 levels of fill<br>
> ILU: factor fill ratio allocated 1<br>
> ILU: tolerance for zero pivot 1e-12<br>
> ILU: using diagonal shift to prevent zero pivot<br>
> ILU: using diagonal shift on blocks to prevent zero pivot<br>
> out-of-place factorization<br>
> matrix ordering: natural<br>
> ILU: factor fill ratio needed 1<br>
> Factored matrix follows<br>
> Matrix Object:<br>
> type=seqaij, rows=5672, cols=5672<br>
> package used to perform factorization: petsc<br>
> total: nonzeros=39090, allocated nonzeros=39704<br>
> not using I-node routines<br>
> linear system matrix = precond matrix:<br>
> Matrix Object:<br>
> type=seqaij, rows=5672, cols=5672<br>
> total: nonzeros=39090, allocated nonzeros=39704<br>
> not using I-node routines<br>
> linear system matrix = precond matrix:<br>
> Matrix Object:<br>
> type=mpiaij, rows=90746, cols=90746<br>
> total: nonzeros=636378, allocated nonzeros=1279114<br>
> not using I-node (on process 0) routines<br>
> Norm of error 48.144, Iterations 137<br>
><br>
> After 4000 steps, solver takes 7.5sec<br>
><br>
> KSP Object:<br>
> type: bicg<br>
> maximum iterations=10000, initial guess is zero<br>
> tolerances: relative=1e-07, absolute=1e-50, divergence=10000<br>
> left preconditioning<br>
> PC Object:<br>
> type: bjacobi<br>
> block Jacobi: number of blocks = 16<br>
> Local solve is same for all blocks, in the following KSP and PC objects:<br>
> KSP Object:(sub_)<br>
> type: preonly<br>
> maximum iterations=10000, initial guess is zero<br>
> tolerances: relative=1e-05, absolute=1e-50, divergence=10000<br>
> left preconditioning<br>
> PC Object:(sub_)<br>
> type: ilu<br>
> ILU: 0 levels of fill<br>
> ILU: factor fill ratio allocated 1<br>
> ILU: tolerance for zero pivot 1e-12<br>
> ILU: using diagonal shift to prevent zero pivot<br>
> ILU: using diagonal shift on blocks to prevent zero pivot<br>
> out-of-place factorization<br>
> matrix ordering: natural<br>
> ILU: factor fill ratio needed 1<br>
> Factored matrix follows<br>
> Matrix Object:<br>
> type=seqaij, rows=5672, cols=5672<br>
> package used to perform factorization: petsc<br>
> total: nonzeros=39090, allocated nonzeros=39704<br>
> not using I-node routines<br>
> linear system matrix = precond matrix:<br>
> Matrix Object:<br>
> type=seqaij, rows=5672, cols=5672<br>
> total: nonzeros=39090, allocated nonzeros=39704<br>
> not using I-node routines<br>
> linear system matrix = precond matrix:<br>
> Matrix Object:<br>
> type=mpiaij, rows=90746, cols=90746<br>
> total: nonzeros=636378, allocated nonzeros=1279114<br>
> not using I-node (on process 0) routines<br>
> Norm of error 48.7467, Iterations 132<br>
><br>
><br>
> The iterations are similar, solving time is actually increasing<br>
> exponentially, and the matrix should not be too complicated here as<br>
> the PETSc in Fortran solved this in 1sec.<br>
><br>
> By the way, will there be a way to set a PETSc vector directly into a<br>
> preconditioner for the ksp solver?<br>
><br>
> Thanks!<br>
><br>
> Best,<br>
> Xiaoyin Ji<br>
><br>
> Department of Materials Science and Engineering<br>
> North Carolina State University<br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>