<div dir="ltr"><div><div>Dear PETSc team,<br><br></div><div>I am working on optimization of Chombo-Crunch CFD code for next-generation supercomputer architectures at NERSC (Berkeley Lab) and we use PETSc AMG solver. During memory analysis study I faced with a difficulty to get memory usage data from PETSc for all MPI ranks. I am looking for memory dump function to get a detailed information on memory usage (not only resident size and virtual memory but allso allocation by Vec, Mat, etc). There is PetscMallocDumpLog() function but it is a collective function and it always provides a log for 0 rank. I am wondering if it is possible to include in PETSc a modification of PetscMallocDumpLog() which dumps the similar log but for all MPI ranks.<br><br></div><div>I am attaching an example of my own memory function which uses PETSc non-collective functions and it provides a resident set size and virtual memory for all ranks. Perhaps in a similar way it is possible to modify PetscMallocDumpLog.<br><br></div><div>Thank you,<br></div><div><br clear="all">void petscMemoryLog(const char prefix[])<br>{<br> FILE* fd;<br> char fname[PETSC_MAX_PATH_LEN];<br> PetscMPIInt rank;<br><br> MPI_Comm_rank(Chombo_MPI::comm,&rank);<br><br> PetscLogDouble allocated;<br> PetscLogDouble resident;<br> PetscMallocGetCurrentUsage(&allocated);<br> PetscMemoryGetCurrentUsage(&resident);<br> PetscSNPrintf(fname,sizeof(fname),"%s.%d",prefix,rank);<br> PetscFOpen(PETSC_COMM_SELF,fname,"a",&fd);<br><br> PetscFPrintf(PETSC_COMM_SELF,fd,"### PETSc memory footprint for rank %d \n",rank);<br> PetscFPrintf(PETSC_COMM_SELF,fd,"[%d] Memory allocated by PetscMalloc() %.0f bytes\n",rank,allocated);<br> PetscFPrintf(PETSC_COMM_SELF,fd,"[%d] RSS usage by entire process %.0f KB\n",rank,resident);<br> PetscFClose(PETSC_COMM_SELF,fd);<br>}<br></div><br></div>Best regards,<br><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Andrey Ovsyannikov, Ph.D.</div>Postdoctoral Fellow<br><div>NERSC Division</div><div>Lawrence Berkeley National Laboratory</div><div>510-486-7880</div><div><a href="mailto:aovsyannikov@lbl.gov" target="_blank">aovsyannikov@lbl.gov</a></div></div></div></div></div>
</div></div></div>