What is going on here?  If IS is caching this nonlocal stuff, then every function causing mutation (e.g. ISGeneralSetIndices, and a few others) needs to be visited and made to discard the gathered and nonlocal caches.  But I think this whole idea is just dangerous and abuses the IS.  The user can always do ISAllGather if they really want everything, and it's potentially cheaper than this new ISGetTotalIndices because it can maintain ISStride or ISBlock structure.  If you want all the indices, use ISAllGather and then ISGetIndices, it will cost the same and then the user has explicit control over when to free this memory.  In principle, ISGetNonlocalIS could be implemented to avoid the intermediate storage of ISAllGather followed by ISDifference, but it's not currently done this way and currently both copies are cached so they have to both exist, and since the IS is managing ownership of this other nonlocal IS, you can't keep the nonlocal part.<div>
<br></div><div>I just don't understand the point of all these new functions, they feel like an inferior interface to something that is currently available.</div><div><br></div><div>Same question for ISAllGatherIndices which has been around for a long time.  It looks to me like the user can do ISCreateGeneral(), ISAllGather(), ISGetIndices() to achieve exactly the same thing (no performance difference).  Why even call it IS when no IS (or PETSc object of any kind is used by this function)?  It is never used in PETSc.<br>
<div><br></div><div>Jed</div></div>