[petsc-dev] Adding support memkind allocators in PETSc

Barry Smith bsmith at mcs.anl.gov
Wed Apr 29 15:13:09 CDT 2015


> On Apr 29, 2015, at 12:29 AM, Richard Mills <rtm at utk.edu> wrote:
> 
> I think this is maybe getting away from the heart of the discussion, but anyway: Barry, you are talking about being able to mark certain allocated regions as "optional" and then have those allocations disappear, right?  I could see, say, having such an "optional" allocation that is backed by a file on some sort of "fast" storage (some super-fancy SSD or NVRAM) and whose pages can be evicted if the memory is needed.  I don't know that I like a pointer to that just being nullified if the eviction occurs, though.  For a case like this, I'd like to do something like have a Vec and only have this happen to the array of values if no "get" is outstanding.  This puts us back with an array to the numerical values that could get swapped around.

   There are many possibilities from "just release this memory" to "if you really need to you can move this to slower memory". 

   For example if after a DMRestoreLocalVector() the array memory could be marked as "release if you need the space" then on the next DMGetLocalVector() it would check if the memory had been released and allocated it again. If it had not been released then it would just use it.

   Clearly you can't just mark memory that is being passed around randomly in user code as "release if need the space" but you can for carefully controlled memory.

  Barry

> 
> On Tue, Apr 28, 2015 at 8:44 PM, Jed Brown <jed at jedbrown.org> wrote:
> Barry Smith <bsmith at mcs.anl.gov> writes:
> >   The special malloc would need to save the locations at which it set
> >   the addresses and then switch the address to NULL. Then the code
> >   that used those locations would have to know that they that they may
> >   be set to NULL and hence check them before use.
> 
> And then PetscMalloc(...,&tmp); foo->data = tmp; creates SEGV at some
> unpredictable time.  Awesome!
> 
> >   I am not saying this particular thing would be practical or not,
> >   just that if we had a concept of a malloc context for each malloc
> >   there are many games we could try that we couldn't try otherwise and
> >   this is just one of them.
> 
> I'm not convinced, except in the case of mixing in madvise hints.
> 




More information about the petsc-dev mailing list