[petsc-users] How to use khash in PETSc?

Matthew Knepley knepley at gmail.com
Thu Apr 4 14:12:03 CDT 2019


On Thu, Apr 4, 2019 at 2:53 PM Fande Kong <fdkong.jd at gmail.com> wrote:

> Thanks Lisandro,
>
> PetscHSetI and PetscHMapI work pretty well.
>
> Even though I did not do any performance profiling, I have some questions
> on this.
>
> What is the right way to preallocate the memory for PetscHSetI and
> PetscHMapI? Just call "XXXResize()"?  Should we always need to figure out
> the right size of the hash table? Or just leave the hash table
> automatically reallocate the memory?   Dynamic memory reallocation will
> hurt any performance?
>

Unless you know the approximate size, its fine to have it dynamically
allocate.

  Matt


> Thanks,
>
> Fande,
>
>
>
> On Mon, Mar 25, 2019 at 3:37 AM Lisandro Dalcin <dalcinl at gmail.com> wrote:
>
>>
>>
>> On Mon, 25 Mar 2019 at 02:40, Matthew Knepley via petsc-users <
>> petsc-users at mcs.anl.gov> wrote:
>>
>>> On Sun, Mar 24, 2019 at 12:38 PM Fande Kong via petsc-users <
>>> petsc-users at mcs.anl.gov> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Since PetscTable will be replaced by khash in the future somehow,  it
>>>> is better to use khash for new implementations. I was wondering where I can
>>>> find some examples that use khash? Do we have any petsc wrappers of khash?
>>>>
>>>
>>> First look here:
>>>
>>>
>>> https://bitbucket.org/petsc/petsc/src/master/include/petsc/private/hashseti.h
>>>
>>>
>>
>>> and the other associated files (setij, mapi, mapij). Lisandro did a good
>>> job organizing
>>> these, and we might have already defined what you want.
>>>
>>>
>> It is even documented, which is extremely unusual coming from me!!!
>>
>> --
>> Lisandro Dalcin
>> ============
>> Research Scientist
>> Extreme Computing Research Center (ECRC)
>> King Abdullah University of Science and Technology (KAUST)
>> http://ecrc.kaust.edu.sa/
>>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190404/11de7216/attachment.html>


More information about the petsc-users mailing list