Thanks a lot Satish! Like Jed said, it would be better if we could come up an algorithm for automatically computing a hash size for a given n. Otherwise, we may need to add more entries to the lookup again in the future.
Fande, On Mon, Jan 9, 2017 at 2:14 PM, Satish Balay <ba...@mcs.anl.gov> wrote: > On Mon, 9 Jan 2017, Jed Brown wrote: > > > Satish Balay <ba...@mcs.anl.gov> writes: > > > Sure - I'm using a crappy algorithm [look-up table] to get > > > "prime_number_close_to(1.4*sz)" - as I don't know how to generate > > > these numbers automatically. > > > > FWIW, it only needs to be coprime with PETSC_HASH_FACT. > > Not sure I understand - are you saying coprime requirement is easier > satisfy than a single prime? > > I had switched this code to use double-hasing algorithm - and the > requirement here is - the table size be a prime number. [so I'm > attempting to estimate a prime number suitable for the table size] > > I pushed the following > https://urldefense.proofpoint.com/v2/url?u=https-3A__ > bitbucket.org_petsc_petsc_commits_d742c75fd0d514f7fa1873d5b10984 > bc3f363031&d=DQIBAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB_ > _aEkJFOKJFd00&r=DUUt3SRGI0_JgtNaS3udV68GRkgV4ts7XKfj2opmi > CY&m=nkPXHuaxZeHPzOteY25j_Dptk5XyWiqwzaJbEwI5uWY&s= > eOjfGCXP3g18VLYhXY5xrlOr7AFn7o3G_YrYVo8Rw8Y&e= > > Satish >