<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia <<a href="mailto:amfoggia@gmail.com">amfoggia@gmail.com</a>> wrote:<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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello all,</div><div><br></div><div>I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of a matrix with the following characteristics:</div><div><br></div><div>* type: real, Hermitian, sparse<br></div><div>* linear size: <span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">2333606220 <br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">* distributed in 2048 processes (64 nodes, 32 procs per node)</span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">My code first preallocates the necessary memory with *MatMPIAIJSetPreallocation*, then fills it with the values and finally it calls the following functions to create the solver and diagonalize the matrix:</span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">EPSCreate(PETSC_COMM_WORLD, &solver);<br>EPSSetOperators(solver,matrix,NULL);<br>EPSSetProblemType(solver, EPS_HEP);<br>EPSSetType(solver, EPSLANCZOS);<br>EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL);<br>EPSSetFromOptions(solver);</span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">EPSSolve(solver);<br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">I want to make an estimation for larger size problems of the memory used by the program (at every step) because I would like to keep it under 16 GB per node. I've used the "memory usage" functions provided by PETSc, but something happens during the solver stage that I can't explain. This brings up two questions.<br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">1) In each step I put a call to four memory functions and between them I print the value of mem:</span></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Did you call PetscMemorySetGetMaximumUsage() first?</div><div><br></div><div>We are computing <a href="https://en.wikipedia.org/wiki/Resident_set_size">https://en.wikipedia.org/wiki/Resident_set_size</a> however we can. Usually with getrusage().</div><div>From this (<a href="https://www.binarytides.com/linux-command-check-memory-usage/">https://www.binarytides.com/linux-command-check-memory-usage/</a>), it looks like top also reports</div><div>paged out memory.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">mem = 0;</span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">PetscMallocGetCurrentUsage(&mem);<br>PetscMallocGetMaximumUsage(&mem);<br>PetscMemoryGetCurrentUsage(&mem);<br>PetscMemoryGetMaximumUsage(&mem);</span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">I've read some other question in the mailing list regarding the same issue but I can't fully understand this. What is the difference between all of them? What information are they actually giving me? (I know this is only a "per process" output). I copy the output of two steps of the program as an example:</span></span></div><br></div><div>==================== step N ====================<br></div><div dir="ltr">MallocGetCurrent: 314513664.0 B<br>MallocGetMaximum: 332723328.0 B<br>MemoryGetCurrent: 539996160.0 B<br>MemoryGetMaximum: 0.0 B<br></div><div>==================== step N+1 ====================<br></div><div dir="ltr">MallocGetCurrent: 395902912.0 B<br>MallocGetMaximum: 415178624.0 B<br>MemoryGetCurrent: 623783936.0 B<br>MemoryGetMaximum: 623775744.0 B<br><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">2) I was using this information to make the calculation of the memory required per node to run my problem. Also, I'm able to login to the computing node while running and I can check the memory consumption (with *top*). The memory used that I see with top is more or less the same as the one reported by PETSc functions at the beginning. But during the inialization of the solver and during the solving, *top* reports a consumption two times bigger than the one the functions report. Is it possible to know from where this extra memory consumption comes from? What things does SLEPc allocate that need that much memory? I've been trying to do the math but I think there are things I'm missing. I thought that part of it comes from the "BV" that the option -eps_view reports:</span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">BV Object: 2048 MPI processes<br> type: svec<br> 17 columns of global length<span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"> 2333606220</span></span><br> vector orthogonalization method: modified Gram-Schmidt<br> orthogonalization refinement: if needed (eta: 0.7071)<br> block orthogonalization method: GS<br> doing matmult as a single matrix-matrix product<br></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">But "17 *<span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"> 2333606220 * 8 Bytes / #nodes" only explains on third or less of the "extra" memory.<br></span></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos">Ale<br></span></span></span></div><div><span class="gmail-m_457987176403106239gmail-cwcot gmail-m_457987176403106239gmail-gsrt" id="gmail-m_457987176403106239gmail-cwos"><br></span></div></div></div></div></div></div></div></div></div></div>
</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></div></div></div>