<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 27, 2015 at 1:56 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Apr 27, 2015, at 2:46 PM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
><br>
> Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> writes:<br>
>> MPI_Comm argument? PETSc users rarely need to call PetscMalloc()<br>
>> themselves and if they do call it then they should know the<br>
>> properties of the memory they are allocating. Most users won't<br>
>> even notice the change.<br>
><br>
> I think that's an exaggeration, but what are you going to use for the<br>
> "kind" parameter? The "correct" value depends on a ton of non-local<br>
> information.<br>
><br>
>> Note that I'd like to add this argument independent of memkind.<br>
<br>
</span> For things like we talked about the other day. Malloc zones, .... maybe some indication that it is ok that the runtime take back this memory if available memory is running low, the ability to turn off read or all access to a malloc zone so that another library cannot corrupt the data, etc. When I said independent of memkind I meant having nothing to do with memkind.<br>
<br>
You are correct that involves lots of nonlocal information or information that is not yet known, so the argument cannot be simple flags but must be a context that can be modified at later times. Crude example<br>
<br>
malloc(zone1, n,&x);<br>
....<br>
ZoneSetReadOnly(zone1);<br>
..<br>
ZoneSetAvailableIfNeeded(zone1);<br>
<br></blockquote><div><br></div><div>I really like Barry's proposal to add this context. I can think of other things that could go into that context, too, like hints about how the memory will be used (passed to the OS via madvise(2), for instance). Sure, most of the time people won't want to pass such hints and users could ignore this, but this is consistent with the PETSc philosophy of exposing various details to the user if he/she cares, but making a reasonable choice if the user doesn't.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Barry<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
><br>
> What are you going to use it for? If the allocation is small enough,<br>
> it'll probably be resident in cache and if it falls out, the lower<br>
> latency to DRAM will be better than HBM. As it gets bigger, provided it<br>
> gets enough use, then HBM becomes the right place, but later it's too<br>
> big and you have to go back to DRAM.<br>
><br>
> What happens if memory of the kind requested is unavailable? Error or<br>
> the implementations tries to find a different kind? If there are<br>
> several memory kinds, what order is used when checking?<br>
<br>
</div></div></blockquote></div><br></div><div class="gmail_extra">The questions in the second paragraph may be something worth enabling the user to set, either through some global preference or particular entries in the context.</div></div>