[petsc-dev] put options into hash table

Matthew Knepley knepley at gmail.com
Mon Nov 25 18:44:31 CST 2013

On Mon, Nov 25, 2013 at 6:38 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
> >    If we put all the options passed in into a hash table then won’t a
> >    PetscOptions look up be pretty cheap, compute the hash, look in the
> >    table, check that the strings match with a strncmp, done (usually)
> >    and at worst do 2 or 3 string compares?
> Yes, I have always thought that we should use a hash for the options
> table...
> >    If we adopt the view that an options check is very cheap that we
> >    don’t need to worry much about options being rechecked right?
> ... however, I don't think it changes the picture that we should move
> options testing out of the fast path for algorithms.  The hash just
> pushes the pain point down somewhat, most importantly, in a way that is
> scalable in the total number of options in the options table.  But with
> a big options table, it's still a lot of string hashing and a lot of
> likely cache misses probing into the options hash.
> I would like to make PETSc competitive for integrating 20-species
> chemical systems, and I don't see room for string operations in that
> world.

I agree with every object having clearly defined configure and compute
phases. However, I do not think its all that useful to prescribe a single
model for all objects, just that the objects are clear about the model they
use. Some objects have a ton of setup to do, often with dependent parts.

I would like us to be clearer about how we get the information to objects.
For instance, I want a way to trace back to whoever set the option. If its
code, what line? If its input, from where? It has become untenable to
setup deeply nested solvers with the API, so options need to become a
universal way to configure objects.


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

More information about the petsc-dev mailing list