[petsc-dev] malloc_dump noise from threadcomm

Barry Smith bsmith at mcs.anl.gov
Sat Dec 8 18:17:52 CST 2012


On Dec 8, 2012, at 5:27 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Sat, Dec 8, 2012 at 11:18 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> On Dec 8, 2012, at 12:13 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> 
> > Sounds good to me.
> 
>    Note if we somehow specially mark a malloc in the creation of PetscHeader we may not even need to have a separate data structure for keeping track of object mallocs. Just have a special PetscMallocDump() type of function that only prints the stacks for each new object (and not for every malloc).
> 
> Okay, so add a field to TRSPACE to record object class, then have PetscLogObjCreateDefault() call a PetscTrMallocSetClass(void *malloced_addr,PetscTrMallocClass traceclass) to change the tracing class of an existing piece of memory (the implementation can walk the tables to find the memory, though in the common case, it will already be at head). Then we add support for "-malloc_dump_class mat,ksp" (no argument means trace all objects).
> 
> Sensible or overkill?

   I was thinking of just marking the first memory allocation for each object, like the PetscNew(struct tp,&(h) with a bool (another record in TRSPACE), then -malloc_dump_objects would be just like -malloc_dump except only dump memory with that mark and hence one dump for each object. Nothing fancy but get's the job done.   Could have PetscNewMark() used for this purpose. 

   Barry





More information about the petsc-dev mailing list