<div dir="ltr"><div dir="ltr">On Mon, Feb 3, 2020 at 10:38 AM Дмитрий Мельничук <<a href="mailto:dmitry.melnichuk@geosteertech.com">dmitry.melnichuk@geosteertech.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hello all!<br><br>Now I am faced with a problem associated with the memory allocation when calling of KSPSolve .<br><br>GMRES preconditioned by ASM for solving linear algebra system (obtained by the finite element spatial discretisation of Biot poroelasticity model) was chosen.<br>According to the output value of PetscMallocGetCurrentUsage subroutine 176 MB for matrix and RHS vector storage is required (before KSPSolve calling).</div><div>But during solving linear algebra system 543 MB of RAM is required (during KSPSolve calling).<br>Thus, the amount of allocated memory after preconditioning stage increased three times. This kind of behaviour is critically for 3D models with several millions of cells.  <br></div></blockquote><div><br></div><div>1) In order to know anything, we have to see the output of -ksp_view, although I see you used an overlap of 2</div><div><br></div><div>2) The overlap increases the size of submatrices beyond that of the original matrix. Suppose that you used LU for the sub-preconditioner.</div><div>    You would need at least 2x memory (with ILU(0)) since the matrix dominates memory usage. Moreover, you have overlap</div><div>    and you might have fill-in depending on the solver.</div><div><br></div><div>3) The massif tool from valgrind is a good fine-grained way to look at memory allocation</div><div> </div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Is there a way to decrease amout of allocated memory?<br>Is that an expected behaviour for GMRES-ASM combination?<br><br>As I remember, using previous version of PETSc didn't demonstrate so significante memory increasing.  <br><br>...</div><div><div>Vec :: Vec_F, Vec_U</div><div>Mat :: Mat_K<br>...<br>...</div><div>call MatAssemblyBegin(Mat_M,Mat_Final_Assembly,ierr)</div><div>call MatAssemblyEnd(Mat_M,Mat_Final_Assembly,ierr)</div><div>....</div><div>call VecAssemblyBegin(Vec_F_mod,ierr)</div><div>call VecAssemblyEnd(Vec_F_mod,ierr)<br>...<br>...</div></div><div>call PetscMallocGetCurrentUsage(mem, ierr)</div><div>print *,"Memory used: ",mem<br>...</div><div>...</div><div><div>call KSPSetType(Krylov,KSPGMRES,ierr)</div><div>call KSPGetPC(Krylov,PreCon,ierr)</div><div>call PCSetType(PreCon,PCASM,ierr)</div><div>call KSPSetFromOptions(Krylov,ierr)</div>...</div><div>call KSPSolve(Krylov,Vec_F,Vec_U,ierr)<br>...</div><div>...<br>options = "-pc_asm_overlap 2 -pc_asm_type basic -ksp_monitor -ksp_converged_reason"</div><div> <div> <div><span style="background-color:rgb(255,255,255);color:rgb(0,0,0);float:none;font-family:arial,sans-serif;font-size:15px;font-style:normal;font-weight:400;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Kind regards,</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:15px;font-style:normal;font-weight:400;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="background-color:rgb(255,255,255);color:rgb(0,0,0);float:none;font-family:arial,sans-serif;font-size:15px;font-style:normal;font-weight:400;text-decoration-style:initial;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Dmitry Melnichuk</span></div></div></div><a rel="noopener noreferrer" href="https://yadi.sk/d/YCCJRsUVmFK9XA" target="_blank">Matrix.dat (265288024)</a><br></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>