Are you destroying the matrix created by MatMatMult()? From the webpage:<br>
<h3><font color="#cc3333">Notes</font></h3>
C will be created and must be destroyed by the user with <a href="http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatDestroy.html#MatDestroy">MatDestroy</a>().
Unless scall is MAT_REUSE_MATRIX
<p><br>
Thanks,<br>
</p>
<p> Matt<br>
</p>
<br><div><span class="gmail_quote">On 5/9/06, <b class="gmail_sendername">Jordi Marcé Nogué</b> <<a href="mailto:jordi.marce@upc.edu">jordi.marce@upc.edu</a>> wrote:</span><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 find my problem with the memory. Using PetscTrDump(PETSC_NULL) I've<br>cornered it and I've find the lines which generate it.<br><br>I've discovered that the functions like MatTranspose(), MatMatMult() or<br>
similar functions creates extra memory in my code and these don't destroy.<br><br>I explain:<br><br>I create my matrices ----->>>> 3000 b are created (for example)<br>I use MatMatMult --------->>>> 2000 bytes are created (for example)
<br>I destroy my matrices ---->>>> 3000 b are destroyed.<br><br>How can I free the memory created in the function MaMatMult()?<br><br>The final result is that if I use this function in a iterative process I<br>
full the memory of the box. If I multiply the matrix in a own function,<br>I don't have this problem.<br><br><br>best regards,<br>jordi<br><br><br><br><br>En/na Satish Balay ha escrit:<br>> If you don't get any output with -trdump - it could mean that all
<br>> objects are getting properly destroyed. But the swap usage is a bit<br>> unusual.<br>><br>> You could try the option -trmalloc_log to see how memory is allocate<br>> on the PETSc side. And also -log_summary to see the summary of memory
<br>> usage.<br>><br>> Also - is it possible you have malloc() calls in your side of the code<br>> - that could be leaking memory?<br>><br>> you could also comment out all MatSetOption() calls and see if it
<br>> makes a difference.<br>><br>> BTW: 2.2.0 is a very old version. You might want to upgrade to the<br>> latest 2.3.1<br>><br>> Satish<br>><br>> On Mon, 8 May 2006, Jordi Marcé Nogué wrote:<br>>
<br>><br>>>Thanks Barry,<br>>><br>>>I'm using petsc 2.2.0. When I run my program ( " ./myprogram -trdump " or with<br>>>-trmalloc, -trinfo...) I don't obtain anything... in the screen the code doesn't
<br>>>print<br>>>anything.<br>>><br>>>If I use (for example) "./myprogram -start_on_debugger", in my screen apers gdb<br>>><br>>>and runs good... and with another options like -log_trace petsc writes messages
<br>>>in<br>>>my screen. Would I have to activate something in my internal petsc code?<br>>><br>>>best regards,<br>>>jordi<br>>><br>>><br>>><br>>><br>>><br>>>
<br>>>Missatge citat per Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>>:<br>>><br>>><br>>>><br>>>> See<br>>>><br>>><br>>><a href="http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html">
http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html</a><br>>><br>>>>number 12<br>>>><br>>>> You can run for say a few iterations with the options<br>>>>-malloc_debug -malloc_dump (in PETSc
2.3.1. in early releases it had<br>>>>different names). At PetscFinalize() PETSc will print all the memory<br>>>>it has allocated that has not been freed and where it was allocated.<br>>>>This can help determine what objects are not being freed.
<br>>>><br>>>> Barry<br>>>><br>>>><br>>>>>Hi,<br>>>>><br>>>>>I use PETSc, and after 5000 (more or less) iteations in which i solve a<br>>>>
<br>>>>little<br>>>><br>>>>>matrix<br>>>>>(30x30) my swap is totally used!!! I'm sure that when I create my matrices<br>>>><br>>>>I<br>>>><br>>>>>destroy
<br>>>>>them. Could you help me about it? What happens? What thing I do bad?<br>>>>><br>>>>>Mat K<br>>>>>MatCreateSeqAIJ(PETSC_COMM_SELF, dim, dim, 9 , PETSC_NULL, &K);<br>
>>>>MatSetFromOptions(K);<br>>>>>MatSetOption(K, MAT_SYMMETRIC);<br>>>>>MatSetOption(K, MAT_ROW_ORIENTED);<br>>>>>MatSetOption(K, MAT_IGNORE_ZERO_ENTRIES);<br>>>>>MatSetOption(K, MAT_NEW_NONZERO_ALLOCATION_ERR);
<br>>>>><br>>>>>( I use KSP solve, created and destroyed)<br>>>>><br>>>>>MatDestroy(K);<br>>>>><br>>>>><br>>>>>Thanks,<br>>>>>jordi
<br>>>>>-----------<br>>>>>Jordi Marcé-Nogué<br>>>>>Dept. Resistència de Materials i Estructures a l'Enginyeria<br>>>>>Universitat Politècnica de Catalunya (UPC)<br>>>>>
<br>>>>>Edifici T45 - despatx 137<br>>>>>ETSEIAT (Terrassa)<br>>>>><br>>>>>phone: +34 937 398 728<br>>>>>mail: <a href="mailto:jordi.marce@upc.edu">jordi.marce@upc.edu
</a><br>>>>><br>>>>><br>>>>><br>>><br>>><br>>><br>>><br>>><br><br><br>--<br>Jordi Marcé-Nogué<br>Dept. Resistència de Materials i Estructures a l'Enginyeria
<br>Universitat Politècnica de Catalunya (UPC)<br><br>Edifici T45 - despatx 137<br>ETSEIAT (Terrassa)<br><br>phone: +34 937 398 728<br>mail: <a href="mailto:jordi.marce@upc.edu">jordi.marce@upc.edu</a><br><br></blockquote>
</div><br><br clear="all"><br>-- <br>"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness