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

Fande Kong fdkong.jd at gmail.com
Thu Apr 4 13:53:36 CDT 2019


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?

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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190404/7c96fa1c/attachment.html>


More information about the petsc-users mailing list